记录 PVE8 升级到 PVE9 过程
记录一下将 PVE 从 PVE8 升级到 PVE9 的过程。
1. 升级到 PVE8 最新版本
apt updateapt upgrade2. 运行 pve8to9 检查脚本
官方从 Proxmox VE 8.4 版本开始内置了一个名为 pve8to9 的检查程序,该程序会在升级过程的前、中、后三个阶段,针对潜在问题给出提示与警告信息,执行如下命令开始检查:
pve8to9 --full运行结束后,我的系统检查结果如下:
TOTAL: 44
PASSED: 31
SKIPPED: 6
WARNINGS: 4
FAILURES: 1其中有 1 个严重的失败(FAILURE) 和 4 个警告(WARNINGS) 需要处理,分别是:
WARN: 6 running guest(s) detected - consider migrating or stopping them.WARN: systemd-timesyncd is not the best choice for time-keeping on servers, due to only applying updates on boot.
While not necessary for the upgrade it's recommended to use one of:
* chrony (Default in new Proxmox VE installations)
* ntpsec
* openntpdWARN: Removable bootloader found at '/boot/efi/EFI/BOOT/BOOTX64.efi', but GRUB packages not set up to update it!
Run the following command:
echo 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u
Then reinstall GRUB with 'apt install --reinstall grub-efi-amd64'WARN: The matching CPU microcode package 'intel-microcode' could not be found! Consider installing it to receive the latest security and bug fixes for your CPU.
Ensure you enable the 'non-free-firmware' component in the apt sources and run:
apt install intel-microcodeFAIL: systemd-boot meta-package installed. This will cause problems on upgrades of other boot-related packages. Remove 'systemd-boot' See https://pve.proxmox.com/wiki/Upgrade_from_8_to_9#sd-boot-warning for more information.接下来开始逐一分析并解决。
提示
每解决一个问题后,最好都运行一次 pve8to9 --full 命令
2.1 解决“Failure”错误
问题描述: FAIL: systemd-boot meta-package installed. 这表示系统安装了 Debian 原生的 systemd-boot 包,这会与 Proxmox 自己的启动管理工具(proxmox-boot-tool)发生冲突,可能导致升级后无法启动。
解决方法: 卸载这个冲突的包。执行以下命令:
apt remove systemd-boot注意:这不会删除 Proxmox 实际使用的引导加载程序,只是删除了冲突的元数据包。
2.2 修复 GRUB 引导加载程序配置
问题描述: WARN: Removable bootloader found ... but GRUB packages not set up to update it! 系统使用了 UEFI 启动,但 GRUB 没有配置为自动更新“可移动媒体路径”(removable media path)。如果不修复,升级后可能无法进入系统。
解决方法: 日志中已经给出了确切的命令,依次执行:
- 更新 debconf 设置:
echo 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u- 重新安装 GRUB 以应用更改:
apt install --reinstall grub-efi-amd642.3 安装 CPU 微代码(Microcode)
问题描述: WARN: The matching CPU microcode package 'intel-microcode' could not be found! 缺少 Intel CPU 的微代码更新。虽然不安装也能升级,但安装它可以修复 CPU 的安全漏洞和 bug,对于服务器稳定性非常重要。
解决方法:
检查软件源配置: 编辑
/etc/apt/sources.list文件,在每一条包含.debian.org的软件源配置行末尾添加non-free-firmware。更新并安装:
apt update apt install intel-microcode
2.4 更换时间同步服务
问题描述: WARN: systemd-timesyncd is not the best choice for time-keeping on servers Proxmox 推荐使用 chrony 代替默认的 systemd-timesyncd,因为前者在服务器环境中更精准、稳定。
解决方法: 直接安装 chrony,系统会自动处理替换:
apt install chrony2.5 关闭正在运行的虚拟机
问题描述: WARN: 6 running guest(s) detected - consider migrating or stopping them. 检测到有6台虚拟机正在运行,建议迁移或停止这些客户机。
解决方法: 升级前全部关机,并进行备份。
2.6 处理 LVM 自动激活(Notice)
提示
这是一个 Notice,可以完全不用管。
问题描述: NOTICE: storage 'local-lvm' has guest volumes with autoactivation enabled PVE 9 将更改 LVM 的激活逻辑。为了避免潜在问题,建议现在就禁用旧卷的自动激活。
解决方法: 运行日志中提供的官方迁移脚本:
/usr/share/pve-manager/migrations/pve-lvm-disable-autoactivation3. 开始升级
解决完上面哪些问题之后,先重启一次 PVE,然后开始升级到 PVE9。
警告
升级之前,一定要备份所有虚拟机和CT容器,备份!备份!备份!
3.1 将基础软件源更新到 Trixie
将所有 Debian 和 Proxmox VE 软件源更新为 Trixie。
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/pve-enterprise.list继续检查 /etc/apt/sources.list.d 中是否存在其它软件源,如果存在,可将其注释,或者换成 trixie 的软件源。
3.2 更新 Ceph 软件源
注意
- 仅限超融合 Ceph:不确定时,在该节点的 Proxmox VE Web UI 中检查 Ceph 面板和已配置的软件源。
- 替换源:将所有
ceph.com源替换为proxmox.com的 Ceph 源。 - 版本要求:直接安装在 Proxmox VE 上的超融合 Ceph 集群必须运行 Ceph 19.2 Squid,否则需先升级 Ceph,再升级到 Proxmox VE 9(Debian 13 Trixie)。可在 Web UI 的 Ceph 面板查看版本。
添加无订阅— no-subscription 源(deb822)
cat > /etc/apt/sources.list.d/ceph.sources << EOF
Types: deb
URIs: http://download.proxmox.com/debian/ceph-squid
Suites: trixie
Components: no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF运行 apt update、apt policy 确认无误后,删除旧的 /etc/apt/sources.list.d/ceph.list,再检查一次。
3.3 升级到 PVE9
更新软件源列表:
apt update开始升级
apt dist-upgrade4. 升级之后
4.1 可选操作:升级 APT 软件源配置格式
你可以通过运行以下命令,将现有的软件源配置迁移为推荐的 deb822 格式:
apt modernize-sources该命令在执行时,会自动保留旧的 .list 格式配置文件,具体方式是为其添加 .bak 后缀。因此,操作完成后你会同时拥有新的 .sources 格式配置文件,以及备份在 .list.bak 文件中的旧版软件源配置。当你确认新格式配置能够正常工作后,即可删除这些遗留的备份文件。
