brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: snap can stop a service and keep it from coming back after boot

Snap
~/tips/tip-snap-stop-disable-service

sudo snap stop --disable lxd.daemon

Turn off a background service while the app itself stays installed.

Some snaps start a daemon that you never asked to have running all the time. You can switch it off and keep the package.

snap services
sudo snap stop --disable lxd.daemon

A plain stop only lasts until the next start of the machine. The --disable flag also takes the service out of the startup list. Run snap services again and the startup column should read disabled.

To bring it back later:

sudo snap start --enable lxd.daemon

I like this as a cheap way to shrink what is listening on a box. A service that is not running cannot be attacked and uses no memory, and you keep the option to turn it on for an afternoon when you need it.

For all services of a snap at once, give just the snap name. Snap also has snap disable, which goes further and switches off the whole snap, its commands included.

Check what depends on the service before you stop it. Some apps need their daemon for the command line tool to work at all, and the error you get then can be vague. If something odd happens after a change like this, enable the service again first.

Further reading: Snapcraft: Control services

More Snap tips snap refresh --list sudo snap save lxd snap services sudo snap alias vlc my-vlc snap saved All Snap tips (14) All topics

Link