Score:0

How can I take a '/home' on its own partition, and use it after distribution upgrade?

ar flag

Current: 20.04 with /home on its own partition.

Target: Install 22.04 on '/', and then switch the (then-new) 'home' subdir, to utilize the separately-partitioned /home.

My concern includes user names & ID #'s, group names & ID #'s... meaning, a new 'home' subdir with the installation user name will likely be ID # 1000. But on the partitioned /home, there is already an important user name with ID # 1000.

It is critical I keep the partitioned /home intact. How can I incorporate that into a fresh install of 22.04? Thanks.

ar flag
Does this answer your question? [Keep /home directory when installing Ubuntu 14.04](https://askubuntu.com/questions/630966/keep-home-directory-when-installing-ubuntu-14-04)
ar flag
Don't forget to backup your home partition before you try anything in case something goes wrong.
gandsnut avatar
ar flag
@user68186: Appreciated... The backup will run tomorrow, then I'll do more prep, and re-study the link you provided.
Score:4
it flag

For the install:

Preserve cron, batch and at jobs. Look in /var/spool/.

Preserve copies of locally modified files in the /etc directory tree.

Preserve locally installed applications. Save the configuration files, be ready to reinstall current versions of applications.

apt changelog packagename is your friend.

Everything outside /home will be destroyed by the install.

For /home:

You can tell the installer (the "Something Else" choice?) to put /home where you have it, and UNCheck the box in the "Format" column. Verify. DO NOT FORMAT /home.

For the UIDs - keep copies of /etc/{passwd,shadow,group,gshadow}. Understand these files! Read man -a passwd;man shadow group getent

Let the installer create a temporary userid, UID 1000, homedir /home/temporary.

After the install, login as temporary.

First, in one window, sudo bash. This is your Emergency Investigation and Recovery Window.

In another window, sudo bash.

Make another, separate backup copy of /etc/{passwd,shadow,group,gshadow}

Use your original copies to restore your groups and userids. Do NOT blindly copy the old files, think carefully about each entry.

Note that (passwd and shadow) and (group and gshadow) entries should be updated in pairs, both or neither.

Use getent to check your work. E.g. getent passwd special

Only after testing:

  • login by the special user?
  • can the special user still special?
  • login by your admin user?
  • can admin still sudo?
  • ...

Can you log out. Then, log in as your admin account, and delete the temporary user. Read man deluser.

gandsnut avatar
ar flag
Your comments were substantially helpful. After a failed "do-release-upgrade" for 20.04 -> 22.04, I did a new install of the latter (Cinnamon). At one point I jazzed up the passwords, but did hold-shift during boot to get into GRUB, and chose a different (emergency) kernel to allow password fix. I still have not solved a displayed GROUP shown as a numeric '1004' rather that what I wanted 'bigfish'. That was remedied by using the add group command. So far pgms tested have found their config and even migrated data (incl Thunderbird !!!). MUCH appreciated.
waltinator avatar
it flag
Please click the checkmark to "accept" my answer, if it solved your problem, and might help others.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.