We recently released microk8s and one of our users reported that the snap got enabled even though he had explicitly disabled it. Here is the snap changes and tasks you requested.
$ snap changes 130 ↵
ID Status Spawn Ready Summary
418 Done yesterday at 22:16 CEST yesterday at 22:16 CEST Auto-refresh snap "microk8s"
419 Done today at 11:46 CEST today at 11:46 CEST Running service command
420 Done today at 14:02 CEST today at 14:02 CEST Running service command
$ snap tasks 418
Status Spawn Ready Summary
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Ensure prerequisites for "microk8s" are available
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Download snap "microk8s" (185) from channel "edge"
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Fetch and check assertions for snap "microk8s" (185)
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Mount snap "microk8s" (185)
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Run pre-refresh hook of "microk8s" snap if present
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Stop snap "microk8s" services
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Remove aliases for snap "microk8s"
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Make current revision for snap "microk8s" unavailable
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Copy snap "microk8s" data
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Setup snap "microk8s" (185) security profiles
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Make snap "microk8s" (185) available to the system
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Automatically connect eligible plugs and slots of snap "microk8s"
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Set automatic aliases for snap "microk8s"
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Setup snap "microk8s" aliases
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Run post-refresh hook of "microk8s" snap if present
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Start snap "microk8s" (185) services
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Remove data for snap "microk8s" (176)
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Remove snap "microk8s" (176) from the system
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Clean up "microk8s" (185) install
Done yesterday at 22:16 CEST yesterday at 22:16 CEST Run configure hook of "microk8s" snap if present
Sorry for the confusion with this (I’m the one this happened to).
It wasn’t a snap that was disabled, but one that was explicitly stopped.
I snap stop microk8s and went on my business. Several hours later, I noticed that microk8s was running again, which was initially confusing. We had a new release pushed to edge, and during the upgrade the service was restarted.
I expected (right or wrongly) that when I stopped the service, that it wouldn’t be started until I explicitly did so, or rebooted. For background refreshing applications, I’d hope they would maintain the state I put it in (stopped or running) post-upgrade, but that’s more of a usage issue rather than a bug maybe.
I think you probably had meant to do snap stop --disable microk8s instead of snap stop microk8s, as the --disable flag is supposed to prevent the service from starting again, even when refreshed/rebooted, etc.
However, I now see @chipaca’s point about my PR, because currently snapd will always start services whether they are disabled or not during refresh/install, and my PR makes it so that disabled services don’t get started automatically.
I think that it’s expected behavior for a stopped service to come up again if it gets refreshed, as that’s effectively the same as if the system was rebooted. However for disabled services it shouldn’t ever get restarted automatically.