Press "Enter" to skip to content

PVE强制停止lxc容器

尝试配置一个lxc容器

启动之后,控制台报了一个告警:

WARN: old systemd (< v232) detected, container won't run in a pure cgroupv2 environment! Please see documentation -> container -> cgroup version.
TASK WARNINGS: 1

然后容器就卡在那了,启动也启动不了,强制停止也停不了。

解决

登录到pve的ssh控制台

查看我们容器的执行状态(我的容器的id是102,所以命令里面参数为102)

root@pve:~# systemctl status pve-container@102
● pve-container@102.service - PVE LXC Container: 102
     Loaded: loaded (/lib/systemd/system/pve-container@.service; static)
     Active: active (running) since Wed 2024-09-25 09:02:02 CST; 13min ago
       Docs: man:lxc-start
             man:lxc
             man:pct
   Main PID: 256815 (lxc-start)
      Tasks: 0 (limit: 76373)
     Memory: 4.8M
        CPU: 612ms
     CGroup: /system.slice/system-pve\x2dcontainer.slice/pve-container@102.service
             ‣ 256815 /usr/bin/lxc-start -F -n 102

Sep 25 09:02:02 pve systemd[1]: Started PVE LXC Container: 102.
Sep 25 09:02:03 pve pve-lxc-hook-lxc-pre-start[256816]: CT 102 does not support running in a pure cgroupv2 environment

执行命令停止容器:

root@pve:~# systemctl stop pve-container@102
root@pve:~# systemctl status pve-container@102
● pve-container@102.service - PVE LXC Container: 102
     Loaded: loaded (/lib/systemd/system/pve-container@.service; static)
     Active: inactive (dead)
       Docs: man:lxc-start
             man:lxc
             man:pct

Sep 25 09:02:02 pve systemd[1]: Started PVE LXC Container: 102.
Sep 25 09:02:03 pve pve-lxc-hook-lxc-pre-start[256816]: CT 102 does not support running in a pure cgroupv2 environment
Sep 25 09:16:19 pve systemd[1]: Stopping PVE LXC Container: 102...
Sep 25 09:17:21 pve systemd[1]: pve-container@102.service: Succeeded.
Sep 25 09:17:21 pve systemd[1]: Stopped PVE LXC Container: 102.

登录到pve界面查看,容器已经被停止了。

参考资料:

https://forum.proxmox.com/threads/how-to-kill-a-container-that-doesnt-stop.28633

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注