无法修复 Ubuntu 22.04 上损坏的 snap core22

无法修复 Ubuntu 22.04 上损坏的 snap core22

在最近的一次系统更新后,Snap 出现故障。例如,Telegram 桌面停止工作。我设法删除了 Telegram,但无法重新安装。原因在于 core22 模块损坏:

error: cannot perform the following tasks:
- Run configure hook of "telegram-desktop" snap if present (run hook "configure": cannot locate base snap core22: No such file or directory)

我尝试删除 core22 来修复这个问题,但是没有效果:

error: cannot perform the following tasks:
- Remove data for snap "core22" (522) (failed to remove snap "core22" base directory: remove /var/snap/core22: directory not empty)

我也无法修复它。我试过了sudo snap refresh core22 --edge,但是没有用:

error: cannot refresh "core22": refreshing disabled snap "core22" not supported

尝试启用 core22 但sudo snap enable core22失败:

error: cannot perform the following tasks:
- Setup snap "core22" (522) security profiles (cannot find installed snap "core22" at revision 522: missing file /snap/core22/522/meta/snap.yaml)

系统信息:

5.19.0-32-generic #33~22.04.1-Ubuntu

snap list --all

Name                       Version                     Rev    Tracking         Publisher      Notes
bare                       1.0                         5      latest/stable    canonical✓     base
chromium                   110.0.5481.100              2333   latest/stable    canonical✓     -
chromium                   110.0.5481.77               2319   latest/stable    canonical✓     disabled
core                       16-2.58                     14447  latest/stable    canonical✓     core,disabled
core                       16-2.58.2                   14784  latest/stable    canonical✓     core
core18                     20230118                    2679   latest/stable    canonical✓     base,disabled
core18                     20230207                    2697   latest/stable    canonical✓     base
core20                     20230126                    1822   latest/stable    canonical✓     base
core20                     20221212                    1778   latest/stable    canonical✓     base,disabled
core22                     -                           522    latest/stable    canonical✓     disabled,broken
cups                       2.4.2-5                     872    latest/stable    openprinting✓  -
cups                       2.4.2-4                     836    latest/stable    openprinting✓  disabled
cura-slicer                4.13.2                      100    latest/stable    glasen         disabled
cura-slicer                4.13.2                      102    latest/stable    glasen         -
firecamp                   2.7.1                       202    latest/stable    nishchit14     -
firefox                    109.0.1-1                   2311   latest/stable/…  mozilla✓       disabled
firefox                    110.0-3                     2356   latest/stable/…  mozilla✓       -
gnome-3-28-1804            3.28.0-19-g98f9e67.98f9e67  161    latest/stable    canonical✓     -
gnome-3-34-1804            0+git.3556cb3               77     latest/stable    canonical✓     -
gnome-3-38-2004            0+git.891e5bc               115    latest/stable/…  canonical✓     disabled
gnome-3-38-2004            0+git.6f39565               119    latest/stable/…  canonical✓     -
gnome-42-2204              0+git.0c1a50b               56     latest/stable    canonical✓     -
gtk-common-themes          0.1-81-g442e511             1535   latest/stable/…  canonical✓     -
gtk-common-themes          0.1-79-ga83e90c             1534   latest/stable/…  canonical✓     disabled
pdftk                      2.02-4                      9      latest/stable    smoser         -
slack                      4.28.184                    67     latest/stable    slack✓         disabled
slack                      4.29.149                    68     latest/stable    slack✓         -
snap-store                 41.3-68-gf43d07e            681    latest/edge      canonical✓     -
snap-store                 41.3-66-gfe1e325            638    latest/edge      canonical✓     disabled
snapd                      2.58.3+git520.gb0848d7      18621  latest/edge      canonical✓     snapd
snapd                      2.58.2                      18357  latest/edge      canonical✓     snapd,disabled
snapd-desktop-integration  0.1                         49     latest/stable/…  canonical✓     -

响应ls -la /var/snap/core22

total 12
drwxr-xr-x  3 root root 4096 helmi  24 11:50 .
drwxr-xr-x 22 root root 4096 helmi  26 11:53 ..
drwxr-xr-x  2 root root 4096 heinä  24  2022 504

有没有办法修复,core22而无需在系统上完全重新安装 snap?谢谢

更新:添加了有关删除尝试的信息。更新 2:添加了ls -la /var/snap/core22

答案1

编辑:抱歉,我显然没有看到你已经尝试过


我可以通过刷新测试频道,然后刷新回稳定频道来解决这个问题

所以,我先跑

$ sudo snap refresh --beta core22

进而

$ sudo snap refresh --stable core22

然后安装程序返回了预期的行为

答案2

最后我找到了一个解决方案。事实上,如果我们回顾一下我在原始消息中发布的错误消息,这只是表面上的:

  1. sudo rm -rf /var/snap/core22
  2. sudo snap remove core22
  3. sudo snap install core22

相关内容