This time we’ll make customizations to Proxmox VE permanent across upgrades to the system. We’ll do so by creating a hook for apt, the package manager used by Proxmox VE, that executes a script reapplying the customizations. I use a solution similar to this to make various customizations and changes I’ve made to Proxmox VE running on low-power Intel NUC nodes persist.

Note: If you are logged in as root (I think you should be logged in as another user, though), leave out sudo in the commands below.

Preparation

First, we’ll create a directory where we’ll store our customizations (you can call it whatever you want, as long as you are consistent across the commands):

$ sudo mkdir /usr/share/custom

Next, create the script which will apply the customizations, and make it executable:

$ sudo echo '#!/usr/bin/env bash' > /usr/share/custom/apply.sh
$ sudo chmod a+x /usr/share/custom/apply.sh

Create the Hook

Finally, create a file telling apt to execute the script after being invoked:

$ sudo echo 'DPkg::Post-Invoke { "/usr/share/custom/apply.sh"; };' > /etc/apt/apt.conf.d/90custom

Now /usr/share/custom/apply.sh will be executed when apt installs or upgrades a package, reapplying the customizations. Be careful of what you put in there, though!

Make a Change Persistent

To make the customizations we made to Proxmox VE in the last article, simply execute the following commands to add them to the script reapplying the customizations (note the double >>):

$ sudo echo 'mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.disabled' >> /usr/share/custom/apply.sh
$ sudo echo 'echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list' >> /usr/share/custom/apply.sh

The next article builds on this one and makes the subscription warning dialog disappear when you log in to the Proxmox VE web interface, and makes the change persistent across upgrades.

Last Words

If you find Proxmox VE useful, please consider getting a subscription. You’ll get access to more stable packages and support from the developers. Amazon also has several books on using Proxmox, suitable for all experience levels, should you find these articles interesting or confusing.

And once again, be careful of what you put in /usr/share/custom/apply.sh!

Good luck! 😊