背景

我手里有一台运行 Proxmox VE 7.4 的服务器,基于 Debian 11(bullseye),想升级到最新的 PVE 9(Debian 13 Trixie)。升级过程选择 官方源 + 原地升级,不重装系统,同时保留所有虚拟机和配置。


升级路径概览

PVE 不支持跨版本直接升级,所以必须按官方推荐路径:

PVE 7.4 (Debian 11) → PVE 8 (Debian 12) → PVE 9 (Debian 13)

升级前准备

1. 备份

  • 备份所有重要 VM/CT
  • 备份系统配置:
tar czvf /root/pve-config-backup.tar.gz /etc/pve /etc/network/interfaces

2. 检查系统状态

pve7to8 --full

确保无 FAIL。第一次检查时我遇到:

  • 缺少 NTP 服务
  • 有运行中的 VM
  • 部分 apt 源配置为 stable 而不是 bullseye

从 PVE 7.4 → PVE 8

1. 修复 WARN

  • 安装 NTP
apt install chrony
systemctl enable --now chrony
  • 停止所有 VM
qm shutdown <VMID>
  • 确保 apt 源为 bullseye,去掉失效的 backports

2. 切换到 Debian 12 + PVE 8 官方源

cat >/etc/apt/sources.list <<'EOF'
deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb https://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
EOF

echo "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription"   >/etc/apt/sources.list.d/pve-no-sub.list

3. 升级

apt update
apt full-upgrade
reboot

4. 安装 UEFI 引导支持

apt install grub-efi-amd64
efibootmgr -v

确认 proxmox 启动项在第一位。


从 PVE 8.4 → PVE 9

1. 检查

pve8to9 --full

我遇到:

  • FAIL:自定义角色使用了废弃的 VM.Monitor 权限
  • WARN:

    • 存储 scale 不在线
    • /etc/sysctl.conf 路径已废弃
    • 缺少 CPU 微码(intel-microcode)

2. 修复 FAIL(PVE 8 无法添加新权限)

PVE 8 先移除 VM.Monitor:

for R in Administrator PVEAdmin PVEVMAdmin admins; do
  CUR=$(pveum role show "$R" | awk -F': ' '/Privileges:/{print $2}')
  NEW=$(echo "$CUR" | sed -e 's/\<VM.Monitor\>//g' -e 's/,,/,/g' -e 's/^,//' -e 's/,$//')
  pveum role modify "$R" -privs "$NEW"
done

3. 修复 WARN

  • 临时禁用离线存储:
pvesm set scale --disable 1
  • 迁移 sysctl 配置:
mkdir -p /etc/sysctl.d
mv /etc/sysctl.conf /etc/sysctl.d/99-custom.conf
sysctl --system
  • 安装 CPU 微码:
apt install intel-microcode

4. 切换到 Debian 13 + PVE 9 官方源

cat >/etc/apt/sources.list <<'EOF'
deb https://deb.debian.org/debian trixie main contrib non-free non-free-firmware
deb https://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
EOF

echo "deb http://download.proxmox.com/debian/pve trixie pve-no-subscription"   >/etc/apt/sources.list.d/pve-no-sub.list

5. 升级

apt update
apt full-upgrade
reboot

升级完成后的收尾

1. 补回 PVE 9 新的 Guest Agent 权限

for R in Administrator PVEAdmin PVEVMAdmin admins; do
  CUR=$(pveum role show "$R" | awk -F': ' '/Privileges:/{print $2}')
  pveum role modify "$R" -privs "${CUR},VM.GuestAgent.Unrestricted"
done

2. 启用之前禁用的存储

pvesm set scale --disable 0

3. 验证

pveversion
efibootmgr -v
timedatectl status
pvesm status

升级踩坑记录

  • 半升级状态的 apt 源 会导致依赖冲突,建议直接切到下一版本的完整源
  • PVE 8 阶段无法添加 PVE 9 新权限,需要先移除旧权限,升级后补回
  • /etc/sysctl.conf 在 PVE 9 被弃用,要迁移到 /etc/sysctl.d/
  • CPU 微码安装建议提前完成

总结

升级虽然分两步(7.4→8→9),但整体顺利。核心经验:

  1. 提前用 pve7to8 --full / pve8to9 --full 检查
  2. 源一次改全,不混用
  3. 逐步升级,每步后都验证
  4. 关键权限调整分阶段处理

最终结果:系统运行在 Proxmox VE 9.0(Debian 13 Trixie,内核 6.8),功能稳定,EFI 引导、时间同步、存储正常。

最后修改:2025 年 08 月 11 日
感谢您的支持