Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
A month ago, I lost my boot drive on my debian box. I lost everything but /etc, /var and /home (those were on a RAID 5, the boot on a single drive that I forgot to upgrade/backup. I know.).
There was a mad dash to reinstall the system (I chose Ubuntu this time) and get everything working, and in the end it was a good exercise for me. But then I got to thinking... I have /etc, and I have /var...
Is there some way to install a basic debian-based distro, and then use dpkg data from /var and /etc to automatically 'clone' the old installation? I looked on the web for ways of doing this and I have not found any.
On my machine, it looks like the status file is in /var/lib/dpkg/status. If I read through this the programs have package name/description/status(installed,purged,etc)/etc...
Normally, I backup my install by running dpkg --get-selections > installed.txt. This creates a file of the format
Cool. So would it be as easy as running the apt-get upgrade to reinstall everything, then booting to a liveCD and copying over the /etc (and /home, /var) folders from the backup?
Cool. So would it be as easy as running the apt-get upgrade to reinstall everything, then booting to a liveCD and copying over the /etc (and /home, /var) folders from the backup?
Recovery Sequence:
1) Install minimal debian-based system with apt.
2) aptitude update
3) dselect update
4) dkpg --set-selections < installed.txt
5) apt-get dselect-upgrade
6) Reboot into a recovery disk.
7) Replace the new /etc, /var and /home with the backup versions.
8) Reboot
I would say yes, as long as you already built the installed.txt file ahead of time. I'd be nervous about just replacing wholesale all of /etc and /var. But I've definitely taken specific config files from a backup /etc to replace the ones on a new install.
I guess you could always backup the new /etc, /var, and /home first. That way if you hose it up, you can just revert to the old and do it a few files at a time. As for /home, the only thing I'd be nervous about is that the file owners might have a different UID than what gets created this time...
Hmm. What about versions? I know that's in the status file- but it's not in the get-selections output.
I think version isn't needed because apt tracks package names and just keeps versions to compare dependencies and stuff. Most of this stuff won't be installed, so it'll say "hey, that's not installed, let's go get whatever the latest version on the server is". So I guess before you do all that stuff you should probably run a dist-upgrade on the base install to make sure you've got all the latest packages.
About the versions though: I think there could be trouble- for example, the selections dump lists both mysql-server and mysql-server-5.0. My old installation ran 4.1 (I checked, both mysql-server and mysql-server-4.1 are listed in the old status file).
Maybe I need to clean up my current installation to reference specific versions instead of the current version? Maybe I just need to understand dpkg better.
Are both marked as install or is one marked as install and one marked as deinstall/purge?
When I apt-cache search mysql on sarge, mysql-server relates to 4.0.24-10sarge1 and mysql-server-4.1 is 4.1.11a-4sarge2. Both list the other as a conflicting package. So I don't think they could both be listed as installed...
Wouldn't it be easier to just tar gzip up everything, use sfdisk to create a file that contains the partition layout, and save that on some storage media elsewhere?
Then, if your drive crashes:
1. Load up knoppix
2. Partition the drive from the partition layout file you created
3. Install a bootloader
4. Unpack everything from your compressed tarball
This way, you won't have to worry about package version mismatch or something else failing during the recovery. Just an idea.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.