将pve6升级到pve7,同时修复lxc无法启动问题

网络 · 2021-07-18 · 1872 人浏览

pve6 升级到7, 除了原有的国内源,需要添加pve的更新源,编辑/etc/apt/sources.list

deb https://mirrors.ustc.edu.cn/proxmox/debian/pve/ buster pve-no-subscription 

然后保证系统最新

apt update && apt dist-upgrade

备份各个虚拟机和容器后,执行

pve6to7 --full

一般会有warning,主要是有运行的虚拟机和cgroup兼容问题,新版本要用cgroup2

确保备份完毕后,即可将源换成debian11的

sed -i 's/buster\/updates/bullseye-security/g;s/buster/bullseye/g' /etc/apt/sources.list

然后cat下检查,可以用清华,163等,根据自己的速度

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve/ bullseye pve-no-subscription

确认无误后执行,当中会出现一部分交互,需要yes确认或者默认直接回车

apt update && apt dist-upgrade

LXC启动报错问题解决

通过以上命令,顺利将pve6升级到7,但是我有特权lxc容器,涉及到一些网卡和显卡的调用,升级后lxc容器无法启动

提示, 以下所有2004应改为实际容器ID

 cgfsng_setup_limits_legacy: 2764 Bad address - Failed to set
 "devices.deny" to "a" cgroup_tree_create: 808 Failed to setup legacy
 device limits cgfsng_payload_create: 1171 Numerical result out of
 range - Failed to create container cgroup lxc_spawn: 1644 Failed
 creating cgroups
 __lxc_start: 2073 Failed to spawn container "2004" TASK ERROR: startup for container '2004' failed

检索后解决

编辑相关的容器conf文件,添加相关内容后, 启动

由于我是用zerotier,所有还有最后额外的2行用于设置tun

vi /etc/pve/lxc/2004.conf
    
systemd.unified_cgroup_hierarchy=0
lxc.cgroup.devices.allow =
lxc.cgroup.devices.deny =
    
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.hook.autodev: sh -c "modprobe tun; cd ${LXC_ROOTFS_MOUNT}/dev; mkdir net; mknod net/tun c 10 200; chmod 0666 net/tun"

参考链接
pve升级源
lxc无法启动

lxc pve

Buy Me a Coffee

支付宝 支付宝
微信 微信
Theme Jasmine by Kent Liao