#!/usr/bin/env bash set -euo pipefail # Proxmox VE 9.0 Repository Fix Script # Fixes apt update issues by properly configuring no-subscription repositories echo "🔧 Fixing Proxmox VE 9.0 repositories..." # 0) Install required keyrings (usually pre-installed) install -d -m 0755 /usr/share/keyrings if [ ! -f /usr/share/keyrings/proxmox-archive-keyring.gpg ]; then echo "📦 Installing proxmox-archive-keyring..." apt-get update apt-get install -y proxmox-archive-keyring || true fi CODENAME="trixie" # PVE 9 = Debian 13 Trixie # 1) Configure PVE no-subscription repository (deb822 format) echo "📝 Configuring PVE no-subscription repository..." cat >/etc/apt/sources.list.d/proxmox.sources </etc/apt/sources.list.d/ceph.sources < "$f.new" && mv "$f.new" "$f" echo " ✓ Disabled enterprise repo in $f" fi done # 4) Comment out enterprise repos in old .list files & remove duplicate no-sub entries echo "🔒 Cleaning up old repository files..." for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.list; do [ -f "$f" ] || continue if grep -q "enterprise\.proxmox\.com" "$f" 2>/dev/null; then sed -i -E 's|^(deb .*enterprise\.proxmox\.com.*)$|# \1|' "$f" echo " ✓ Commented enterprise repo in $f" fi done rm -f /etc/apt/sources.list.d/pve-no-subscription.list 2>/dev/null || true # 5) Update package lists echo "🔄 Updating package lists..." apt-get update echo "" echo "✅ Proxmox VE 9.0 repository configuration completed!" echo " - No-subscription repository: ENABLED" echo " - Enterprise repository: DISABLED" echo " - apt update should now work correctly" echo ""