中文 English

Proxmox VE 6.4 daily upgrade commands

Published: 2021-03-29
Proxmox VE pvekclean Upgrade

Remove unused Linux kernel

pvekclean

Update software:

apt update -y && apt dist-upgrade -y

Remove the unsubscribed prompt and support PVE 6.3 / 6.4

sed -i_orig "s/data.status === 'Active'/true/g" /usr/share/pve-manager/js/pvemanagerlib.js
sed -i_orig "s/if (res === null || res === undefined || \!res || res/if(/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
sed -i_orig "s/.data.status.toLowerCase() !== 'active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy

After confirming that everything is correct, restart the server.

reboot

Solve software upgrade problems

mv /etc/apt/sources.list /etc/apt/sources.list.bak
cat > /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-security/ buster/updates main non-free contrib
EOF
# 删除企业源
rm -rf /etc/apt/sources.list.d/pve-enterprise.list
# 下载秘钥
wget http://mirrors.ustc.edu.cn/proxmox/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
# 添加国内源
echo "deb http://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list

Update PVE and install commonly used software

Install pvekclean

Install and configure NTP

Reference: https://pve.proxmox.com/wiki/Time_Synchronization

apt-get update && apt-get install vim lrzsz unzip net-tools curl screen uuid-runtime git -y && apt dist-upgrade -y

If the update fails with E: Sub-process /usr/bin/dpkg returned an error code

Reference: https://blog.csdn.net/yusiguyuan/article/details/24269129

git clone https://github.com/jordanhillis/pvekclean.git
cd pvekclean
chmod +x pvekclean.sh
./pvekclean.sh

If the update tries to remove the meta-package proxmox-ve

  1. First check whether the Proxmox VE enterprise repository is configured correctly and reachable.
  2. If the enterprise repository configuration is correct, continue with the steps below.

Reference: https://forum.proxmox.com/threads/apt-get-dist-upgrade-wants-to-remove-proxmox-ve-pve-firmware.39360/

mv /etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf_bak
echo [Time] >> /etc/systemd/timesyncd.conf
echo NTP=ntp1.aliyun.com ntp2.aliyun.com ntp3.aliyun.com ntp4.aliyun.com ntp5.aliyun.com ntp6.aliyun.com ntp7.aliyun.com >>    /etc/systemd/timesyncd.conf
cat /etc/systemd/timesyncd.conf
timedatectl set-ntp true 
timedatectl status

If the update fails with E: Sub-process /usr/bin/dpkg returned an error code

Reference: https://blog.csdn.net/yusiguyuan/article/details/24269129

apt-get update --fix-missing
apt-get autoremove && sudo apt-get clean && sudo apt-get install -f

If the update tries to remove the meta-package proxmox-ve

  1. First check whether the Proxmox VE enterprise repository is configured correctly and reachable.
cat /etc/apt/sources.list.d/pve-enterprise.list
  1. If the enterprise repository configuration is correct, continue with the steps below.

Reference: https://forum.proxmox.com/threads/apt-get-dist-upgrade-wants-to-remove-proxmox-ve-pve-firmware.39360/

# Yes, I tested it. You can remove any listed kernels with the command below:
# List the Linux images currently installed on the system
dpkg --list | egrep -i --color 'linux-image|linux-headers'
# Then:
# Remove old Linux images
apt-get --purge remove linux-image-4.9.0-4-amd64 linux-image-4.9.0-5-amd64
# Update grub
update-grub