标题几乎描述了所有内容。启动容器后,唯一运行的进程是 ,/sbin/init
它是 的链接systemd
。没有 syslog,空的 journalctl,lxc-start
连接控制台没有任何结果,没有 D-BUS - 因此所有 systemd 控制命令都失败。
在这种情况下,有什么想法可以解决吗?
答案1
要解决启动问题,请systemd
尝试:
lxc stop --force centos7
lxc config set centos7 raw.lxc 'lxc.init.cmd = /bin/bash'
lxc start centos7 --console
To detach from the console, press: <ctrl>+a q
[root@centos7 /]# exec /sbin/init
我有:
Failed to mount cgroup at /sys/fs/cgroup/systemd: Operation not permitted
systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
Detected virtualization lxc.
Detected architecture x86-64.
Welcome to CentOS Linux 7 (Core)!
Set hostname to <opennms.man.szczecin.pl>.
Cannot determine cgroup we are running in: No such file or directory
Failed to allocate manager object: No such file or directory
[!!!!!!] Failed to allocate manager object, freezing.
根据此讨论:https://discuss.linuxcontainers.org/t/solved-not-a-bug-strange-cgroups-bug-on-ubuntu-21-10/13341 问题是cgroups不兼容(1 对 2)。
总结:Centos7 的 systemd 需要cgroups1 并且我的主机(Ubuntu 22.04)仅提供cgroups2.