63

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,

Shahin
  • 753

7 Answers7

49
  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

rubo77
  • 34,024
  • 52
  • 172
  • 299
45

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
Simos
  • 904
16

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

rubo77
  • 34,024
  • 52
  • 172
  • 299
5

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.

taurus05
  • 151
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
Zanna
  • 72,312
2

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
Mohannd
  • 161
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 <snap> --channel=<new-version>

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

Fuseteam
  • 445