snapd doesn't ensure portals are available even when they are needed

Bug #1902915 reported by Alec B
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

* Steps to reproduce
- install the thunderbird snap
- remove xdg-desktop-portal-gtk
- start thunderbird
- write an email
- click on attach

Expected: A file choose dialog should appear.
Actual : Nothing is shown.

The snap relies on the portal to be available and is failing because it's not. Could snapd somewhow display some warnings explaining the issue or better offer to install the portals when needed?

------------------

$lsb_release -rd
Description: Ubuntu 20.04.1 LTS
Release: 20.04

$snap info thunderbird
name: thunderbird
summary: Mozilla Thunderbird email application
publisher: Canonical✓
store-url: https://snapcraft.io/thunderbird
contact: https://launchpad.net/distros/ubuntu/+source/thunderbird
license: unset
description: |
  Thunderbird is a free and open source email, newsfeed, chat, and calendaring client, that’s easy
  to set up and customize. One of the core principles of Thunderbird is the use and promotion of
  open standards - this focus is a rejection of our world of closed platforms and services that
  can’t communicate with each other. We want our users to have freedom and choice in how they
  communicate.
commands:
  - thunderbird
snap-id: k1Ml1O9GzSO2QftV0ZlWSbUfQ78nN460
tracking: latest/stable
refresh-date: yesterday at 23:37 CET
channels:
  latest/stable: 78.4.0 2020-11-03 (92) 69MB -
  latest/candidate: ↑
  latest/beta: ↑
  latest/edge: 78.4.0 2020-11-03 (92) 69MB -
installed: 78.4.0 (92) 69MB -

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, could you do

$ journalctl -f

trigger the bug and share any warning or error which was printed there?

Do you have xdg-desktop-portal-gtk installed?

Changed in thunderbird (Ubuntu):
importance: Undecided → High
status: New → Incomplete
Revision history for this message
Alec B (castegere) wrote :
Download full text (4.8 KiB)

Here's the output of
$ journalctl -f

-- Logs begin at Fri 2020-03-13 14:32:21 CET. --
Nov 05 17:14:30 main systemd[1]: Starting Hostname Service...
Nov 05 17:14:30 main dbus-daemon[1100]: [system] Successfully activated service 'org.freedesktop.hostname1'
Nov 05 17:14:30 main systemd[1]: Started Hostname Service.
Nov 05 17:15:00 main systemd[1]: systemd-hostnamed.service: Succeeded.
Nov 05 17:15:01 main CRON[12883]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 05 17:15:01 main CRON[12884]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Nov 05 17:15:01 main CRON[12883]: pam_unix(cron:session): session closed for user root
Nov 05 17:17:01 main CRON[12921]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 05 17:17:01 main CRON[12922]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 05 17:17:01 main CRON[12921]: pam_unix(cron:session): session closed for user root

Nov 05 17:17:36 main audit[3814]: AVC apparmor="DENIED" operation="open" profile="snap.thunderbird.thunderbird" name="/etc/fstab" pid=3814 comm="thunderbird-bin" requested_mask="r" denied_mask="r" fsuid=1004 ouid=0
Nov 05 17:17:36 main kernel: audit: type=1400 audit(1604593056.015:61): apparmor="DENIED" operation="open" profile="snap.thunderbird.thunderbird" name="/etc/fstab" pid=3814 comm="thunderbird-bin" requested_mask="r" denied_mask="r" fsuid=1004 ouid=0
Nov 05 17:17:36 main kernel: audit: type=1400 audit(1604593056.015:62): apparmor="DENIED" operation="open" profile="snap.thunderbird.thunderbird" name="/run/mount/utab" pid=3814 comm="thunderbird-bin" requested_mask="r" denied_mask="r" fsuid=1004 ouid=0
Nov 05 17:17:36 main audit[3814]: AVC apparmor="DENIED" operation="open" profile="snap.thunderbird.thunderbird" name="/run/mount/utab" pid=3814 comm="thunderbird-bin" requested_mask="r" denied_mask="r" fsuid=1004 ouid=0
Nov 05 17:17:36 main dbus-daemon[1100]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.481' (uid=1004 pid=3814 comm="/snap/thunderbird/92/thunderbird-bin " label="snap.thunderbird.thunderbird (enforce)")
Nov 05 17:17:36 main audit[3814]: AVC apparmor="DENIED" operation="open" profile="snap.thunderbird.thunderbird" name="/run/mount/utab" pid=3814 comm="thunderbird-bin" requested_mask="r" denied_mask="r" fsuid=1004 ouid=0
Nov 05 17:17:36 main kernel: audit: type=1400 audit(1604593056.063:63): apparmor="DENIED" operation="open" profile="snap.thunderbird.thunderbird" name="/run/mount/utab" pid=3814 comm="thunderbird-bin" requested_mask="r" denied_mask="r" fsuid=1004 ouid=0
Nov 05 17:17:36 main systemd[1]: Starting Hostname Service...
Nov 05 17:17:36 main dbus-daemon[1100]: [system] Successfully activated service 'org.freedesktop.hostname1'
Nov 05 17:17:36 main systemd[1]: Started Hostname Service.
Nov 05 17:17:36 main audit[1100]: USER_AVC pid=1100 uid=106 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.482" pid=3814 label="snap.thunderbird.thu...

Read more...

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks the reply.

> Maybe I'm missing something. It's a snap, can you explain why I need to install a debian package to get it working.

The software is self contained in the snap but it does rely on the system to provide a standard environment. The same way than the snap doesn't include a desktop environment or a display server, if you tried to start it on ubuntu server you would get an error that it can't open a display.

The portals are installed by default and a Recommends from the desktop for some cycles. Making them a depends of snapd would be wrong because they are only useful for some desktop software though.

There is space for improvement there though, you are probably not the only one that are going to end up with a system where important components are missing for a reason or another. I'm going to reassign to snapd suggesting that it should at least display some informative warning in those cases, perhaps offer to install the require component.

affects: thunderbird (Ubuntu) → snapd (Ubuntu)
Changed in snapd (Ubuntu):
status: Incomplete → New
summary: - (Snap) Cannot add an attachment to the message
+ snapd doesn't ensure portals are available even when they are needed
description: updated
Revision history for this message
Hasenkopf, Andreas (andi-hasenkopf) wrote :

I have an Xubuntu 20.04 upgraded from 18.04 (which was a clean install). Somehow I ran into the exact same problem because `xdg-desktop-portal-gtk` was not installed by default.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

I understand this can be confusing, but I'm not sure snapd should be in the business of warning about missing desktop components or dbus services of the given interface.

Snapd's desktop interface, as other snapd interfaces, grants access to dozens of resources/subsystems, some of which may not be relevant for some snaps, snapd doesn't have a way of knowing that. I think a solution to this would be a warning/popup implemented by desktop launcher script of thunderbird snap, it knows what's required for proper functioning of the snap (and can use snapctl is-connected for preliminary check, combined with runtime checks of actual services it needs).

Changed in snapd (Ubuntu):
importance: High → Medium
Revision history for this message
CoderGuy (alec-bickerton) wrote :

Sorry but I cannot disagree more.
When an application requires an external dependency that's missing, snapd must install whatever is needed to fulfil the requirements transparently.
Maybe the snap can declare this somehow, I don't know, I mostly use debs.

The current situation is terrible from a usability point of view. An end-user expects snap to just work, without any additional dependencies. That is after all the point of using Snaps.
When it doesn't they'll just install the .dep file.

Revision history for this message
Oliver Grawert (ogra) wrote :

the majority of snap packages in the store is *not* desktop focused, snaps are widely commercially used in IoT, embedded, industrial, cloud and server setups ...

unlike flatpak which is a delivery mechanism for desktop-only apps, snap is an actual package format, making portals a hard dependency of snapd would pull in desktop bits in all the above installations

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

snapd could help with Pawel's idea a bit. A snap could say "I need this and that to function" where "this" and "that" are a list of things snapd knows how to check their availability. snapd could then provide a warning to the user if any of those things aren't there (or expose that information to the snap in some manner). That seems plausible for something like portals, but possibly for other things like DBus services.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
Ian Johnson (anonymouse67) wrote :

I agree with jdstrand, I think `snap warnings` would be a good way to surface this, that ux would look something like:

```
$ snap install some-snap-needing-desktop-things
foobar installed
WARNING: there is one new warning
$ snap warnings
some-snap-needing-desktop-things depends on XYZ being installed on the host system but is not

```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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