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

本文详细介绍了Proxmox容器在升级Debian 10后无法启动的问题,包括错误分析、日志排查和解决方案,涉及LXC容器技术和系统版本兼容性问题。

Proxmox Container with Debian 10 does not work after upgrade

问题描述

在对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
# 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"

查看日志文件/tmp/lxc-ID.log发现具体问题:

1
2
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

问题根源

问题的根本原因是Debian版本从10.0升级到10.1后,Proxmox脚本无法识别新版本。相关代码位于/usr/share/perl5/PVE/LXC/Setup/Debian.pm文件中。

解决方案

作者通过将Proxmox主机更新到最新次要版本解决了此问题,因为开发人员已经修改了Debian.pm文件中的代码。

在评论中,用户Frank Neuber提供了具体的代码修改方案:

1
2
3
4
5
6
7
# 原始代码:
die "unsupported debian version '$version'\n"
    if !($version >= 4 && $version <= 11);

# 修改后:
die "unsupported debian version '$version'\n"
    if !($version >= 4 && $version <= 11);

需要将Debian版本支持上限修改为11。

技术要点

  • Proxmox使用LXC容器技术
  • 系统版本检测逻辑位于Perl模块文件中
  • 版本兼容性检查在容器启动前执行
  • 错误信息通过pre-start钩子脚本输出
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计