I am having some trouble with an installed debian on a machine. While I have all data backed up, the configuration of installed packages is also critical to me. Does anybody know a way to either re-install the OS while keeping ideally all of /etc and /home or alternatively at least get a fresh debian install will all previously installed packages which I would only have to reconfigure plus copy my data
I don't know what problem you are trying to solve.
What I do
What I do in order to get upgrades is:
- I keep my home/ mount (and backups of it too)
- I run etckeeper (and I have the history mirrored to a remote machine)
So upgrading is:
- dpkg --get-selections | grep -w 'install$' > installed.txt
- install fresh OS
- install the packages from installed.txt (some manual steps there that I didn't bother automating because it happens <1x p/yr)
- install etckeeper, diff my /etc/ tree with the original and merge the important configuration stuff
Simple hint: Without starting from scratch
You should be able to get a long way with something like
sudo apt-get install --reinstall $(dpkg --get-selections | grep -w 'install$' | cut -f1)
I havent't tried it, on my system it would download about 3 Gb of packages :)
Sample output from my system (note a list of packages that aren't in the Debian/Ubuntu repositories):
sehe@meerkat:/tmp$ sudo apt-get install --reinstall $(dpkg --get-selections | grep -w 'install$' | cut -f1) -d
Reading package lists... Done
Building dependency tree
Reading state information... Done Reinstallation of nxagent is not possible, it cannot be downloaded. Reinstallation of freenx-server is not possible, it cannot be downloaded. Suggested packages: multiboot-doc grub-emu xorriso desktop-base The following packages will be upgraded: grub-common grub-pc 2 upgraded, 0 newly installed, 3043 reinstalled, 0 to remove and 0 not upgraded. Need to get 3,153MB/3,333MB of archives. After this operation, 205kB of additional disk space will be used. E: You don't have enough free space in /var/cache/apt/archives/.
It depends on how your disk is partitioned.
If you have
/home on it's own partition, you might be able to reinstall the OS without formatting the
/home partition, then its previous contents would be preserved.
It's unlikely that you would have dedicated a partition to
/etc, so you wouldn't be able to take advantage of not formatting
I hope, though, the data you have backed up include your configuration files.