Reinstalling Ubuntu without formatting /home, as well as without any old config files?
I have /home
on a separate partition. I want to reinstall Ubuntu.
I don't want to lose my personal files in /home
(I already have a backup but I would like to avoid the hassle of restoring the backup). I know how to reinstall Ubuntu using an existing /home
partition without formatting it, but I don't want any configuration from previous Ubuntu to be in the new install.
In other words, I would like a new and fresh install of Ubuntu, with my previous personal files in /home
but WITHOUT any configuration file from the previous Ubuntu install. Is this possible? How could I accomplish that?
I was thinking about manually deleting all hidden configuration files in /home
(those starting with a "dot") from the Live CD before starting the installer, but I'm not sure if the file permissions will allow me to delete those files. I'm also not sure if that will be enough to not bring any configuration settings from the previous install. I thought it would be good to ask here before trying to do that, for "safety" reasons ;)
I've done this quite often now - almost every time I did upgrade my system or (especially) if I switched to another distro. I normally log out, go to a console and log in as root directly (or depending on system configuration, as another user and switch to root), cd to /home folder and simply change my user's home folder name e.g. to "myUserName.bak". e.g.:
sudo mv /home/myUserName /home/myUserName.bak
After installation I can safely move all data needed to the newly created home folder for my user. (That's also a good point for thinking whether you e.g. really need that folder of big files you never touched the last 2 years ;) )
edit as suggested by comments: before you can access the files and folders from your renamed home folder you have to
sudo chown -R newUser.newUsersGroup /home/myUserName.bak
I always have a /home partition separate from the / so when i'm on a fresh install/upgrade, when i get to the "set up partitions" step, I select one for / (formatted) and another for /home (not formatted) but with the same file system as the previous one (or compatible).
Then, when creating users, I make sure to use the same user names as the previous installation so /home/user gets to the same place. What is great about this is that it doesn't overwrite the user's directory.
Thus if I had /home/mike, after my upgrade I'll have a mount on /home again and create the user mike so it gets all the files and config files from the previous version on /home/mike.
The only thing missing here are the /etc config files that need a backup/restore.
This is what I always do:
On the livecd I mount the /home partition and use the command
sudo chown -hR ubuntu /path/to/home/drive
The ubuntu gives ownership to the username ubuntu (the live cd's username is ubuntu) andfolder the path is whatever the drive is mounted to. On the live cd this is usually in /media/ and the name is made up of many numbers a letters.
Now delete all the config files (files and folders beginning with a dot), but I do leave a few (such as .minecraft for my game saves). Its not just folders but also files beginning with a dot.
During the installer. Go to the custom partition manager. Set your partition as mount point /home (by clicking on it and selecting edit or change, or whatever they call it now), and leave it so it is not formatted, (in the F column of the drives list check marks mean it will be formatted) and set your OS partition (one with system files) as mount point / and DO format that one.
HOWEVER
After you finish the install and login your home drive will be useless since its ownership is still on ubuntu. to change it again run
sudo chown -hR YourUsernameHere ~/