![无法启动 LXC 容器 - lxc-start:lxccontainer.c:wait_on_daemonized_start:804 收到容器状态“STOPPING”而不是“RUNNING”](https://linux22.com/image/938211/%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%20LXC%20%E5%AE%B9%E5%99%A8%20-%20lxc-start%EF%BC%9Alxccontainer.c%EF%BC%9Await_on_daemonized_start%EF%BC%9A804%20%E6%94%B6%E5%88%B0%E5%AE%B9%E5%99%A8%E7%8A%B6%E6%80%81%E2%80%9CSTOPPING%E2%80%9D%E8%80%8C%E4%B8%8D%E6%98%AF%E2%80%9CRUNNING%E2%80%9D.png)
我对 LXC 和 LXD 概念非常陌生。我通过创建容器并销毁它们来试验 LXC。
经过一些实验,我尝试创建一个容器来实现任务,成功创建了容器但无法启动它。出现以下错误。
我尝试过卸载并安装 lxc 和 lxd。我尝试过清除 lxc 和 lxd,但没有成功。我查阅了一些表格,但无法解决我的问题。
请告诉我这里出了什么问题。
我知道我无法完全移除被毁坏的容器,但不确定如何移除它们。
运行时sudo lxc-start -n vims
出现以下错误:
lxc-start: lxccontainer.c: wait_on_daemonized_start: 804 Received container state "STOPPING" instead of "RUNNING"
The container failed to start.
To get more details, run the container in foreground mode.
Additional information can be obtained by setting the --logfile and --logpriority options.
使用日志文件运行时sudo lxc-start -n vims --logfile errorlog.txt
日志文件的输出如下:
lxc-start 20210607162943.382 ERROR lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1720 - The cgroup "/sys/fs/cgroup/systemd//lxc/vims" already existed
lxc-start 20210607162943.382 ERROR lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1804 - Failed to create cgroup "/sys/fs/cgroup/systemd//lxc/vims"
lxc-start 20210607162943.382 ERROR lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1720 - The cgroup "/sys/fs/cgroup/systemd//lxc/vims-1" already existed
lxc-start 20210607162943.382 ERROR lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1804 - Failed to create cgroup "/sys/fs/cgroup/systemd//lxc/vims-1"
lxc-start 20210607162943.382 ERROR lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1720 - The cgroup "/sys/fs/cgroup/systemd//lxc/vims-2" already existed
lxc-start 20210607162943.382 ERROR lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1804 - Failed to create cgroup "/sys/fs/cgroup/systemd//lxc/vims-2"
lxc-start 20210607162943.476 ERROR lxc_start - start.c:start:1891 - Exec format error - Failed to exec "/sbin/init"
lxc-start 20210607162943.476 ERROR lxc_sync - sync.c:__sync_wait:59 - An error occurred in another process (expected sequence number 7)
lxc-start 20210607162943.476 ERROR lxc_start - start.c:__lxc_start:1802 - Failed to spawn container "vims".
lxc-start 20210607162943.476 ERROR lxc_container - lxccontainer.c:wait_on_daemonized_start:804 - Received container state "STOPPING" instead of "RUNNING"
正如错误日志中提到的,如果我们检查/sys/fs/cgroup/systemd/lxc
目录,内容如下
drwxr-xr-x 2 root root 0 Jun 7 16:32 container_2
drwxr-xr-x 2 root root 0 Jun 7 16:33 container_2-1
drwxr-xr-x 2 root root 0 Jun 7 16:33 container_2-2
-rw-r--r-- 1 root root 0 Jun 7 16:34 tasks
-rw-r--r-- 1 root root 0 Jun 7 16:34 notify_on_release
-rw-r--r-- 1 root root 0 Jun 7 16:34 cgroup.procs
-rw-r--r-- 1 root root 0 Jun 7 16:34 cgroup.clone_children
drwxr-xr-x 2 root root 0 Jun 7 17:03 container_2-3
drwxr-xr-x 2 root root 0 Jun 7 17:03 container_2-4
drwxr-xr-x 2 root root 0 Jun 7 17:07 vims
drwxr-xr-x 2 root root 0 Jun 7 17:08 vims-1
drwxr-xr-x 2 root root 0 Jun 7 21:57 vims-2
drwxr-xr-x 2 root root 0 Jun 7 21:59 vims-3
drwxr-xr-x 2 root root 0 Jun 7 22:04 POC
我试图删除上述容器目录,但是 Linux 不允许我这样做。
问题的背景,我创建了多个容器并通过sudo lxc-destroy -n <container_name>
提前致谢!!!