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.

| improve this question | | | | |
  • Very happy to provide diagnostics if people tell me what to run - I'm not sure what is helpful to see. – preferred_anon Mar 2 '19 at 17:07

Booting into Ubuntu would not work, but I could boot into recovery mode. From there, running fsck gave me an error like Could 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, the UUID for my root partition did not match the one in /etc/fstab. To find out the correct one, I did

blkid /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!

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.