49

I've just installed Ubuntu 18.04. After a few minutes I noticed my bandwidth is remarkably low. I installed nethogs and realized /usr/lib/snapd/snapd is consuming my internet.

Questions:

  1. How can I disable it? It really stops me from using the internet.
  2. Can I disable snap package system when installing Ubuntu?

Thanks a lot,

6
  • 1
    I assume that it is important to preserve a way to get security updates for existing snap packages. Leaving the system without an automated security upgrade procedure would be taking a huge step backwards. But of course there needs to be a way to manage overuse of bandwidth.
    – nealmcb
    Sep 29 '18 at 21:13
  • 2
    this script will start snap service, do a refresh and disable it again : gist.github.com/rubo77/15366925051dd214b18c306f9389a573
    – rubo77
    Jan 13 '20 at 18:10
  • 1
    It would help if at least the snap daemon would ask me if I want to update now because updating an app e.g. Chrome that is currently running usually lets that app crash. Sometimes I am getting a message "New Software Updates available – Install/View/Cancel" but when I click "View", I can not see updates and they usually just have been installed automatically. Really annoying.
    – w-sky
    Mar 4 at 10:07
  • 3
    @nealmcb the real step backwards is for Ubuntu to go the Microsoft way and force-install stuff on our computers without allowing even advanced users to opt-out. What's worse, is that while Microsoft's forced updates are an annoyance, Snap's auto-updates are a SECURITY RISK because they auto-update from any arbitrary vendor. the fact that I trust some vendor enough to install their app today (possibly after some vetting), does not mean I necessarily will trust them tomorrow. you don't think that auto-updates themselves can be insecure? tell that to the customers of Solar Wind.
    – obe
    Jun 19 at 12:41
  • 1
    Very well put, @obe! So many competing priorities....
    – nealmcb
    Jul 25 at 16:41
44
  1. You can disable autostart for the service by clicking on the start button then search for "Startup Applications" and change the setting like this.


  1. If these answers did't help out you may do next:

    sudo systemctl mask snapd.service - Completely disable the service by linking it to /dev/null; you cannot start the service manually or enable the service.

    sudo systemctl unmask snapd.service - Removes the link to /dev/null and restores the ability to enable and or manually start the service


If you will need update a snap program you can unmask and start the service, then use command snap refresh

9
  • 3
    this should be considered the real answer. the "official" answer is just giving the asker the runaround. Jul 26 '18 at 8:02
  • 1
    The answer should show how to open that services dialog
    – doug
    Jul 28 '18 at 16:43
  • 1
    Wouldn't this disable security updates, leaving the system vulnerable the next time a new vulnerability isn't patched?
    – nealmcb
    Sep 29 '18 at 21:11
  • 8
    Security updating is to use 1Mb/s for a couple of seconds each now and then (possibly while the screen is locked), not 1Mb/s for five minutes while I'm gaming, this is a plain abuse of my internet connection. Before doing a couple of lsof I thought it was some weird malware.
    – Avio
    Feb 15 '19 at 20:51
  • 1
    If I mask sanpd, will my already installed snap applications crash OR wont work in the next boot? I want to disable auto updates. But still want to use snap applications Apr 20 '20 at 3:31
40

Snap packages are a good way to get access to much more software than before. You can now get as snap packages Skype, LibreOffice latest, GIMP latest, all JetBrains IDEs or even games.

All these are installed using the Ubuntu Software application and it's not necessary to use the command line.

The important question for you is this, do you really need to disable snap packages?

To temporarily disable snap packages (until reboot or if you run with start):

sudo systemctl stop snapd.service

To permanently disable snap packages:

sudo systemctl stop snapd.service
sudo systemctl disable snapd.service

To reenable snap packages:

sudo systemctl reenable snapd.service
sudo systemctl start snapd.service
2
  • 3
    Answer does not work: Merely disabling snapd is not enough. My system started snapd after reboot nevertheless. Jan 2 '20 at 22:47
  • 7
    disabling didn't work, after reboot it is automatically re-enabled. you have to mask the service with sudo systemctl mask snapd.service to make it reboot-safe (stop it manually if you don't want to reboot)
    – rubo77
    Jan 13 '20 at 17:04
13

You can stop and mask your snapd service with:

systemctl mask snapd.service
systemctl stop snapd.service

And then use this script, which will give you the possibility to update your snaps easily ever still:

#!/bin/bash

# this script unmasks and starts the snapd service, do a refresh and disables it again

set -x
systemctl unmask snapd.service
systemctl start snapd.service
systemctl status --no-pager snapd.service
snap refresh
systemctl mask snapd.service
systemctl stop snapd.service
sleep 2
kill -9 $(pgrep snapd)

Put it in /usr/local/sbin/snap-update and give it executable rights with chmod +x.

Then you can just run:

sudo snap-update

I created a gist for it here that also deletes the old snaps, after new ones are installed.

Note: If you run the apt auto updater and there is an update to a package that is managed by snapd, it will hang if snapd is masked, so remember to unmask snapd in that case and start apt upgrade again

4

I tried determining the pid for /usr/lib/snapd/snapd, using sudo nethogs wlp4s0.
Then killed this process using sudo kill -9 pid_of_the process.
Then disabled this process using sudo systemctl disable snapd.service.
Since then, i'm living a peaceful life. My data usage remains under control as well.

1
  • 2
    +1 for nethogs, nice tool! But for stopping snapd you can use simply pgrep: one line: sudo kill -9 $(pgrep snapd); sudo systemctl stop snapd.service; sudo systemctl mask snapd.service
    – rubo77
    Jan 13 '20 at 18:02
2

You can change update time of snap to, say, Monday 12 a.m. like this:

sudo snap set system refresh.timer=mon,12:00

Then you have to refresh it

sudo snap refresh

As mentioned you can also temporarily disable updates:

sudo systemctl stop snapd.service
1

snaps updates are controlled by the app developers if you don't want a particular snap to update you could ask the developer to create a "static" channel which they simply don't update, updates would then be a simple matter of switching channels with `sudo snap refesh --channel=

i see that nextcloud approaches it this way; they appear to have a channel for version 12, among others, which hasn't seen an update since 2018

0

I see that disable service is not enough to stop the service. for me, I needed to disable snapd.socket

sudo systemctl stop snapd.socket
sudo systemctl disable snapd.socket

Not the answer you're looking for? Browse other questions tagged or ask your own question.