Snapd required dependencies to start

Hello everyone,

We are having interesting experiences on Lubuntu daily builds regarding snaps.

Lubuntu has snapd installed but has no pre-installed snaps like Ubuntu does or Budgie with their welcome thing. In a clean installation, any snap we install does not integrate with the DE immediately. snapd is not even running according to systemctl. After logout/login, we are able to see the normal and expected behavior - namely the user being able to find the application in the application menu. Regardless, we can fire the application via the terminal right after installation.
Please don’t start mentioning the problem is in the DE because no one can be sure of that yet.

Since other distributions have pre-installed snaps, I’m considering the possibility that these core snaps do something to snapd that, in a clean installation things just work out of the box.

Why is this happening? How can we ensure snapd and snaps will work without the need to seed a snap for it to run properly?

did you check if it is probably simply a matter of time instead of actually needing logout/in (i.e. snapd being slow on first boot) ?

also, snapd is socket activated, does snap version work (or any other snap command) in that state ?

typically the first snap you install should pull in the correct base (core or core18) alongside, so you shouldnt need to pre-seed anything unless you want to not bother your users with the extra downloads.

1 Like

Hi,

Thanks for replying,

Snap commands do work but there is none activate. For instance, if you do snap list it will return that there are no snaps installed.
We thought perhaps all it needed was the core snap, so I tried installing the core and then another package. It doesn’t work anyway until it actually reloads (through logout/login, for example).

The mindset behind this idea of having snaps available but no pre-installed snaps is to actually reduce resource allocation. We would like if they worked right out of the box but if it is not possible, at least we can tell users they should work after logout/login.

well, if snapd was preinstalled from your iso there is really no reason for this behaviour, while snapd mangles the search paths for snap binaries, desktop files and icons , the respecive snippets doing this should all be in place before your desktop starts up (they come from the deb from your iso).

that snap list tells you there are no snaps is indeed correct and fine, a snap install hello should auto-pull core along the hello snap as i said above …

i’d file a bug on launchpad, there is surely something wrong here in the chain …

2 Likes

The team is discussing whether or not we want to seed the core. I think we have the possibility of including a possibility for users to confirm whether or not they want to install and have snaps available out of the box. That would install snap core by default and since it is required to reboot the machine after installation, then things should work the same.

I will move this discussion to a LP report to see what the devs what to say about it. Thanks :+1:

2 Likes

This is just a guess, but I wonder if Lubuntu only monitors $XDG_DATA_DIRS/applications directories for changes if they exist at session start up?

The fact that the applications show up on the second login indicates that /var/lib/snapd/desktop is being added to $XDG_DATA_DIRS, but it looks like /var/lib/snapd/desktop/applications won’t exist until the first desktop snap is installed.

You could test this hypothesis as follows:

  1. create a clean Lubuntu install
  2. ensure that the snapd package is installed
  3. run sudo mkdir /var/lib/snapd/desktop/applications
  4. log out and log in.
  5. install a desktop snap

If the snap shows up immediately without another log out/log in cycle, then this is presumably the cause. It would be fairly easy to fix by adding var/lib/snapd/desktop/applications to debian/snapd.dirs in the packaging.

3 Likes

You nailed it. Thanks for the help!

Can I mark @jamesh reply as the solution then, @wxl?

Thanks both for reviwing :smiley:

As an aside, my recommendation for lubuntu is to not ship the core snap: in the absence of any snaps, snapd will shut down and stop using resources. Given lubuntu is targeted at really small machines, that’s probably what you want.
As soon as core (or any snap) is installed snapd will stick around.

We now know what was causing applications to not to show up until the next login session. Someone still needs to make the packaging change though.

@jamesh’s answer suggests to not seed the core snap but instead properly configure the checks done to XDG_DATA_DIRS.

This sounds like we should ship this dir by default in the snapd deb instead of creating it when needed. This should solve the problem AFAICT.

4 Likes

Thanks! I’ll try to find a way to test with your revision :pray:

1 Like