Skip to content

Instantly share code, notes, and snippets.

@MorphyDK
Last active August 14, 2025 11:26
Show Gist options
  • Select an option

  • Save MorphyDK/a590ead7644d7dc55ffd60612fe809e0 to your computer and use it in GitHub Desktop.

Select an option

Save MorphyDK/a590ead7644d7dc55ffd60612fe809e0 to your computer and use it in GitHub Desktop.
Upgrade script for Proxmox from 8.x to 9
#!/bin/bash
set -euo pipefail
echo "=== Proxmox VE 8.4 → 9.0 Upgrade Script ==="
echo "!! WARNING: BACKUP ALL VMs/CTs AND CONFIGS BEFORE CONTINUING !!"
read -p "Press Enter to continue or Ctrl+C to abort..."
# 1. Verify current version
if ! pveversion | grep -q "pve-manager/8"; then
echo "Error: This script is only for Proxmox VE 8.x systems."
exit 1
fi
# 2. Run pre-upgrade checker
echo "=== Running pre-upgrade check ==="
apt update
apt install -y pve8to9
pve8to9 --full || {
echo "Pre-upgrade check failed. Fix issues before running again."
exit 1
}
# 3. Backup sources list files
echo "=== Backing up APT sources ==="
mkdir -p /root/apt-sources-backup
cp -v /etc/apt/sources.list /root/apt-sources-backup/sources.list.bak
cp -v /etc/apt/sources.list.d/* /root/apt-sources-backup/ || true
# 4. Switch Debian repos from bookworm → trixie
echo "=== Updating Debian repos to 'trixie' ==="
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list || true
# 5. Update Proxmox repo to version 9
echo "=== Updating Proxmox VE repos to 9.x ==="
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/pve-install-repo.list || true
# 6. Update package lists
apt update
# 7. Perform full upgrade
echo "=== Starting full distribution upgrade ==="
apt dist-upgrade -y
# 8. Cleanup old packages
echo "=== Cleaning up ==="
apt autoremove --purge -y
apt clean
# 9. Prompt for reboot
echo "=== Upgrade complete ==="
echo "System must be rebooted to finish the upgrade."
read -p "Press Enter to reboot now or Ctrl+C to cancel..."
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment