4

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/

3
  • I simply kill snap-store before refreshing it.
    – Mahler
    Nov 29, 2022 at 16:00
  • The snapd developers are aware if this annoyance, and are working on possible solutions.
    – user535733
    Nov 29, 2022 at 16:16
  • 1
    @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: bugs.launchpad.net/snap-store-desktop/+bug/1998233
    – bmaupin
    Nov 29, 2022 at 16:43

1 Answer 1

2

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).

6
  • 1
    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 :/
    – bmaupin
    Nov 29, 2022 at 15:45
  • 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: bugs.launchpad.net/snap-store-desktop Thanks!
    – bmaupin
    Nov 29, 2022 at 16:32
  • 2
  • 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
    Dec 17, 2022 at 3:42
  • 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
    Dec 19, 2022 at 0:55

You must log in to answer this question.

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