snap connections/interfaces shows dropped interfaces as connected after refresh

Bug #1848516 reported by Jamie Strandboge
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Paweł Stołowski

Bug Description

I dropped pulseaudio and added audio-playback in chocolate-doom-jdstrand only to find that after refresh, 'snap connections' and 'snap interfaces' showed pulseaudio as still connected.

Reproducing in a vm (eg, bionic), first make sure core is up to date (need at least 2.41 for audio-playback):
$ sudo snap refresh core

Then install a revision of chocolate-doom-jdstrand that only plugs pulseaudio (I populated the beta channel for this bug):

$ sudo snap install --beta chocolate-doom-jdstrand
chocolate-doom-jdstrand 3.0.0-4+snap4 from Jamie Strandboge (jdstrand) installed

$ snap list chocolate-doom-jdstrand
Name Version Rev Tracking Publisher Notes
chocolate-doom-jdstrand 3.0.0-4+snap4 77 beta jdstrand -

Verify the snap plugs pulseaudio:

$ grep pulseaudio /snap/chocolate-doom-jdstrand/current/meta/snap.yaml
    - pulseaudio
...

Verify the snap does not plugs audio-playback:

$ grep audio-playback /snap/chocolate-doom-jdstrand/current/meta/snap.yaml
$

Verify that the apparmor profile has pulseaudio:

$ grep '# Allow communicating with pulseaudio service for playback and, on some' /var/lib/snapd/apparmor/profiles/snap.chocolate-doom-jdstrand.demo
# Allow communicating with pulseaudio service for playback and, on some

Verify that the apparmor profile does not have audio-playback:

$ grep '# Allow communicating with pulseaudio service on the desktop in classic distro' /var/lib/snapd/apparmor/profiles/snap.chocolate-doom-jdstrand.demo
$

See what 'snap connections' and 'snap interfaces' have to say:

$ snap connections chocolate-doom-jdstrand | grep pulseaudio
pulseaudio chocolate-doom-jdstrand:pulseaudio :pulseaudio -

$ snap interfaces chocolate-doom-jdstrand | grep pulseaudio
:pulseaudio chocolate-doom-jdstrand

Ok, good, everything worked as expected.

Now, refresh to a revision that drops pulseaudio in favor of audio-playback:

$ sudo snap refresh --edge chocolate-doom-jdstrand
chocolate-doom-jdstrand (edge) 3.0.0-4+snap5 from Jamie Strandboge (jdstrand) refreshed

$ snap list chocolate-doom-jdstrand
Name Version Rev Tracking Publisher Notes
chocolate-doom-jdstrand 3.0.0-4+snap5 81 edge jdstrand -

Verify the profile does not plugs pulseaudio:

$ grep pulseaudio /snap/chocolate-doom-jdstrand/current/meta/snap.yaml
$

Verify the snap does plugs audio-playback:

$ grep audio-playback /snap/chocolate-doom-jdstrand/current/meta/snap.yaml
    - audio-playback
...

Verify that the apparmor profile does not have pulseaudio:

$ grep '# Allow communicating with pulseaudio service for playback and, on some' /var/lib/snapd/apparmor/profiles/snap.chocolate-doom-jdstrand.demo
$

Verify that the apparmor profile does have audio-playback:

grep '# Allow communicating with pulseaudio service on the desktop in classic distro' /var/lib/snapd/apparmor/profiles/snap.chocolate-doom-jdstrand.demo
# Allow communicating with pulseaudio service on the desktop in classic distro.

See what 'snap connections' and 'snap interfaces' have to say:

$ snap connections chocolate-doom-jdstrand | grep pulseaudio
pulseaudio chocolate-doom-jdstrand:pulseaudio :pulseaudio -

$ snap interfaces chocolate-doom-jdstrand | grep pulseaudio
:pulseaudio chocolate-doom-jdstrand

The above demonstrates that after refresh, though the policy on disk correctly uses audio-playback instead of pulseaudio, 'snap connections' and 'snap interfaces' are erroneously reporting that pulseaudio is still connected.

If I remove the old revision, it makes no difference:

$ sudo snap remove --revision 77 chocolate-doom-jdstrand
chocolate-doom-jdstrand (revision 77) removed

$ snap connections chocolate-doom-jdstrand | grep pulseaudio
pulseaudio chocolate-doom-jdstrand:pulseaudio :pulseaudio -

$ snap interfaces chocolate-doom-jdstrand | grep pulseaudio
:pulseaudio chocolate-doom-jdstrand

Oddly, after I remove the snap completely and then install with only the latest revision, things are still wrong:

$ sudo snap remove --purge chocolate-doom-jdstrand
chocolate-doom-jdstrand removed

$ sudo snap install chocolate-doom-jdstrand --edge
chocolate-doom-jdstrand (edge) 3.0.0-4+snap5 from Jamie Strandboge (jdstrand) installed

$ snap connections chocolate-doom-jdstrand | grep pulseaudio
pulseaudio chocolate-doom-jdstrand:pulseaudio :pulseaudio -

$ snap interfaces chocolate-doom-jdstrand | grep pulseaudio
:pulseaudio chocolate-doom-jdstrand

Changed in snapd:
importance: Undecided → Medium
importance: Medium → High
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Please also see https://bugs.launchpad.net/snapd/+bug/1849564, which seems to be a variation of this bug.

Zygmunt Krynicki (zyga)
Changed in snapd:
status: New → Confirmed
Changed in snapd:
assignee: nobody → Paweł Stołowski (stolowski)
Changed in snapd:
status: Confirmed → In Progress
Revision history for this message
Paweł Stołowski (stolowski) wrote :
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

The fix has been committed into master and will be available as a part of snapd 2.43

Changed in snapd:
milestone: none → 2.43
status: In Progress → Fix Committed
Revision history for this message
Paweł Stołowski (stolowski) wrote :

I've set it back to 'in progress', because wile PR 7683 fixed the problem for automatic connections, the issue would still occur for manual connection and PR https://github.com/snapcore/snapd/pull/8005 addresses it.

Changed in snapd:
status: Fix Committed → In Progress
Changed in snapd:
status: In Progress → Fix Committed
Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.