Proxmox容器升级Debian 10后无法工作的解决方案
日期: 2019年9月8日
我对一个Debian 10容器执行了 apt update / upgrade 操作,随后重启容器时遇到了以下错误:
1
2
3
4
|
# pct start 105
Job for pve-container@105.service failed because the control process exited with error code.
See "systemctl status pve-container@105.service" and "journalctl -xe" for details.
command 'systemctl start pve-container@105' failed: exit code 1
|
以更详细的模式启动容器后,我得到了以下信息:
1
2
3
4
5
6
|
# lxc-start -n 105 -F -l DEBUG -o /tmp/lxc-ID.log
lxc-start: 105: conf.c: run_buffer: 335 Script exited with status 25
lxc-start: 105: start.c: lxc_init: 861 Failed to run lxc.hook.pre-start for container "105"
lxc-start: 105: start.c: __lxc_start: 1944 Failed to initialize container "105"
lxc-start: 105: tools/lxc_start.c: main: 330 The container failed to start
lxc-start: 105: tools/lxc_start.c: main: 336 Additional information can be obtained by setting the --logfile and --logpriority options
|
查看 /tmp/lxc-ID.log 日志文件后发现了问题所在:
1
2
3
|
lxc-start 105 20190908130857.595 DEBUG conf - conf.c:run_buffer:326 - Script exec /usr/share/lxc/hooks/lxc-pve-prestart-hook 105 lxc pre-start with output: unsupported debian version '10.1'
lxc-start 105 20190908130857.604 ERROR conf - conf.c:run_buffer:335 - Script exited with status 25
lxc-start 105 20190908130857.604 ERROR start - start.c:lxc_init:861 - Failed to run lxc.hook.pre-start for container "105"
|
问题的根源在于,Debian版本从 10.0 升级到了 10.1,但这一变化未被Proxmox脚本识别。相关的代码位于 /usr/share/perl5/PVE/LXC/Setup/Debian.pm 文件中。不过,在本案例中,我无需手动修改任何内容,因为我只需要将Proxmox主机更新到最新的小版本即可解决此问题,因为开发人员已经更新了 Debian.pm 中的代码。我分享这个经历,是希望帮助其他可能遇到相同问题的人,因为在这种情况下错误提示并不十分明确。
用户评论与解决方案
-
Frank Neuber (2019年9月12日):
- 感谢,这拯救了我的一天。
- 提供了一个代码差异示例,指出需要修改
/usr/share/perl5/PVE/LXC/Setup/Debian.pm 文件,将版本检查条件从 $version <= 10 扩展为 $version <= 11 以支持 10.1 版本。(评论中因格式问题,代码补丁显示不完整,但其核心是修改第32行)。
-
Frank Neuber (后续补充):
- 发布代码差异时遇到了问题。
- 明确指出需要在第32行将Debian版本上限改为11。
-
robert (作者,2019年9月16日):
- 回复Frank:谢谢,我知道
apt update 已经按照你描述的那样更新了文件。
-
Uwe Degenhardt (2022年3月16日):
- 嗨,Robert!非常棒的文章!谢谢你。它拯救了我的白天/夜晚。致以问候,Uwe。