13

I run Ubuntu 16.04 but never installed any snap packages, at least not that I would know of any.

Here are my slowest processes at boot:

$ systemd-analyze blame | head
      9.057s snapd.refresh.service
      5.058s NetworkManager-wait-online.service
      1.126s dev-sdb5.device
       822ms storage.mount
       804ms data.mount
       397ms gpu-manager.service
       390ms apt-daily.service
       363ms systemd-rfkill.service
       334ms systemd-fsck@dev-disk-by\x2duuid-B023\x2d3905.service
       251ms accounts-daemon.service

Obviously snapd.refresh.service is taking a huge amount of time compared to the rest, especially as I have no need for snaps anyway.

How can I disable all snap related stuff to speed my boot time up?

Byte Commander
  • 107,489
  • 1
    Would systemctl disable snapd.refresh.service work? https://fedoraproject.org/wiki/Systemd#How_do_I_start.2Fstop_or_enable.2Fdisable_services.3F – Alcuin Arundel Jul 21 '16 at 01:06
  • I just tried it on my system and it seems to work. snapd.refresh.service doesn't show up when I run systemd-analyze blame | head. – Alcuin Arundel Jul 21 '16 at 01:12
  • @AlcuinArundel I ran systemctl disable snapd.* as the tab-autocomplete did only mention snapd.refresh.timer, snapd.service and snapd.socket, but not snapd.refresh.service. I think I won't need any of them at all anyway. Now the entry disappeared from the systemd-analyze blame output. Would you post an answer please? – Byte Commander Jul 21 '16 at 08:14
  • 1
    A tip for others reading this Q&A on my own system using systemctl disable NetworkManager-wait-online.service (which was taking 10 seconds) reduced systemd-analyze from 26 seconds to 16 seconds. – WinEunuuchs2Unix Mar 03 '18 at 17:08

2 Answers2

17

There's no need to disable it to speed up the boot. This was a mistake on our part, and has been fixed in 2.11, out for updating in the next couple of days. Here is the full change log:

https://github.com/snapcore/snapd/blob/2.11/debian/changelog

  • I'm on 16.04.2 and it is now 2017-07-17. systemd-analyze blame | head still shows snapd.refresh.service as slowest contributor to boot slowness @ 13.702s. snapd, snap-confine and ubuntu-core-launcher are all on version 2.26.8. Is this actually fixed in Ubuntu? – arielf Jul 17 '17 at 21:46
  • This does not answer the question of how to disable all snap related stuff. If it is not in use it shouldn't even be there. – mchid Aug 18 '17 at 11:29
6

According to the systemd wiki, the command to disable a service and prevent it from starting at bootup is:

sudo systemctl disable [foo]

so

sudo systemctl disable snapd.refresh.service

should work in this instance.

muru
  • 197,895
  • 55
  • 485
  • 740
  • 1
    Thanks. I ran systemctl disable snapd.* instead though as the tab-autocomplete did only mention snapd.refresh.timer, snapd.service and snapd.socket, but not snapd.refresh.service. – Byte Commander Jul 22 '16 at 07:44