1

Background and problem

I want to experiment with gentoo on a laptop that previously only had ubuntu installed. To be clear; the ubuntu installer configured the entire disk for me. Afterwards I made a partition for gentoo. I've done most of the work for installing gentoo, but I am stuck with setting up the boot process.

Any of the following outcomes would be ok:

  • have ubuntu be the OS to manage grub, but giving me the option to boot gentoo too.
  • reset everything and have gentoo be the OS to manage grub (preventing ubuntu somehow from overwriting the gentoo config)
  • have them be coexisting peacefully somehow maybe some other way

Right now my immediate problem is that I can't get the gentoo installation to show up in the ubuntu-managed grub and neither can I get gentoo to replace the ubuntu grub installation.

disk layout

lsblk

nvme0n1     259:0    0 931.5G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
├─nvme0n1p2 259:2    0 195.3G  0 part /
├─nvme0n1p3 259:3    0 195.3G  0 part 
└─nvme0n1p4 259:4    0 540.4G  0 part 

or fdisk -l ...

Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: MKNSSDHL1TB-D8                          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 081...96C951

Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1050623 1048576 512M EFI System /dev/nvme0n1p2 1050624 410650623 409600000 195.3G Linux filesystem /dev/nvme0n1p3 410650624 820250623 409600000 195.3G Linux filesystem ...

  • /dev/nvme0n1p1 is the EFI partition and mounted as /boot/efi on ubuntu (why?)
  • /dev/nvme0n1p2 is where the ubuntu installation resides
  • /dev/nvme0n1p3 is where gentoo is installed

Content of /boot

The gentoo installation manual specifies to mount the EFI partition on /boot. I did this and as a result, this is what my /boot currently contains (as seen from the ubuntu installation)

├── config-5.15.0-50-generic
├── efi
│   ├── config-5.15.69-gentoo
│   ├── config-5.15.69-gentoo.old
│   ├── EFI
│   │   ├── BOOT
│   │   │   ├── BOOTX64.EFI
│   │   │   ├── fbx64.efi
│   │   │   └── mmx64.efi
│   │   ├── EFI
│   │   │   └── gentoo
│   │   │       └── grubx64.efi 
│   │   ├── gentoo
│   │   │   └── grubx64.efi
│   │   └── ubuntu
│   │       ├── BOOTX64.CSV
│   │       ├── grub.cfg
│   │       ├── grubx64.efi
│   │       ├── mmx64.efi
│   │       └── shimx64.efi
│   ├── grub
│   │   ├── fonts
│   │   │   └── unicode.pf2
│   │   ├── grub.cfg
│   │   ├── grubenv
│   │   ├── locale
│   │   │   ├── ast.mo
...
│   │   │   └── zh_TW.mo
│   │   ├── themes
│   │   │   └── starfield
│   │   │       ├── blob_w.png
...
│   │   │       └── theme.txt
│   │   └── x86_64-efi
│   │       ├── acpi.mod
...
│   │       └── zstd.mod
│   ├── initramfs-5.15.69-gentoo.img
│   ├── System.map-5.15.69-gentoo
│   ├── System.map-5.15.69-gentoo.old
│   ├── vmlinuz-5.15.69-gentoo
│   └── vmlinuz-5.15.69-gentoo.old
├── grub
│   ├── fonts
│   │   └── unicode.pf2
│   ├── gfxblacklist.txt
│   ├── grub.cfg
│   ├── grubenv
│   ├── locale
│   │   ├── en_AU.mo
│   │   ├── en_CA.mo
│   │   ├── en_GB.mo
│   │   └── en@quot.mo
│   ├── unicode.pf2
│   └── x86_64-efi
│       ├── acpi.mod
...
│       └── zstd.mod
├── initrd.img -> initrd.img-5.15.0-50-generic
├── initrd.img-5.15.0-47-generic
├── initrd.img-5.15.0-48-generic
├── initrd.img-5.15.0-50-generic
├── initrd.img.old -> initrd.img-5.15.0-48-generic
├── memtest86+.bin
├── memtest86+.elf
├── memtest86+_multiboot.bin
├── System.map-5.15.0-47-generic
├── System.map-5.15.0-48-generic
├── System.map-5.15.0-50-generic
├── vmlinuz -> vmlinuz-5.15.0-50-generic
├── vmlinuz-5.15.0-47-generic
├── vmlinuz-5.15.0-48-generic
├── vmlinuz-5.15.0-50-generic
└── vmlinuz.old -> vmlinuz-5.15.0-48-generic

17 directories, 674 files

I think /boot/efi/EFI/EFI/gentoo happened when I tried to replicate mounting the boot partition on /boot/efi on the gentoo side. I am pretty sure that's not the correct way to do it...

I've got os-prober installed and dis-disabled on both OS's. On both sides when I run the grub-update and grub-install commands, they report seeing the other OS so both OS's are aware of each other. All commands report success, no failures, no warnings. I am stumped.

I just can't get gentoo to show up on the actual grub menu that shows when I boot.

Edit: output of update-grub

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-50-generic
Found initrd image: /boot/initrd.img-5.15.0-50-generic
Found linux image: /boot/vmlinuz-5.15.0-48-generic
Found initrd image: /boot/initrd.img-5.15.0-48-generic
Found linux image: /boot/vmlinuz-5.15.0-47-generic
Found initrd image: /boot/initrd.img-5.15.0-47-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Gentoo Linux on /dev/nvme0n1p3
Adding boot menu entry for UEFI Firmware Settings ...
done

Edit: os-prober section of /boot/grub/grub.cfg

Apparently os-prober did not convincingly convince grub that I have another OS to boot.

### BEGIN /etc/grub.d/30_os-prober ###

END /etc/grub.d/30_os-prober

  • 2
    grub-update is not a valid command. It would be helpful to include the complete output of sudo update-grub (from Ubuntu) in your question. – mook765 Oct 12 '22 at 15:23
  • 2
    Can you see gentoo related menu-entries in /boot/grub/grub.cfg? You should find them after the line ### BEGIN /etc/grub.d/30_os-prober ###. – mook765 Oct 12 '22 at 15:39
  • 3
    And it's dual, not "duel" (unless you're talking about sparring). – ChanganAuto Oct 12 '22 at 17:08
  • Please copy & paste the pastebin link to the BootInfo summary report ( do not post report), do not run the auto fix till reviewed.Lets see details, use ppa version with your USB installer (2nd option) or any working install, not Boot-Repair ISO https://help.ubuntu.com/community/Boot-Repair With Ubuntu the ESP folder is /EFI/ubuntu and then fstab mounts it at /boot/efi so full path when booted is /boot/efi/EFI/ubuntu. Use labels and configfile to boot another install https://askubuntu.com/questions/344125/how-to-add-a-grub2-menu-entry-for-booting-installed-ubuntu-on-a-usb-drive/344359#344359 – oldfred Oct 12 '22 at 19:31

1 Answers1

2

I've had the same issue with Arch and Ubuntu dual boot. Grub is configured only within Ubuntu. I did not install grub on Arch.

The problem with running update-grub is, Ubuntu thinks that the kernels added by the other OS are its own kernels, so it sets them to boot into Ubuntu.

The solution for me was setting the boot partition only for Ubuntu kernels and images, and Arch Linux's kernels and images in its own partition.

After this, I've let both of them to create their own kernels and images in their own environments.

Lastly, using grub-customizer I've added the Arch Linux options manually. (copying the Ubuntu options and changing the partition UUID and image path worked)

  • Do I understand correctly? You have two EFI partitions, one for ubuntu and one for arch which they independently populate. How does your computer choose which EFI partition and which grub to show/boot from? – Pieter Breed Oct 26 '22 at 09:21
  • I've forgotten to mention that I made this in BIOS, not UEFI. This should work the same way in UEFI too. In total, I have 3 partitions; 1st BIOS (controlled only by Ubuntu), 2nd Ubuntu's root partition, 3rd Arch's root partition. Arch's kernels and images are located in its own root partition(/dev/sda3), in /boot. – Emre Talha Oct 26 '22 at 12:27