I am having some trouble partitioning. I'll try to explain everything from the beginning. I have two laptops, 1 and 2.
On laptop 1 I have only Ubuntu 18.04 installed, and I made a backup of my system by following the instructions here. On laptop 2 I installed Gentoo on dev/sda
, following a tutorial on Youtube. The partitions dev/sdaX
for X=1,2,3,4 are boot
,grub
,swap
,root
, respectively. The Gentoo installation completed successfully - it would boot up to a CLI fine and I could move around and edit files.
I tried to do the following: Install Ubuntu alongside Gentoo on laptop 2, and restore the copy of laptop 1 onto this partition. First, I had to resize some partitions. In the Gentoo install, I made sda4
take up the remainder of the drive. On the Ubuntu live disk I ran Gparted and resized sda4
to take up around 20 GiB, and made the remainder of the drive (partition sda5
) available for Ubuntu.
During the Ubuntu installation I chose "install Ubuntu alongside Gentoo", and divided it to save around 20 GiB and leave the rest for Ubuntu. I misunderstood this part - the net consequence was that sda5
was resized to 20 GiB, and the remainder of the drive (sda6
) contained Ubuntu. The rest of the installation was successful, and I restored my backup from laptop 1. It seems like it completed successfully, because I can mount sda6
and all the right files are there. Importantly: at this step I had booted from grub into the new Ubuntu install, and Gentoo was still available from the menu.
I tried to reboot, and got a GRUB menu that only had Ubuntu in it. Confusing, but ok. I tried to boot into Ubuntu and got the following errors:
error: no such device XXXXXX
error: no such partition
error: you need to install the kernel first
I ran the boot-repair
script and it said it failed;
I got the following pastebin: http://paste.ubuntu.com/p/nJ3r2dZ5sy/
Restarting, my boot menu now has Ubuntu and Gentoo available. I have tried to boot into Gentoo and got in just fine. I tried to boot into Ubuntu and the power up dots are lit, but it seems to hang there. If I tap the power button then it shuts down in a safe-looking way, but it doesn't get to the login screen or anything.
If it's possible to tell, did I do anything wrong? If so, what, and how do I fix it/avoid it in future? I still have my backup so reinstalling ubuntu on sda6
or whatever and restoring again is an option. But I'd like to understand it a bit better.
Booting into Ubuntu would not work, but I could boot into recovery mode. From there, running
fsck
gave me an error likeCould not find partition XXXX
, which fits with the message I was getting before.It turns out that every partition has a so-called
UUID
, which is stored in the/etc/fstab
file. When I changed my partitions, theUUID
for my root partition did not match the one in/etc/fstab
. To find out the correct one, I didblkid /dev/sda6
in the root command shell in recovery mode, which gave me a different id, call it
YYYY
. Now, the problem was solved by opening the/etc/fstab
file (which was initially read-only, even as root, but the second answer to this question resolved that problem) and changing the UUID there to the correct value. I copied the line that was above it apart from that.And now I can boot into Ubuntu!