Refreshing disabled snap "kubectl" not supported

As of a few hours ago, my kubectl snap stopped working on my system. The path is no longer in /snap/bin, snap list shows it as disabled,classic and I can’t refresh.

As a result I can no longer manage any of my kubernetes clusters. How do I rectify this and why did my snap move to disabled?

I don’t know anything that would move your snap to disabled beyond snap disable kubectl (maybe you did it thinking of snap stop --disable kubectl?). In any case you should be able to enable it again by doing snap enable kubectl.

I haven’t run a snap command in weeks, to be honest.

snap enable kubectl
error: cannot enable "kubectl": snap "kubectl" has changes in progress

I can’t delete, enable, upgrade, refresh - anything. I’ve restarted the snapd process I’ve tried everything. Something is seriously tilted.

Do remember that snapd will do a refresh in the background. (self-updating). I’m also curious as to the output of snap list --all | grep kube. I ask because I’m curious if you went through a refresh that caused this.

For example (from my system):

# snap list --all | grep qown
qownnotes              18.02.0            863   pbek           disabled
qownnotes              18.02.1            867   pbek           disabled
qownnotes              18.02.2            871   pbek           -

As you can see - my system has taken a few version through an automated refresh.

You could just move to the previous version with sudo snap revert kubectl. Test. And then you could move back to current with sudo snap refresh kubectl. Just need to determine if the issue is within the package or your system.

If you wanted to be aggressive, you could also remove the package with sudo snap remove kubectl and reinstall.

Just high level thoughts.

Oh - I missed that you could not run the other snap commands. Is that the case for all snaps on your system? Or just the kubectl one? What sort of errors do you get with things like list, etc?

Have you looked at snap changes to see what is in progress?

I’m painfully aware of the background updating. Here’s the output from my list command.

kubectl              1.9.2                    303   canonical     disabled,classic
kubectl              1.9.0                    266   canonical     disabled,classic
kubectl              1.9.1                    286   canonical     disabled,classic

I’m unable to remove it.

sudo snap revert kubectl
error: cannot revert "kubectl": cannot revert inactive snaps

Honestly, the output / errors for all these commands did not really lead me to know how I could see what’s going on. Here is that output:

ID   Status  Spawn                 Ready  Summary
481  Doing   2018-02-17T01:48:48Z  -      

Don’t know what it’s doing, but it’s not ready apparently.

For now I’ve been doing /snap/kubectl/328/kubectl as my command, but it breaks a lot of my automation/scripts/history because it expects that to be in $PATH.

snap tasks 481 would show you more info, or snap watch 481, but I agree something looks messed up.

Done    2018-02-17T01:48:48Z  2018-02-17T01:48:48Z  Ensure prerequisites for "kubefed" are available
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:49Z  Download snap "kubefed" (322) from channel "stable"
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:49Z  Fetch and check assertions for snap "kubefed" (322)
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:50Z  Mount snap "kubefed" (322)
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:50Z  Run pre-refresh hook of "kubefed" snap if present
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:50Z  Stop snap "kubefed" services
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:50Z  Remove aliases for snap "kubefed"
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:50Z  Make current revision for snap "kubefed" unavailable
Doing   2018-02-17T01:48:48Z  -                     Copy snap "kubefed" data
Do      2018-02-17T01:48:48Z  -                     Setup snap "kubefed" (322) security profiles
Do      2018-02-17T01:48:48Z  -                     Make snap "kubefed" (322) available to the system
Do      2018-02-17T01:48:48Z  -                     Set automatic aliases for snap "kubefed"
Do      2018-02-17T01:48:48Z  -                     Setup snap "kubefed" aliases
Do      2018-02-17T01:48:48Z  -                     Run post-refresh hook of "kubefed" snap if present
Do      2018-02-17T01:48:48Z  -                     Start snap "kubefed" (322) services
Do      2018-02-17T01:48:48Z  -                     Remove data for snap "kubefed" (260)
Do      2018-02-17T01:48:48Z  -                     Remove snap "kubefed" (260) from the system
Do      2018-02-17T01:48:48Z  -                     Clean up "kubefed" (322) install
Do      2018-02-17T01:48:48Z  -                     Run configure hook of "kubefed" snap if present
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:48Z  Ensure prerequisites for "kubectl" are available
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:51Z  Download snap "kubectl" (328) from channel "stable"
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:52Z  Fetch and check assertions for snap "kubectl" (328)
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:52Z  Mount snap "kubectl" (328)
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:52Z  Run pre-refresh hook of "kubectl" snap if present
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:52Z  Stop snap "kubectl" services
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:52Z  Remove aliases for snap "kubectl"
Done    2018-02-17T01:48:48Z  2018-02-17T01:48:52Z  Make current revision for snap "kubectl" unavailable
Doing   2018-02-17T01:48:48Z  -                     Copy snap "kubectl" data
Do      2018-02-17T01:48:48Z  -                     Setup snap "kubectl" (328) security profiles
Do      2018-02-17T01:48:48Z  -                     Make snap "kubectl" (328) available to the system
Do      2018-02-17T01:48:48Z  -                     Set automatic aliases for snap "kubectl"
Do      2018-02-17T01:48:48Z  -                     Setup snap "kubectl" aliases
Do      2018-02-17T01:48:48Z  -                     Run post-refresh hook of "kubectl" snap if present
Do      2018-02-17T01:48:48Z  -                     Start snap "kubectl" (328) services
Do      2018-02-17T01:48:48Z  -                     Remove data for snap "kubectl" (266)
Do      2018-02-17T01:48:48Z  -                     Remove snap "kubectl" (266) from the system
Do      2018-02-17T01:48:48Z  -                     Clean up "kubectl" (328) install
Do      2018-02-17T01:48:48Z  -                     Run configure hook of "kubectl" snap if present

Is there anyway to kill this? It’s obviously stuck as it’s been cycling for nearly 20 hours

More snaps are now disabled and stuck.

ID   Status  Spawn                 Ready  Summary
481  Doing   2018-02-17T01:48:48Z  -      
482  Doing   2018-02-19T05:32:01Z  -      Refresh snaps "lxd", "go"
Name                 Version                  Rev   Developer     Notes
atom                 1.23.3                   116   snapcrafters  classic
canonical-livepatch  7.24                     26    canonical     -
charm                2.2.3                    114   charms        -
conjure-up           2.5.3-20180208.2102      962   canonical     classic
core                 16-2.30                  3887  canonical     core
datagrip             2017.3.5                 6     jetbrains     classic
go                   1.9.4                    1404  mwhudson      disabled,classic
juju                 2.3.3                    3452  canonical     classic
kubectl              1.9.2                    303   canonical     disabled,classic
kubefed              1.9.2                    297   canonical     disabled,classic
lxd                  2.21                     5785  canonical     disabled
peek                 1.0.1+git                96    phw           devmode
petname              2.8                      13    kirkland      -
skype                8.15.0.4                 13    skype         classic
spotify              1.0.70.399.g5ffabd56-26  5     spotify       -
vectr                0.1.15                   2     vectr         -
wavebox              3.10.0                   76    wavebox       -
yakyak               1.4.3                    1     snapcrafters  -

Could you get on IRC sometime today, so we can debug this? Thanks…

Was there ever a resolution to this topic? I have a snap installed that is stuck in autorefresh. I can’t manually refresh, remove, stop, etc. Everything seems to produce the following…

error: snap “todoist” has “auto-refresh” change in progress

I’m not sure how to get it unstuck.

Nevermind. I was able to resolve this with a restart. I didn’t document it like I should but I ended up having to hold the power button to get the machine off. it was stuck trying to unmount something related to snaps. So I’m sure that was a related factor why it was stuck autorefreshing.