Proxmox容器升级后Debian 10无法启动的解决方案

本文详细描述了在Proxmox环境中升级Debian 10容器后出现的启动失败问题,通过分析系统日志和修改Perl脚本代码,提供了有效的解决方案和调试方法。

Proxmox Container with Debian 10 does not work after upgrade

September 8, 2019

我刚刚对一个Debian 10容器执行了apt update/upgrade操作,并在之后重启时遇到以下错误:

1
2
3
4
# pct start 105
Job for [email protected] failed because the control process exited with error code.
See "systemctl status [email protected]" 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在评论中提供了具体的代码修改方案:

1
2
- if !($version >= 4 && $version <= 10);
+ if !($version >= 4 && $version <= 11);

需要将Debian版本支持上限从10改为11(第32行)。

其他用户确认通过apt update更新可以自动修复此问题,或者手动修改/usr/share/perl5/PVE/LXC/Setup/Debian.pm文件中的版本检查逻辑。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计