Ubuntu re-installation deletes preferences and applications

Asked by Gerry Moore

I installed Ubuntu 8.04 in a manner which I thought would preserve my preferences and applications if I were to re-install Ubuntu. I was guided (by psychocats.net) to partition my drive into swap (sda5), root (sda6), and home (sda7). My understanding was that a re-install would re-format swap and root but that the desktop preferences and application would remain unchanged in the home partition. I took precautions before re-installing Ubuntu according to http://mybrainrunslinux.com/node/2 by creating a backup log followed after re-install by the following:
sudo dpkg --set-selections < backup.log
sudo apt-get install dselect
sudo dselect

The re-install options I choose were to re-format swap & root, but not the home partition. The result however did not carry forward my settings nor applications, and the backup log procedure only recovered a minimum of my former setup. The only other variable I choose during the re-install of Ubuntu was that I choose a different user name.

Can a re-install be done such that desktop settings and application are preserved? If not, will I loose all settings and applications when I install the next release of Ubuntu?

Thank you.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Thomas Kluyver (takluyver) said :
#1

Hi Gerry

Yes, it is possible. If you can find your old home directory, then by copying the contents across to your new home directory (ensuring you also get all the hidden files starting with . ), you should be able to bring back all your old settings and everything. It's best to do this when you're not actually using the folder, though, so you'll probably want to start up the live CD again, and play with your hard drive from there.

The other obvious thing to check is: did you set sda7 to be your home partition again when you reinstalled it? It will still work if you didn't, but you lose the benefit of protecting your home directory against the next reinstall. To check, run "mount" at a command prompt, and look for a line starting "/dev/sda7 on /home".

Revision history for this message
Gerry Moore (baktoblu) said :
#2

Thank you Thomas

Yes, I noticed that my old userid was still on /file system/home after I
re-installed Ubuntu. Are you suggesting that after re-installing Ubuntu
I copy the old userid & hidden files (that should still be there) into
the new userid under the same file system/home directory? That sounds
straightforward.

Is there any use then in the backup log procedure that I described in my
question?

Is there a better description or tutorial on this procedure (partitions
and re-installation) that you are aware of? It looks like I set up the
partitions correctly however was missing a key step of recovering my
settings. This seems like an important ability for new users to be able
to successfully accomplish.

Will I have to do this when (if) I install Ubuntu 9.XX or is it automatic?

Finally, on your second point, yes /home is still sda7.

Thanks again,

Gerry

Thomas K wrote:
> Your question #46343 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/46343
>
> Status: Open => Answered
>
> Thomas K proposed the following answer:
> Hi Gerry
>
> Yes, it is possible. If you can find your old home directory, then by
> copying the contents across to your new home directory (ensuring you
> also get all the hidden files starting with . ), you should be able to
> bring back all your old settings and everything. It's best to do this
> when you're not actually using the folder, though, so you'll probably
> want to start up the live CD again, and play with your hard drive from
> there.
>
> The other obvious thing to check is: did you set sda7 to be your home
> partition again when you reinstalled it? It will still work if you
> didn't, but you lose the benefit of protecting your home directory
> against the next reinstall. To check, run "mount" at a command prompt,
> and look for a line starting "/dev/sda7 on /home".
>
>

Revision history for this message
Thomas Kluyver (takluyver) said :
#3

Yup, that's pretty much what I'm suggesting. You'll probably have trouble doing it while you're running that system, though (as you'll be accessing some of the files that are in your new home directory), which is why I suggested doing it from the live CD. So if you copy all the contents of /home/OldUserName to /home/NewUserName, it should work. They won't be called that when you're on the live CD, though--you'll need to mount sda7, and they'll then be called, for example /mnt/sda7/OldUserName and /mnt/sda7/NewUserName.

I haven't seen the backup log procedure before, but from the looks of it, I think it's designed to quickly reinstall whatever software you had installed before. Did it work?

You would normally use the upgrade tool to move to the next version without reinstalling, so it shouldn't be an issue. The next version is 8.10 (the numbers correspond to the year and month), and is due out in about a month's time.

Revision history for this message
Gerry Moore (baktoblu) said :
#4

Thanks again Thomas

Final question, had I kept my old user name when I re-installed Ubuntu,
would I have side stepped this problem, that the /home old user name
would have simply contained all my files?

No, the backup log procedure did not work, it appears to have installed
some applications but not all, and none of the desktop preferences.

Gerry

Thomas K wrote:
> Your question #46343 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/46343
>
> Status: Open => Answered
>
> Thomas K proposed the following answer:
> Yup, that's pretty much what I'm suggesting. You'll probably have
> trouble doing it while you're running that system, though (as you'll be
> accessing some of the files that are in your new home directory), which
> is why I suggested doing it from the live CD. So if you copy all the
> contents of /home/OldUserName to /home/NewUserName, it should work. They
> won't be called that when you're on the live CD, though--you'll need to
> mount sda7, and they'll then be called, for example
> /mnt/sda7/OldUserName and /mnt/sda7/NewUserName.
>
> I haven't seen the backup log procedure before, but from the looks of
> it, I think it's designed to quickly reinstall whatever software you had
> installed before. Did it work?
>
> You would normally use the upgrade tool to move to the next version
> without reinstalling, so it shouldn't be an issue. The next version is
> 8.10 (the numbers correspond to the year and month), and is due out in
> about a month's time.
>
>

Revision history for this message
Wyatt Smith (wyatt-smith) said :
#5

Did you restore your /etc/apt/sources.list before you tried the backup.log procedure? If the additional repositories were not enabled then the programs from those repositories wouldn´t get reinstalled.

Revision history for this message
Thomas Kluyver (takluyver) said :
#6

Plus I wouldn't expect it to restore your desktop preferences--those will all be in your home directory (in the hidden files and folders starting with . ).

I think that setting it up with the same user name would have worked, but if it was my computer, I would have backed up my home directory just in case.

Revision history for this message
Andreas Troschka (signupbox) said :
#7

You probably missed a couple of steps. The fact is you have to recreate the same environment and then copy your old /home/oldusername backup on the new /home/*.

That means:

1. on the old system create the backup.log (as you've done)
2. backup the old /home/oldusername directory with all files, subdirectories, hidden files AND LINKS, maintaining the original user/group specs (e.g. tar-gzipping the entire /home/* tree) and place it on another disk (not sda7)
3. format the root partition (the swap partition doesn't care)
4. install the new ubuntu SPECIFYING THE SAME USERID YOU HAD BEFORE! (otherways some application can't run!)
5. use the backup.log as you described
6. delete the entire /home/* tree!
7. restore the backup maintaining user/group specified in the backup

If you do anything diverging from this sequence or add application during the sequence you will end without success.

Under Linux, ownership of files and directories is of vital importance. So you can't mix old with new if new is different from old (speaking about application installations). ;-)

I'm just preparing a complete guide on this argument due to the fact there are still open points and perfectible steps to achieve a real clean o.s. version upgrade.

You'll find my how-to during the next days on the related documentation Ubuntu's pages.

Regards

Revision history for this message
Andreas Troschka (signupbox) said :
#8

Conforming to what stated by Thomas, at step 7 of the procedure you have to restore your old home/oldusername tree by:
a) running the live CD
b) open a virtual terminal and mounting the sda7 as superuser e.g. sudo mount /dev/sda7 /mnt
c) restore the backupped old /home/oldusername to /mnt to obtain /mnt/home/oldusername

In c) you have to select the restore option that maintains the old user/group specs!

This seems to be all you need to gain your target. Anyway this is the process I follow to do system upgrades and it has always worked without problems of sort.

Good luck

Revision history for this message
Gerry Moore (baktoblu) said :
#9

WWSmith36 wrote:
> Your question #46343 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/46343
>
> Status: Open => Answered
>
> WWSmith36 proposed the following answer:
> Did you restore your /etc/apt/sources.list before you tried the
> backup.log procedure? If the additional repositories were not enabled
> then the programs from those repositories wouldn´t get reinstalled.
>
>
I reviewed the instructions on using the backup log and it did not
include your point to first restore the repositories. Thank you for the
suggestion.

Gerry

Revision history for this message
Andreas Troschka (signupbox) said :
#10

Yes, that's a good point.
Anyway, if you want to get back your preferences, you have to whipe out the root (/) tree /home excluded, install the new ubuntu (or the same version if you want a simple clean-up) with the same userid as before, then delete the new /home/userid and place the old /home/userid at its place.

Beware!
It may happen that in the meanwhile some applications have been upgraded in the repositories and that they can nomore deal with the configuration files in the old /home/userid you place in the new installation.
This may cause malfunctions while running that applications.

To reduce such risks, you should upgrade your applications on-line and test them before starting the entire process while you already have your old environment "running".

Yes, it is a tricky task. So we have to identify every possible cause of loss of data before starting a reinstallation.

Regards

Can you help with this problem?

Provide an answer of your own, or ask Gerry Moore for more information if necessary.

To post a message you must log in.