Problem with snap refresh certbot

I’m having an ongoing problem getting snap to update certbot.

When I try to refresh manually, it appears that the update is hung:

Name               Version                     Rev    Tracking         Publisher     Notes
certbot            1.12.0                      952    latest/stable    certbot-eff✓  classic
chromium           89.0.4389.90                1523   latest/stable    canonical✓    -
core               16-2.49                     10859  latest/stable    canonical✓    core
core18             20210128                    1988   latest/stable    canonical✓    base
core20             20201210                    904    latest/stable    canonical✓    base
gnome-3-28-1804    3.28.0-19-g98f9e67.98f9e67  145    latest/stable    canonical✓    -
gnome-3-34-1804    0+git.3556cb3               66     latest/stable/…  canonical✓    -
gtk-common-themes  0.1-50-gf7627e4             1514   latest/stable/…  canonical✓    -
snap-store         3.38.0-59-g494f078          518    latest/stable/…  canonical✓    -
snapd              2.49                        11107  latest/stable    canonical✓    snapd
xxx@minisquawk:~$ sudo snap refresh certbot
error: snap "certbot" has "auto-refresh" change in progress

If I try to abort the update, I get an error:

ID   Status  Spawn                     Ready  Summary
21   Doing   4 days ago, at 21:31 EDT  -      Auto-refresh snaps "chromium", "certbot"

xxx@minisquawk:~$ sudo snap abort 21
xxx@minisquawk:~$ sudo snap changes
ID   Status   Spawn                     Ready  Summary
21   Undoing  4 days ago, at 21:31 EDT  -      Auto-refresh snaps "chromium", "certbot"

xxx@minisquawk:~$ sudo snap changes
ID   Status  Spawn                     Ready               Summary
21   Error   4 days ago, at 21:31 EDT  today at 04:34 EDT  Auto-refresh snaps "chromium", "certbot"

Looking at the system log I see

Mar 19 04:36:16 minisquawk snapd[700]: taskrunner.go:271: [change 22 "Mount snap \"certbot\" (1042)" task] failed: [disable snap-certbot-1042.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

Unfortunately, when I sudo apt-get update and sudo apt-get upgrade it will generally do something that causes certbot to stop working. The new version directory is created and all of the symlinks get broken.

Can anyone tell me how to fix this?

Thanks!

And here is the state that the system gets left in, and what I do to get it working again.

As you can see, the new version directory is created (1042) but it’s empty. I can get certbot working again by restoring the appropriate symlinks to the previous version (952):

xxx@minisquawk:~$ ls /snap/bin
chromium  chromium.chromedriver  snap-store  snap-store.ubuntu-software  snap-store.ubuntu-software-local-file
xxx@minisquawk:/snap/bin$ sudo ln -s /usr/bin/snap certbot
xxx@minisquawk:/snap/bin$ sudo certbot certificates
internal error, please report: running "certbot" failed: cannot find current revision for snap certbot: readlink /snap/certbot/current: no such file or directory
xxx@minisquawk:/snap/bin$ cd ../certbot
xxx@minisquawk:/snap/certbot$ ls
1042  952
xxx@minisquawk:/snap/certbot$ ls 1042
xxx@minisquawk:/snap/certbot$ ls 952
bin  certbot-metadata  etc  include  lib  lib64  meta  pyvenv.cfg  share  snap  usr
xxx@minisquawk:/snap/certbot$ sudo snap changes
ID   Status  Spawn                     Ready               Summary
21   Error   4 days ago, at 21:31 EDT  today at 04:34 EDT  Auto-refresh snaps "chromium", "certbot"
22   Doing   today at 04:36 EDT        -                   Auto-refresh snaps "certbot", "chromium"
23   Done    today at 04:49 EDT        today at 04:49 EDT  Refresh all snaps: no updates

ed@minisquawk:/snap/certbot$ sudo ln -s 952 current

What is the output of snap tasks 21 and snap tasks 22 ?

xxx@minisquawk:~$ snap tasks 21
Status  Spawn                     Ready                     Summary
Done    4 days ago, at 21:31 EDT  today at 04:34 EDT        Ensure prerequisites for "chromium" are available
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Download snap "chromium" (1523) from channel "latest/stable"
Done    4 days ago, at 21:31 EDT  today at 04:34 EDT        Fetch and check assertions for snap "chromium" (1523)
Error   4 days ago, at 21:31 EDT  today at 04:34 EDT        Mount snap "chromium" (1523)
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Run pre-refresh hook of "chromium" snap if present
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Stop snap "chromium" services
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Remove aliases for snap "chromium"
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Make current revision for snap "chromium" unavailable
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Copy snap "chromium" data
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Setup snap "chromium" (1523) security profiles
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Make snap "chromium" (1523) available to the system
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Automatically connect eligible plugs and slots of snap "chromium"
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Set automatic aliases for snap "chromium"
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Setup snap "chromium" aliases
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Run post-refresh hook of "chromium" snap if present
Undone  4 days ago, at 21:31 EDT  today at 04:34 EDT        Start snap "chromium" (1523) services
Done    4 days ago, at 21:31 EDT  today at 04:34 EDT        Remove data for snap "chromium" (1479)
Hold    4 days ago, at 21:31 EDT  today at 04:34 EDT        Remove snap "chromium" (1479) from the system
Hold    4 days ago, at 21:31 EDT  today at 04:34 EDT        Clean up "chromium" (1523) install
Hold    4 days ago, at 21:31 EDT  today at 04:34 EDT        Run configure hook of "chromium" snap if present
Hold    4 days ago, at 21:31 EDT  today at 04:34 EDT        Run health check of "chromium" snap
Done    4 days ago, at 21:31 EDT  today at 04:34 EDT        Ensure prerequisites for "certbot" are available
Undone  4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Download snap "certbot" (1042) from channel "latest/stable"
Done    4 days ago, at 21:31 EDT  today at 04:34 EDT        Fetch and check assertions for snap "certbot" (1042)
Error   4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Mount snap "certbot" (1042)
Undone  4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Run pre-refresh hook of "certbot" snap if present
Undone  4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Stop snap "certbot" services
Undone  4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Remove aliases for snap "certbot"
Error   4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Make current revision for snap "certbot" unavailable
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Copy snap "certbot" data
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Setup snap "certbot" (1042) security profiles
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Make snap "certbot" (1042) available to the system
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Automatically connect eligible plugs and slots of snap "certbot"
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Set automatic aliases for snap "certbot"
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Setup snap "certbot" aliases
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Run post-refresh hook of "certbot" snap if present
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Start snap "certbot" (1042) services
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Clean up "certbot" (1042) install
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Run configure hook of "certbot" snap if present
Hold    4 days ago, at 21:31 EDT  4 days ago, at 21:31 EDT  Run health check of "certbot" snap
Hold    4 days ago, at 21:31 EDT  today at 04:34 EDT        Consider re-refresh of "chromium", "certbot"

......................................................................
Mount snap "chromium" (1523)

2021-03-19T04:34:55-04:00 ERROR [disable snap-chromium-1523.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links


......................................................................
Remove snap "chromium" (1479) from the system

2021-03-19T04:06:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:09:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:12:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:15:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:18:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:21:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:24:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:27:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:30:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T04:33:56-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links


......................................................................
Mount snap "certbot" (1042)

2021-03-15T21:31:37-04:00 ERROR [disable snap-certbot-1042.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links


......................................................................
Make current revision for snap "certbot" unavailable

2021-03-15T21:31:35-04:00 ERROR [disable snap.certbot.renew.timer] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

and

xxx@minisquawk:~$ snap tasks 22
Status  Spawn               Ready               Summary
Done    today at 04:36 EDT  today at 04:36 EDT  Ensure prerequisites for "chromium" are available
Done    today at 04:36 EDT  today at 04:36 EDT  Download snap "chromium" (1523) from channel "latest/stable"
Done    today at 04:36 EDT  today at 04:36 EDT  Fetch and check assertions for snap "chromium" (1523)
Done    today at 04:36 EDT  today at 04:36 EDT  Mount snap "chromium" (1523)
Done    today at 04:36 EDT  today at 04:36 EDT  Run pre-refresh hook of "chromium" snap if present
Done    today at 04:36 EDT  today at 04:36 EDT  Stop snap "chromium" services
Done    today at 04:36 EDT  today at 04:36 EDT  Remove aliases for snap "chromium"
Done    today at 04:36 EDT  today at 04:36 EDT  Make current revision for snap "chromium" unavailable
Done    today at 04:36 EDT  today at 04:36 EDT  Copy snap "chromium" data
Done    today at 04:36 EDT  today at 04:36 EDT  Setup snap "chromium" (1523) security profiles
Done    today at 04:36 EDT  today at 04:36 EDT  Make snap "chromium" (1523) available to the system
Done    today at 04:36 EDT  today at 04:36 EDT  Automatically connect eligible plugs and slots of snap "chromium"
Done    today at 04:36 EDT  today at 04:36 EDT  Set automatic aliases for snap "chromium"
Done    today at 04:36 EDT  today at 04:36 EDT  Setup snap "chromium" aliases
Done    today at 04:36 EDT  today at 04:36 EDT  Run post-refresh hook of "chromium" snap if present
Done    today at 04:36 EDT  today at 04:36 EDT  Start snap "chromium" (1523) services
Done    today at 04:36 EDT  today at 04:36 EDT  Remove data for snap "chromium" (1479)
Doing   today at 04:36 EDT  -                   Remove snap "chromium" (1479) from the system
Do      today at 04:36 EDT  -                   Clean up "chromium" (1523) install
Do      today at 04:36 EDT  -                   Run configure hook of "chromium" snap if present
Do      today at 04:36 EDT  -                   Run health check of "chromium" snap
Done    today at 04:36 EDT  today at 04:36 EDT  Ensure prerequisites for "certbot" are available
Undone  today at 04:36 EDT  today at 04:36 EDT  Download snap "certbot" (1042) from channel "latest/stable"
Done    today at 04:36 EDT  today at 04:36 EDT  Fetch and check assertions for snap "certbot" (1042)
Error   today at 04:36 EDT  today at 04:36 EDT  Mount snap "certbot" (1042)
Undone  today at 04:36 EDT  today at 04:36 EDT  Run pre-refresh hook of "certbot" snap if present
Undone  today at 04:36 EDT  today at 04:36 EDT  Stop snap "certbot" services
Undone  today at 04:36 EDT  today at 04:36 EDT  Remove aliases for snap "certbot"
Error   today at 04:36 EDT  today at 04:36 EDT  Make current revision for snap "certbot" unavailable
Hold    today at 04:36 EDT  today at 04:36 EDT  Copy snap "certbot" data
Hold    today at 04:36 EDT  today at 04:36 EDT  Setup snap "certbot" (1042) security profiles
Hold    today at 04:36 EDT  today at 04:36 EDT  Make snap "certbot" (1042) available to the system
Hold    today at 04:36 EDT  today at 04:36 EDT  Automatically connect eligible plugs and slots of snap "certbot"
Hold    today at 04:36 EDT  today at 04:36 EDT  Set automatic aliases for snap "certbot"
Hold    today at 04:36 EDT  today at 04:36 EDT  Setup snap "certbot" aliases
Hold    today at 04:36 EDT  today at 04:36 EDT  Run post-refresh hook of "certbot" snap if present
Hold    today at 04:36 EDT  today at 04:36 EDT  Start snap "certbot" (1042) services
Hold    today at 04:36 EDT  today at 04:36 EDT  Clean up "certbot" (1042) install
Hold    today at 04:36 EDT  today at 04:36 EDT  Run configure hook of "certbot" snap if present
Hold    today at 04:36 EDT  today at 04:36 EDT  Run health check of "certbot" snap
Doing   today at 04:36 EDT  -                   Consider re-refresh of "certbot", "chromium"

......................................................................
Remove snap "chromium" (1479) from the system

2021-03-19T10:36:46-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:39:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:42:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:45:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:48:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:51:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:54:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T10:57:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T11:00:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

2021-03-19T11:03:47-04:00 ERROR cannot remove snap file "chromium", will retry in 3 mins: [disable snap-chromium-1479.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links


......................................................................
Mount snap "certbot" (1042)

2021-03-19T04:36:16-04:00 ERROR [disable snap-certbot-1042.mount] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links


......................................................................
Make current revision for snap "certbot" unavailable

2021-03-19T04:36:15-04:00 ERROR [disable snap.certbot.renew.timer] failed with exit status 1: Failed to disable unit: Too many levels of symbolic links

Not sure if this is related…

xxx@minisquawk:~$ ls -l /
total 2097232
lrwxrwxrwx   1 root root          7 Feb 11 17:30 bin -> usr/bin

... 

xxx@minisquawk:~$ ls -l /snap/bin
total 0
lrwxrwxrwx 1 root root 13 Mar 19 04:51 certbot -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Mar 19 04:36 chromium -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Mar 19 04:36 chromium.chromedriver -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Feb 11 17:30 snap-store -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Feb 11 17:30 snap-store.ubuntu-software -> /usr/bin/snap
lrwxrwxrwx 1 root root 13 Feb 11 17:30 snap-store.ubuntu-software-local-file -> /usr/bin/snap

xxx@minisquawk:~$ ls -l /usr/bin | grep snap
-rwxr-xr-x 1 root root    23618992 Feb  2 03:21 snap
lrwxrwxrwx 1 root root          20 Feb  2 03:21 snapctl -> ../lib/snapd/snapctl
-rwxr-xr-x 1 root root       43304 Feb  2 03:21 snapfuse
lrwxrwxrwx 1 root root          25 Feb  2 03:21 ubuntu-core-launcher -> ../lib/snapd/snap-confine
xxx@minisquawk:~$ ls -l /usr/lib | grep snap
drwxr-xr-x  2 root root  4096 Feb 11 17:56 snapd