lmckusic@dapit:~$ cat howtorollbackfrom20to18
How to Roll back from 20.04 Ubuntu to Ubuntu 18.04 by Lee McKusick
July 14, 2022
I finally decided to roll back from Ubuntu 20.04 "Focal Fossa" released on April 23, 2020. I rolled back to Ubuntu 18.04 "Bionic Beaver"released on April 26, 2018.
The reason for rolling back is simple: The Ubuntu 20.04 sound software shows a "Dummy device" message at the sound control panel. I need to get the sound on my 15 year old PC working.
Sound now works. Mplayer now plays analog stereo at the 3.5mm audio jack. Good.
The bad news is Evolution email is broken. I can see 5 or 6 hours of fiddling to fix Evolution.
I have not done device, partition and file management by hand for 15 years. These are notes on how to identify the devices, identify the file systems and use the Installer to plug he file systems into the Ubuntu framework.
Roll back here means, moving your entire home directory, say from Ubuntu 20 back to a Ubuntu 18 operating system. First we get two filesystems ready, then we plug them into the Ubuntu 18 Installer program. Bingo, you save your years of data and return to an older Ubuntukernel and software.
Overview of the steps.
Step 1. Find your old Ubuntu Install flash drive or Ubuntu Install CD. I used a Ubuntu 18.04 'Bionic Beaver' flash drive from 2018.
Step 1.1 Make a backup of your entire /home/username/*file system. I use rsync with a 2 terabyte USB drive.
Step 2. Get a sheet of paper. You have to write down the device names and the name of the filesystems inside the devices. Be aware that devices like /dev/sda5 are also called partitions.
Step 3. Walk through the device table. We are mainly interested in the devices that follow the "Extended" device.
We use the mount command with -f fake and -v verbose options.
mkdir mountpoint
sudo mount -fv /dev/sda9 mountpoint # -f fake
repeat without -f
sudo mount -v /dev/sda9 mountpoint # syntax ok, do it nonfake
Look at mountpoint with ls
sudo umount -v /dev/sda9 # clean up or get confused.
Note the device that contains the '/home/username' files.
Note the device that contains the '/' Linux file tree.
Make note of any other interesting partitions.
Step 4. Boot the Ubuntu 18 installer USB device or CD. Allow several minutes.
Step 5. In the Installer open a terminal and run 'sudo gparted'. Gparted run from the bottom of page menu is not root. Gparted with out sudo can't alter partitions.
Enlarge the device with '/' root (/dev/hda9 for me) and enlarge the /home user partition.
Step 6. Exit gparted and run it again and confirm that the enlarge action worked.
Step 7. Verify the root and user file system with e2fsck /dev/hda9. sudo may be required.
Step 8. Enlarge the root and user file system with resize2fs /dev/hda9 sudo may be required.
Step 9. Double check that both devices and their enclosed ext4 file systems have been enlarged as said above.
Step 10. Get a name, username, computer name, password, and timezone ready.
Step 11. Start the "Install Ubuntu" script.
Choose "Installation Type Something Else"
What is the /dev/sd? id of your root partition?
Click on that row.
Click on the prompt "Type" and answer Ext4
Click on mount type. Answer '/'
What is the /dev/sd? of your /home/username partition?
Answer Type prompt.
Click on mount type. Answer '/home'
Comment: The UbuntuInstaller is tricky but clever. The installer is attaching file systems to a mount location.
Step 12. Short notes on making some applications work as expected after rollback.
Need to enhance the Vi editor with
apt-get install vim-doc vim-gtk3 vim-common vim
To make vi use correct encryption method, do :setlocal cm=blowfish2
If the backup data contains . files like .bashrc you will get back your aliases.
Best wishes, cordially yours, Lee McKusick.
Be on the alert for the InstallUbuntu software package (part of the flash drive installer) possibly changing the size of a file system. If your normal start up fails with messages about "Starting user 121..." it may be caused by one of your file systems being too small.
Another reason for writing things down is the device and filesystem programs have slight inconsistencies in syntax. Get the commands right and then write it down.
Step 2. Get a bootable Ubuntu install device. I used an 8 gig flashdrive from my last Ubuntu 18 install activity.
Step 3. Start your present Ubuntu and list out your disk partition table
Run fdisk -l as root - much better display
sudo fdisk -l
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 976895 974848 476M 83 Linux
/dev/sda2 978942 976771071 975792130 465.3G 5 Extended
/dev/sda5 978944 415359132 414380189 197.6G 83 Linux
/dev/sda6 419459072 485044223 65585152 31.3G 83 Linux
/dev/sda7 939665408 976771071 37105664 17.7G 82 Linux swap / Solaris
/dev/sda8 415361024 419457023 4096000 2G 83 Linux
/dev/sda9 569919488 939663359 369743872 176.3G 83 Linux
The devices after the Extended partition /dev/sda2 like sda5 have a label Linux
The task now is to find the partition with your user files and your system files.
One of these devices (sda5 to sda9) has your user files and it mounts to home/
Another one of these devices has the rest of the Ubuntu operating system and it mounts to /
Step 4: We are going to mount each device to a mountpoint. Then see what filesystem and files are inside the device. Carefully unmount the devices after each test.
Boot your flash drive and open a terminal.
Make a mount point. We change to flash drive user home.
cd
mkdir mountpoint #mountpoint is plain directory.
ls #See mountpoint listed
Use -f fake -v verbose to double check.
mount -vf /dev/sda9 mountpoint # -f fake mount repeat as required
mount -v /dev/sda9 mountpoint # Should actually work if spelling is right.
ls mountpoint # Look for what has been mounted
If you have found the '/' root filesystem you will see this.
bin dev initrd.img lib64 mnt root snap sys var
boot etc initrd.img.old lost+found opt run srv tmp vmlinuz
cdrom home lib media proc sbin swapfile usr
If you see a bunch of your own files, this partition contains the /home user filesystem
Write this on paper: Mark up the device list like /dev/sda5 and the file system identified.
Unmount file system
umount -v /dev/sda9
Here is a glimpse of what we are headed for:
lmckusic@wayback:/$ mount | grep sda
/dev/sda9 on / type ext4 (rw,relatime,errors=remount-ro) #space to emphasize alignment
/dev/sda5 on /home type ext4 (rw,relatime,stripe=32745)
/dev/sda1 on /boot type ext4 (rw,relatime,stripe=4) #never touched by us
Step 5 Enlarge the / and /home device and filesystems.
Now, start up the Ubuntu Install flash drive or CD.
It appears to me that the Ubuntu System Install script does something that changes the size of the devices (like /dev/sda5) when it builds the structure around the / and /home file systems.
On the install flash drive start a Terminal, see bottom left programs.
From the terminal, start gparted as root.
sudo gparted /dev/sda # Without sudo, gparted can not change partition sizes.