Score:4

How to prevent snap-store from automatically starting

vn flag

Like many of you, I'm getting the annoying notification that there's a pending update of snap-store:

Pending update of "snap-store" snap

Close the app to avoid disruptions (13 days left)

There are plenty of suggestions at that question as to how to make the notification go away, but it will happen all over again once there's a new update to snap-store.

Question

How can I prevent snap-store from automatically starting when I log in without uninstalling it?

Cause of the problem

As best as I can tell, the reason snap-store starts automatically is because the current version has an autostart file located at ~/snap/snap-store/current/.config/autostart/ubuntu-software-service.desktop

~/snap/snap-store/current is just a symlink that points to the currently installed version of snap-store:

ls -ld ~/snap/snap-store/current
lrwxrwxrwx 1 user user 3 Sep 28 08:43 /home/user/snap/snap-store/current -> 599

I'm not sure when the autostart file was added, but I can see as of version 41.3-66-gfe1e32544+ (revision 582), the file wasn't there:

ls ~/snap/snap-store/582/.config/autostart
ls: cannot access '/home/user/snap/snap-store/582/.config/autostart': No such file or directory

And it is there in revision 592:

$ ls ~/snap/snap-store/*/.config/autostart
/home/user/snap/snap-store/592/.config/autostart:
ubuntu-software-service.desktop

What I've tried

  • This answer suggests that to prevent a snap from starting at boot, the service needs to be disabled. But there's no service for snap-store.

  • The normal way to prevent an application from automatically starting is to create a custom autostart file, which should take precedence over the system one. So that's what I did:

    $ cat ~/.config/autostart/ubuntu-software-service.desktop 
    [Desktop Entry]
    Name=Ubuntu Software
    Exec=snap-store.ubuntu-software --gapplication-service %U
    OnlyShowIn=GNOME;Unity;
    # Disable autostart
    Hidden=true
    

    Unfortunately, it doesn't work.

  • I tried creating a script in /etc/profile.d/ to kill snap-store, but it runs before logging in, before snap-store has started

Current workaround

cat ~/.config/autostart/stop-snap-store.desktop
[Desktop Entry]
Type=Application
Name=Stop Ubuntu Software
Exec=snap-store --quit
X-GNOME-Autostart-Delay=30
OnlyShowIn=GNOME;Unity;
NoDisplay=True

Or to make the change for all users, put stop-snap-store.desktop in /etc/xdg/autostart/

Mahler avatar
in flag
I simply kill snap-store before refreshing it.
user535733 avatar
cn flag
The snapd developers are aware if this annoyance, and are working on possible solutions.
vn flag
@Mahler That works for sure, but 1. it's annoying because it needs to be done every time there's an update 2. I'm not the only person using this computer, and it's not very good UX for non-technical users. I couldn't find a bug report so I created one: https://bugs.launchpad.net/snap-store-desktop/+bug/1998233
Score:2
cn flag

You're so close!

Snap autostarts are not in ~/.config/autostart/
They are located in ~/snap/<application>/current/.config/autostart/
(reference)

Let's take a look at the autostart for snap-store:

$ ls -lah ~/snap/snap-store/current/.config/autostart/
lrwxrwxrwx 1 me me   66 Nov 26 08:24 ubuntu-software-service.desktop -> /snap/snap-store/current/autostart/ubuntu-software-service.desktop

Autostart is a link to a file in /snap. We cannot edit that file (files in /snap are read-only)
But you can remove (or restore) the link.

REMOVE:  $ rm ~/snap/snap-store/current/.config/autostart/ubuntu-software-service.desktop
RESTORE: $ ln -s /snap/snap-store/current/autostart/ubuntu-software-service.desktop ~/snap/snap-store/current/.config/autostart/

Snapd will regenerate the link then next time that snap updates, so it's not a permanent solution. The immutability, self-repair, and frequent updates are key features of snaps. Folks have been wanting those features on Ubuntu for years.

Fundamentally, autostart in snaps is developer-configurable, and that those developer definitions limit user configurations (again, that's a long-desired feature of snaps).

vn flag
Thanks for the clarification. I found the autostart file in `~/snap` (looks like I forgot to mention the current version link; I'll update my question). My problem with your suggestion is that the link will simply be replaced the next time snap-store is upgraded, right? Once again, I find myself fighting snaps :/
vn flag
I wouldn't mind it auto-starting, but it was poorly implemented, resulting in the annoying "Pending update of "snap-store" snap" popup notification. I would uninstall it altogether but I'm not the only person using this computer. I agree that this should be addressed upstream. I'll see about filing a bug/feature request. Looks like this is the place: https://bugs.launchpad.net/snap-store-desktop Thanks!
vn flag
Done: https://bugs.launchpad.net/snap-store-desktop/+bug/1998233
pierrely avatar
cn flag
I can just add that command to a shortcut key and hit it when it annoys me like a fly. called it snapoff and ctrl-alt-shift-S . thanks.
pierrely avatar
cn flag
I do need to hit my shortcut key twice but it works a treat and is fun to do. snap reminder went yesterday from ' in 6 days' to 'in 1 day' today. go figure. could be the Empire Strikes Back.
pierrely avatar
cn flag
@bmaupin . maybe they are working for MS.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.