proxmox-stuff icon indicating copy to clipboard operation
proxmox-stuff copied to clipboard

Save installed apt packages and automatically reinstall them after recovery

Open stefan-nu opened this issue 1 year ago • 1 comments

If a proxmox node fails it would be nice to automatically reinstall all apt packages that were originally installed. The backup script could do this.

An easy way is described here https://askubuntu.com/questions/1092567/how-to-get-package-list-from-one-pc-and-install-that-on-another-pc https://askubuntu.com/questions/17823/how-to-list-all-installed-packages

Save all currently installed packages and repository keys with

sudo dpkg --get-selections > installed-packages
sudo apt-key exportall > repo-keys

In the recovery script install the packages with

sudo apt-get install dselect
sudo apt-key add repo-keys
sudo dpkg --set-selections < installed-packages
sudo apt-get dselect-upgrade -y

Maybe automatic installation is no good idea, as some packages might be outdated. But at least saving the list of previously installed packages would help to reconstruct the node manually.

stefan-nu avatar Jun 15 '23 10:06 stefan-nu

This can be quiet dangerous. My initial intension for this backup script was to create a backup of all pve related config. In case of a total system crash, installing a new node, importing the important config is enough. Most of the time it anyways something that has to be verified manually.

I suggest that you add 1 or 2 scripts to handle the package backup and restore process as it seems logical in some cases.

Thanks

DerDanilo avatar Apr 08 '24 17:04 DerDanilo