Snapd should not start if there are no Snaps installed

Bug #1730159 reported by Simon Quigley
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Fix Released
High
Unassigned
Bionic
Fix Released
High
Unassigned

Bug Description

If there are no Snaps installed (or maybe just the core Snap), snapd should shut down on boot so it does not use up resources which are not needed by the user. This would be useful in situations where installing snapd is mandatory but the user has no desire to use it (some Ubuntu flavors).

Revision history for this message
Steve Langasek (vorlon) wrote :

Since there is a snapd.socket unit, if snapd is stopped, it can correctly autostart on invocation of the 'snap' command. So this seems like a reasonable change to remove memory pressure from snapd when it's not in use.

Revision history for this message
John Lenton (chipaca) wrote :

I don't think systemd lets you express this, so it'd have to be logic inside snapd itself.

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
Steve Langasek (vorlon) wrote :

This impacts the memory footprint of all Ubuntu installs in 18.04, including e.g. lxd containers which ship no snaps by default. This should be prioritized for fixing in 18.04 (via SRU if needed).

Yes, this will need to be implemented in snapd directly; snapd will be started on boot and should cleanly shut itself down if it's idle and has no snaps installed.

Changed in snapd (Ubuntu Bionic):
status: Confirmed → Triaged
importance: Undecided → High
Revision history for this message
Simon Quigley (tsimonq2) wrote :

If someone has no snaps installed when they shut down a system, are they expected to have the same amount of snaps (0) on the next startup?

One thing that could be explored, if possible, is to not start the snapd daemon at all on boots after that (disabling the service) and if snaps are installed it could be re-enabled.

It could make boot time slightly faster, although I'm unsure by how much.

Revision history for this message
Dean Henrichsmeyer (dean) wrote :

This also impacts Ubuntu minimal so we need it fixed for release and shouldn't wait to SRU post release.

tags: added: id-5acd1db06f41344de82489f0
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

It's way too late for that behavior right now. Many features expect snapd to be live to work. Seeding happens the first time snapd runs, which means a new system will by default start without any snaps installed. The data for command-not-found is acquired by snapd while running as well. We also cannot trivially start and then stop because there's no obvious control point for when snapd is done doing what needs to get done.

So, yeah, we can look for good solutions for this problem, but changing the behavior now would be reckless in terms of stability.

Revision history for this message
Steve Langasek (vorlon) wrote :

I understand this is committed in snapd 2.36.

Changed in snapd (Ubuntu):
status: Triaged → In Progress
Steve Langasek (vorlon)
Changed in snapd (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Steve Langasek (vorlon) wrote :

This was fixed in snapd 2.36. 2.37 is now in disco and bionic-updates, and will land in trusty,xenial,cosmic soon.

Changed in snapd (Ubuntu):
status: Fix Committed → Fix Released
Changed in snapd (Ubuntu Bionic):
status: Triaged → Fix Released
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.