Score:5

"snap refresh" fails with "ERROR cannot remove snap file core18"

it flag

I have been using snap refresh every day in the last year and worked perfectly fine.

Since today I get the following error:

$ sudo snap refresh
2023-03-15T12:15:40+02:00 ERROR cannot remove snap file "core18", will retry in 3 mins: incorrect number of tail fields, expected 3 but found 4
Remove snap "core18" (2697) from the system                                                                                                                                                                                                                \error: cannot perform the following tasks:
- Mount snap "core18" (2714) (incorrect number of tail fields, expected 3 but found 4)

The output of cat /proc/self/mountinfo:

$ cat /proc/self/mountinfo | grep snap
156 80 8:32 /snap /snap rw,relatime shared:6 - ext4 /dev/sdc rw,discard,errors=remount-ro,data=ordered
263 156 0:77 / /snap/core18/2708 ro,nodev,relatime shared:44 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
266 156 0:78 / /snap/core18/2697 ro,nodev,relatime shared:56 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
269 156 0:79 / /snap/core20/1822 ro,nodev,relatime shared:58 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
272 156 0:80 / /snap/core20/1828 ro,nodev,relatime shared:60 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
275 156 0:81 / /snap/intellij-idea-ultimate/417 ro,nodev,relatime shared:62 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
278 156 0:82 / /snap/intellij-idea-ultimate/418 ro,nodev,relatime shared:64 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
281 156 0:83 / /snap/lxd/23541 ro,nodev,relatime shared:66 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
284 156 0:84 / /snap/lxd/24322 ro,nodev,relatime shared:68 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
287 156 0:85 / /snap/snapd/17950 ro,nodev,relatime shared:70 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
290 156 0:86 / /snap/snapd/18357 ro,nodev,relatime shared:72 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
293 156 0:87 / /snap/trivy/120 ro,nodev,relatime shared:74 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
296 156 0:88 / /snap/trivy/136 ro,nodev,relatime shared:76 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other
437 105 0:53 /snapd/ns /run/snapd/ns rw,nosuid,nodev - tmpfs none rw,mode=755
984 437 0:4 mnt:[4026532326] /run/snapd/ns/lxd.mnt rw - nsfs nsfs rw
2306 156 0:339 / /snap/core18/2714 ro,nodev,relatime shared:683 - fuse.snapfuse snapfuse ro,user_id=0,group_id=0,allow_other

Using:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

$ uname -r
5.15.90.1-microsoft-standard-WSL2

with Docker Desktop.

How can I troubleshoot this issue?

Edit: 4 days later I am now getting the following error:

2023-03-20T11:14:33+02:00 ERROR cannot remove snap file "core20", will retry in 3 mins: incorrect number of tail fields, expected 3 but found 4

5 days later another different error:

ERROR cannot remove snap file "snapd", will retry in 3 mins: incorrect number of tail fields, expected 3 but found 4
Score:11
ag flag

If you're running Ubuntu on wsl with Docker Desktop then the issue is that Docker is mounting the path /Docker/host to a directory under Program Files. The parsing of the mountinfo data is not handling the space and that's why you're getting the error about the incorrect number of tail fields.

To fix this I did the following:

  • Stop Docker Desktop
  • Restart wsl (wsl --shutdown)
  • Run "snap refresh"
  • Restart Docker Desktop
David avatar
cn flag
The OP made no mention of WSL or Docker so this is not an answer.
Erik Schierboom avatar
ye flag
Well, it actually _did_ solve the issue for me!
Marco Lackovic avatar
it flag
I edited my question and added the missing details. @mkinkade assumption was correct and it did solve the issue for me too.
pr flag
I didn't even have to restart wsl, just exited Docker Desktop
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.