10

Is there a way of disabling a snap from automatically starting?

I installed the microk8s snap, which is very cool, however it starts automatically every time I restart my computer. I can stop it when I have logged in but it eats all my CPU and chews up disk time. Sometimes it can take several minutes just to get a gui up.

I can stop the service using microk8s.stop once I get a terminal running.

I want to be able to start the snap when it's needed, but this seems to integrate as a core service.

Any help is definitely appreciated!

3 Answers 3

8

To disable a service, use the systemctl command such as systemctl disable snap.snapname.application.service. For example to disable the apache webserver inside the nextcloud snap - use systemctl disable snap.nextcloud.apache.service. You can get a list of the services using snap services.

You can completely disable snaps with snap disable (name) and enable when you need it with snap enable (name).

You can see the names of services in snap info (snapname).

3
  • This disables the app entirely rather than just prevent it from automatically starting. While it works, for an app that you actually want to use (just don't want to autostart) it adds an extra step every time you want to open it. Seems like overkill.
    – bmaupin
    Sep 28, 2022 at 13:15
  • Good point. I'll edit this.
    – popey
    Sep 28, 2022 at 17:17
  • Unfortunately this still doesn't work for me, in particular with the one snap that I'm trying to prevent from auto starting: snap-store. There doesn't appear to be a systemd service for it at all. Maybe this one is different and I should ask a separate question? I don't want to uninstall the store or disable it, but I do want to prevent it from automatically starting when I log in.
    – bmaupin
    Oct 25, 2022 at 12:49
3

One more detail. If you edit X-GNOME-Autostart-enabled to false on Microsoft Teams, the app will change it to true when you execute it. To prevent that I cleared the write attribute of the .desktop file. Now MS Teams can't write to it.

1
  • 1
    For MS Teams specifically, you can set this within the app itself: 3 dots menu > Settings > General uncheck Auto-start application. Then it will stop overwriting the file.
    – bmaupin
    Sep 28, 2022 at 13:14
2

I'd prefer that snaps require to ask for specific permission for autostart....

best I've found is some .desktop files that have an entry in them for autostart.

I have found in ~/.config/autostart/ some snaps with a .desktop file there. SkypeForLinux for example.

Other times in ./snap/$snapname/current/autostart/ I've found Microsoft Teams in there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .