Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GRUB detecting Gentoo, but not adding to boot menu
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Sikorsky42
n00b
n00b


Joined: 27 Aug 2020
Posts: 16
Location: USA

PostPosted: Tue May 18, 2021 1:05 am    Post subject: GRUB detecting Gentoo, but not adding to boot menu Reply with quote

Greetings,

I’d appreciate any experience anyone has similar to this issue and/or suggestions about which files to look into to track down the issue.

I have Manjaro installed with grub properly set up with windows detected and added to the boot menu.

I just installed Gentoo on another drive with the following layout
sda1: swap
sda2: gentoo-btrfs
- @ : Gentoo root partition
- @home : Gentoo home partition

I went through the process of installing the Gentoo base system, configuring and compiling the kernel, and and setting up the system to be ready to boot into. I did all this by chrooting into the btrfs volume from Manjaro. This is why I did not include a /boot/efi (efi system partition) in the Gentoo installation process, as would typically be required. I want to simply use the Manjaro GRUB to launch into any of my, now 3, OS’s.

Code:
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.10-x86_64
Found initrd image: /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-5.10-x86_64.img
Found initrd fallback image: /boot/initramfs-5.10-x86_64-fallback.img
Found linux image: /boot/vmlinuz-5.4-x86_64
Found initrd image: /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-5.4-x86_64.img
Found initrd fallback image: /boot/initramfs-5.4-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
It's output will be used to detect bootable binaries on them and create new boot entries.
Found Manjaro Linux on /dev/nvme0n1p3
Found Windows Boot Manager on /dev/nvme1n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Found Gentoo/Linux on /dev/sda2
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Info: Separate boot partition not detected
Found snapshot: 2021-05-16 18:00:02 | timeshift-btrfs/snapshots/2021-05-16_18-00-02/@
===Additional output surpressed===
done


When I run `update-grub` on Manjaro,

The output says it detected Gentoo on /dev/sda2, but when I reboot, it does not show this as a menu entry.
Contents of Gentoo’s /boot:

config-5.10.27-gentoo
System.map-5.10.27-gentoo
vmlinuz-5.10.27-gentoo

Thank you in advance for any ideas for tracking this down!
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2963
Location: Edge of marsh USA

PostPosted: Tue May 18, 2021 2:23 am    Post subject: Reply with quote

Show your Manjaro /boot/grub/grub.cfg.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Sikorsky42
n00b
n00b


Joined: 27 Aug 2020
Posts: 16
Location: USA

PostPosted: Tue May 18, 2021 9:27 am    Post subject: Reply with quote

Code:

[> cat /boot/grub/grub.conf

===Additional output surpressed===

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Manjaro Linux (on /dev/nvme0n1p3)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
   insmod part_gpt
   insmod btrfs
   search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
   linux /@/boot/vmlinuz-5.11-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
   initrd /@/boot/intel-ucode.img /@/boot/amd-ucode.img /@/boot/initramfs-5.11-x86_64.img
}
submenu 'Advanced options for Manjaro Linux (on /dev/nvme0n1p3)' $menuentry_id_option 'osprober-gnulinux-advanced-4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
   menuentry 'Manjaro Linux (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.11-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.11-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/intel-ucode.img /@/boot/amd-ucode.img /@/boot/initramfs-5.11-x86_64.img
   }
   menuentry 'Manjaro Linux (Kernel 5.11.2-1-MANJARO x64) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.11-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.11-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/intel-ucode.img /@/boot/amd-ucode.img /@/boot/initramfs-5.11-x86_64.img
   }
   menuentry 'Manjaro Linux (Kernel 5.11.2-1-MANJARO x64 - fallback initramfs) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.11-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.11-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/initramfs-5.11-x86_64-fallback.img
   }
   menuentry 'Manjaro Linux (Kernel 5.10.19-1-MANJARO x64) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.10-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.10-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/intel-ucode.img /@/boot/amd-ucode.img /@/boot/initramfs-5.10-x86_64.img
   }
   menuentry 'Manjaro Linux (Kernel 5.10.19-1-MANJARO x64 - fallback initramfs) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.10-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.10-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/initramfs-5.10-x86_64-fallback.img
   }
   menuentry 'Manjaro Linux (Kernel 5.4.101-1-MANJARO x64) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.4-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.4-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/intel-ucode.img /@/boot/amd-ucode.img /@/boot/initramfs-5.4-x86_64.img
   }
   menuentry 'Manjaro Linux (Kernel 5.4.101-1-MANJARO x64 - fallback initramfs) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/vmlinuz-5.4-x86_64--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/vmlinuz-5.4-x86_64 root=UUID=4a3f7f2f-1f52-4747-beed-3f83082a0c6c ro rootflags=subvol=@ quiet udev.log_priority=3
      initrd /@/boot/initramfs-5.4-x86_64-fallback.img
   }
   menuentry 'Memory Tester (memtest86+) (on /dev/nvme0n1p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/@/boot/memtest86+/memtest.bin--4a3f7f2f-1f52-4747-beed-3f83082a0c6c' {
      insmod part_gpt
      insmod btrfs
      search --no-floppy --fs-uuid --set=root 4a3f7f2f-1f52-4747-beed-3f83082a0c6c
      linux /@/boot/memtest86+/memtest.bin
   }
}

menuentry 'Windows Boot Manager (on /dev/nvme1n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-8E99-C0D4' {
   insmod part_gpt
   insmod fat
   search --no-floppy --fs-uuid --set=root 8E99-C0D4
   chainloader /efi/Microsoft/Boot/bootmgfw.efi
}

set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### END /etc/grub.d/30_os-prober ###

===Additional output surpressed===


So, it seems that the Gentoo entry was not created for some reason, although it claimed to be discovered. I could just create it manually by copying the manjaro one into 40_custom I suppose.

Another thought: manjaro is detected by 30_os-prober, but it is already detected in the first section by 10_linux. I'll look at os-prober to see if it can filter out the already detected manjaro.[/code]
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2007

PostPosted: Tue May 18, 2021 10:56 am    Post subject: Reply with quote

IHMO it's almost always better to use the output of grub-mkconfig as a seed for your own manually-configured grub.cfg. The scripting language is pretty straight-forward, and a significant proportion of the made config is noise. Plus the insane requirement to rerun it after each kernel update 'cos it codes version numbers into the script rather than use symlinks with static names (on filesystems where symlimks are possible, of course). If you're interested in this alternative, you might find my wiki page on the subject useful.
_________________
Greybeard
Back to top
View user's profile Send private message
Sikorsky42
n00b
n00b


Joined: 27 Aug 2020
Posts: 16
Location: USA

PostPosted: Tue May 18, 2021 4:10 pm    Post subject: Reply with quote

Goverp, Thank you!

I just glanced at that wiki page and already I am feeling a lot better. I didn't know there was a grub-emu tool to check the grub menu before rebooting and realizing I can't get back in. I will read throught here and see if I can create a manual grub.cfg that will work with manjaro. Myabe I could write a pacman hook that would update grub.cfg after timeshift-autosnap updates grub.cfg. I should be able to use symlinks, since my kernels are in btrfs. Only the grub bootloader itself is in the FAT32 efi area. Speaking of which, how does the grub (the efi boot image located at /boot/efi/EFI/BOOT...) know to look in /boot/grub/grub.cfg for its configuration? Especially how does it know to do this when /boot/grub is not on the same partition as /boot/efi, as is typical for EFI installs? Is that part of what happens when you run `grub install /dev/sda1`?
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1530
Location: South America

PostPosted: Tue May 18, 2021 4:40 pm    Post subject: Reply with quote

Sikorsky42 wrote:
Speaking of which, how does the grub (the efi boot image located at /boot/efi/EFI/BOOT...) know to look in /boot/grub/grub.cfg for its configuration? Especially how does it know to do this when /boot/grub is not on the same partition as /boot/efi, as is typical for EFI installs? Is that part of what happens when you run `grub install /dev/sda1`?

Yes. Information about the filesystem that holds /boot/grub is embedded by grub-install in the generated EFI executable (grubx64.efi) so that it can find grub.cfg and the modules, themes, fonts, etc. If your particular installation needs that information, you'll find it in /boot/grub/x86_64-efi/load.cfg. It's a text file containing GRUB commands.
Back to top
View user's profile Send private message
skiwarz
Apprentice
Apprentice


Joined: 23 Feb 2014
Posts: 263

PostPosted: Tue May 18, 2021 5:16 pm    Post subject: Reply with quote

A couple thoughts:
Are you sure the script wrote to the correct grub.cfg file? (check the timestamp, or do a "find / -name grub.cfg" with your disks mounted)
Similarly, check to see if grub is pulling the .cfg from a different partition, and/or that your uefi is loading the correct grub. Sometimes when I install an OS, the installer sticks 2 or 3 different bootloaders in my efi partition.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2963
Location: Edge of marsh USA

PostPosted: Tue May 18, 2021 8:02 pm    Post subject: Reply with quote

"grub-mkconfig -o /boot/grub/grub.cfg" (grub-mkconfig specifically) isn't perfect. I've had numerous instances of of the generated grub.cfg being screwy. This is especially true if dealing with over 9 partitions. I use it but I keep a /boot/grub/custom.cfg which I hand edit to be sure I don't end up with unrecoverable surprises. If you have a file "/boot/grub/custom.cfg" its content will be appended to the generated grub.cfg.

As a further fall-back, I have the following in /etc/grub.d/
Code:
$ more 40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Chainload Grub on /dev/sdb" {
set root=(hd1)
chainloader +1
}

where I maintain some known working configurations on the secondary hard drive.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Romanticio
Tux's lil' helper
Tux's lil' helper


Joined: 07 Feb 2021
Posts: 76

PostPosted: Mon Aug 16, 2021 5:29 pm    Post subject: Re: GRUB detecting Gentoo, but not adding to boot menu Reply with quote

Sikorsky42 wrote:
Contents of Gentoo’s /boot:

config-5.10.27-gentoo
System.map-5.10.27-gentoo
vmlinuz-5.10.27-gentoo

Since there does not appear to be a grub directory in Gentoo's /boot/
Means you didn't install grub and grub-mkconfig -o /boot/grub/grub.cfg in Gentoo which is required for other OS to find the info.
Whenever I add a new kernel to my Gentoo Gnome complete with initramfs.img and do not run grub-mkconfig -o /boot/grub/grub.cfg
When I run grub-mkconfig -o /boot/grub/grub.cfg in Gentoo Plasma which has os-prober, It will not include the new kernel in Gentoo Gnome
grub-mkconfig -o /boot/grub/grub.cfg has to be run after every new kernel in the OS without os-prober for it to be included.
Quote:
linux /boot/vmlinuz-5.13.10-gentoo root=UUID=92a31f66-f27f-4dc6-87fd-b6e6c8454021 ro init=/usr/lib/systemd/systemd
initrd /boot/intel-uc.img /boot/initramfs-5.13.10-gentoo.img

The quote above are the last two lines of a Gentoo entry in Debian grub.cfg. How does Debian know I edited /etc/default/grub to include init path?
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Mon Aug 16, 2021 6:14 pm    Post subject: Reply with quote

Goverp wrote:
IHMO it's almost always better to use the output of grub-mkconfig as a seed for your own manually-configured grub.cfg. The scripting language is pretty straight-forward, and a significant proportion of the made config is noise. Plus the insane requirement to rerun it after each kernel update 'cos it codes version numbers into the script rather than use symlinks with static names (on filesystems where symlimks are possible, of course). If you're interested in this alternative, you might find my wiki page on the subject useful.


If I ever had to use Grub2 (very unlikely) then manual configuration is the only feasible solution for me, and it is just as simple as legacy Grub conf.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Kainos
n00b
n00b


Joined: 19 Aug 2021
Posts: 2

PostPosted: Thu Aug 19, 2021 1:01 am    Post subject: Reply with quote

Make sure you do: emerge --ask sys-boot/os-prober

and have: GRUB_DISABLE_OS_PROBER=false

in: /etc/default/grub
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2963
Location: Edge of marsh USA

PostPosted: Thu Aug 19, 2021 3:43 am    Post subject: Reply with quote

Edit the Manjaro /boot/grub/grub.cfg and add the Gentoo booting information yourself.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Kainos
n00b
n00b


Joined: 19 Aug 2021
Posts: 2

PostPosted: Thu Aug 19, 2021 11:29 am    Post subject: Reply with quote

figueroa wrote:
Edit the Manjaro /boot/grub/grub.cfg and add the Gentoo booting information yourself.


I did that and it works temporarily until it's overwritten next time update-grub is called by whichever script needs it at the time of the next update.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2963
Location: Edge of marsh USA

PostPosted: Thu Aug 19, 2021 3:36 pm    Post subject: Reply with quote

Add those changes in /boot/grub/custom.cfg. Doing so will cause custom.cfg to be added to the end of /boot/grub/grub.cfg when updated.

Ref: /etc/grub.d/41_custom

Example:
Code:
cat /boot/grub/custom.cfg
#timeout=5
#default=0
#menu_color_normal=white/blue

menuentry 'Gentoo GNU/Linux, with Linux 5.4.134-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.134-gentoo-advanced-5958fd45-723e-4d6b-9253-e74dada52d45' {
   set root='hd0,msdos1'
   linux /boot/kernel-5.4.134-gentoo root=/dev/sda1 ro rootfstype=ext4 net.ifnames=0
   initrd   /boot/early_ucode.cpio
}
menuentry 'Gentoo GNU/Linux, with Linux 5.4.134-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.134-gentoo-advanced-5958fd45-723e-4d6b-9253-e74dada52d45' {
   set root='hd0,msdos1'
   linux /boot/kernel-5.4.134-gentoo root=/dev/sda1 ro single rootfstype=ext4
   initrd   /boot/early_ucode.cpio
}

menuentry 'Chainload Grub on /dev/sdb' {
set root=(hd1)
chainloader +1
}

menuentry "Chainload Grub on /dev/sdb1" {
set root=('hd1,msdos1')
chainloader +1
}

menuentry "Chainload Grub on /dev/sdb2" {
set root=('hd1,msdos2')
chainloader +1
}

menuentry 'Failsafe' {
set root='hd0,msdos1'
linux /boot/vmlinuz
initrd /boot/early_ucode.cpio
}

### BEGIN /etc/grub.d/41_custom ###
#if [ -f  ${config_directory}/custom.cfg ]; then
#  source ${config_directory}/custom.cfg
#elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
#  source $prefix/custom.cfg;
#fi
### END /etc/grub.d/41_custom ###

_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Romanticio
Tux's lil' helper
Tux's lil' helper


Joined: 07 Feb 2021
Posts: 76

PostPosted: Sun Aug 22, 2021 5:16 am    Post subject: Reply with quote

figueroa wrote:
Add those changes in /boot/grub/custom.cfg. Doing so will cause custom.cfg to be added to the end of /boot/grub/grub.cfg when updated.

Ref: /etc/grub.d/41_custom

I suspect you suggest this custom.cfg would be placed in Manjaro /boot/grub directory?
In which case it is still a temporary fix till you upgrade the Gentoo kernel. But better than waiting for the surprise no-boot.
At least you'll know when to edit the custom.cfg and then update-grub will need to be run again from Manjaro to enable booting the new kernel.

Installing grub in Gentoo would simplify things and automatically adds an entry to the EFI firmware boot menu, which is a bonus having more than one angle to boot a Linux OS, depending solely on Manjaro's boot loader is kinda old school. Choosing to use efibootmgr to add an entry for it in EFI boot menu would likely require constant editing there also when vmlinuz name changes.

However, if you don't intend on upgrading kernels, disregard this post.
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2007

PostPosted: Sun Aug 22, 2021 10:10 am    Post subject: Reply with quote

You could use a manually-coded grub menu and ignore any tools to update it.
My choice is to create symbolic links for vmlinuz, config and System.map (once there, kernel "make install" maintains them), and use the menu in this wiki item.
_________________
Greybeard
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum