snap connections/interfaces shows dropped interfaces as connected after refresh

Bug #1848516 reported by Jamie Strandboge on 2019-10-17
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
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
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) on 2019-10-24
Changed in snapd:
status: New → Confirmed
Changed in snapd:
assignee: nobody → Paweł Stołowski (stolowski)
Changed in snapd:
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers