我正在通过 LXD 启动 Ubuntu 20.04,但是当我进入容器使用它时,它无法运行:
apt update
apt full-upgrade
出现错误时停止Setting up snapd (2.47.1+20.04) ...
:
Setting up snapd (2.47.1+20.04) ...
Installing new version of config file /etc/apparmor.d/usr.lib.snapd.snap-confine.real ...
snapd.failure.service is a disabled or a static unit, not starting it.
snapd.snap-repair.service is a disabled or a static unit, not starting it.
日志:
Nov 1 14:04:01 cosstor-1 snapd[18306]: handlers.go:704: expected snap "snapd" revision 9607 to be mounted but is not
Nov 1 14:04:11 cosstor-1 snapd[18306]: taskrunner.go:271: [change 5 "Mount snap \"snapd\" (9607)" task] failed: cannot proceed, expected snap "snapd" revision 9607 to be mounted but is not
Nov 1 14:04:11 cosstor-1 snapd[18306]: handlers.go:495: Reported install problem for "snapd" as already-reported
知道该做什么吗?
在 Ubuntu 20.04 容器中,我尝试首先删除该snapd
包(因为我不需要它),但也失败了,错误:apt purge snapd -y
Removing snap core18 and revision 1885
rm: cannot remove '/snap/core18/1885': Device or resource busy
dpkg: error processing package snapd (--purge):
installed snapd package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
该怎么办?:-P
https://cloud-images.ubuntu.com/releases
是否有来自(protocol: )的 Ubuntu 映像simplestreams
默认不附带“snapd”?或者可能来自其他来源?
编辑 1:找到了解决方法!apt-mark hold snapd
...
编辑 2:我有其他 LXD 主机,其中相同的 Ubunt 20.04 容器映像显然可以正常工作,我刚刚检查过它,并且软件包snapd
已在那里更新!一切都是 Ubuntu 20.04,已完全升级(裸机、容器、QEMU VM)...
编辑3:面临类似问题的人:https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1878674
我快要放弃 Ubuntu 并回归 Debian 了!:-@
谢谢,蒂亚戈
答案1
改用Ubuntu 最小 LXD 图像。
为此,请添加适当的偏僻的对于 Ubuntu 最小 LXD 映像:
lxc remote add --protocol simplestreams ubuntu-minimal https://cloud-images.ubuntu.com/minimal/releases/
要查看可用的图像,请运行
$ lxc image list ubuntu-minimal: # all container images, from 16.04 to 20.10.
$ lxc image list ubuntu-minimal:20.04 # view just the Ubuntu 20.04 container images.
$ lxc image list ubuntu-minimal:focal # ditto.
$ lxc image info ubuntu-minimal:20.04 # get full info about the container image.
阅读更多https://discuss.linuxcontainers.org/t/ubuntu-20-04-images-are-available/7556和https://blog.simos.info/a-closer-look-at-minimal-ubuntu-for-lxd/