You are not logged in.

#1 2021-12-20 21:56:06

x_driver
Member
Registered: 2019-02-05
Posts: 14

[SOLVED] GRUB config file not showing another Arch OS

I have 2 Arch installations, one on partitions 1, 2, 3 and another on 4, 5, 6.  I followed the wiki on using os-prober after mounting the other installations mount point.  Running grub-mkconfig says that an entry will be added for the additional installation but it doesn't appear in the file.  What am I missing?

[htpc@htpc ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   3.6T  0 disk 
sdb           8:16   0   3.6T  0 disk 
sdc           8:32   0   1.4T  0 disk 
└─sdc1        8:33   0   1.4T  0 part 
sdd           8:48   1   7.2G  0 disk 
├─sdd1        8:49   1   776M  0 part 
└─sdd2        8:50   1    74M  0 part 
nvme0n1     259:0    0 931.5G  0 disk 
├─nvme0n1p1 259:1    0   9.8G  0 part 
├─nvme0n1p2 259:2    0   7.8G  0 part 
├─nvme0n1p3 259:3    0 390.6G  0 part 
├─nvme0n1p4 259:4    0   9.8G  0 part /boot
├─nvme0n1p5 259:5    0   7.8G  0 part [SWAP]
└─nvme0n1p6 259:6    0 505.7G  0 part /
[htpc@htpc ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   3.6T  0 disk 
sdb           8:16   0   3.6T  0 disk 
sdc           8:32   0   1.4T  0 disk 
└─sdc1        8:33   0   1.4T  0 part 
sdd           8:48   1   7.2G  0 disk 
├─sdd1        8:49   1   776M  0 part 
└─sdd2        8:50   1    74M  0 part 
nvme0n1     259:0    0 931.5G  0 disk 
├─nvme0n1p1 259:1    0   9.8G  0 part 
├─nvme0n1p2 259:2    0   7.8G  0 part 
├─nvme0n1p3 259:3    0 390.6G  0 part /mnt
├─nvme0n1p4 259:4    0   9.8G  0 part /boot
├─nvme0n1p5 259:5    0   7.8G  0 part [SWAP]
└─nvme0n1p6 259:6    0 505.7G  0 part /
[htpc@htpc ~]$ sudo os-prober
/dev/nvme0n1p3:Arch Linux:Arch:linux
[htpc@htpc ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img initramfs-linux-fallback.img
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 Arch Linux on /dev/nvme0n1p3
Adding boot menu entry for UEFI Firmware Settings ...
done
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod btrfs
search --no-floppy --fs-uuid --set=root 9f701099-ce4a-4b3a-af94-0b1034628658
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9f701099-ce4a-4b3a-af94-0b1034628658' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod fat
	search --no-floppy --fs-uuid --set=root 66C9-304B
	echo	'Loading Linux linux ...'
	linux	/vmlinuz-linux root=UUID=9f701099-ce4a-4b3a-af94-0b1034628658 rw  loglevel=3 quiet
	echo	'Loading initial ramdisk ...'
	initrd	/intel-ucode.img /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-9f701099-ce4a-4b3a-af94-0b1034628658' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-9f701099-ce4a-4b3a-af94-0b1034628658' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod fat
		search --no-floppy --fs-uuid --set=root 66C9-304B
		echo	'Loading Linux linux ...'
		linux	/vmlinuz-linux root=UUID=9f701099-ce4a-4b3a-af94-0b1034628658 rw  loglevel=3 quiet
		echo	'Loading initial ramdisk ...'
		initrd	/intel-ucode.img /initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-9f701099-ce4a-4b3a-af94-0b1034628658' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod fat
		search --no-floppy --fs-uuid --set=root 66C9-304B
		echo	'Loading Linux linux ...'
		linux	/vmlinuz-linux root=UUID=9f701099-ce4a-4b3a-af94-0b1034628658 rw  loglevel=3 quiet
		echo	'Loading initial ramdisk ...'
		initrd	/intel-ucode.img /initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

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

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

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
	fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###

### 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 ###

Last edited by x_driver (2021-12-22 00:02:52)

Offline

#2 2021-12-20 22:10:52

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,811
Website

Re: [SOLVED] GRUB config file not showing another Arch OS

Is the other Arch system's /boot directory mounted when os-prober runs? It will need to be for the kernel & intramfs images to be discoverable.


Jin, Jîyan, Azadî

Offline

#3 2021-12-20 22:20:28

x_driver
Member
Registered: 2019-02-05
Posts: 14

Re: [SOLVED] GRUB config file not showing another Arch OS

A few attempts earlier I was mounting the other installs partition 1 into /mnt/boot. I'll try that again and report back.

When the other install was showing on Grub and I would try to boot it I kept getting the "you need to load the kernel first" message. Tried chrooting from the live install to reinstall Linux, etc, etc, but only the OS on 4, 5, and 6 boots.

Offline

#4 2021-12-20 23:30:54

x_driver
Member
Registered: 2019-02-05
Posts: 14

Re: [SOLVED] GRUB config file not showing another Arch OS

Head,

I mounted the /boot partition like you suggested, ran the os-prober, ran grub-mkconfig, rebooted and the grub menu showed the appropriate entries.  I must be doing something wrong because now the OS on partitions 4, 5, and 6 can't find the kernel.  So i'm using the Arch install from post 1 that I couldn't boot and the one that was working won't boot.  There has got to be some simple step that I'm omitting.

[htpc@htpc ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   3.6T  0 disk 
sdb           8:16   0   3.6T  0 disk 
sdc           8:32   0   1.4T  0 disk 
└─sdc1        8:33   0   1.4T  0 part 
sdd           8:48   1   7.2G  0 disk 
├─sdd1        8:49   1   776M  0 part /run/media/htpc/ARCH_202112
└─sdd2        8:50   1    74M  0 part 
nvme0n1     259:0    0 931.5G  0 disk 
├─nvme0n1p1 259:1    0   9.8G  0 part /boot
├─nvme0n1p2 259:2    0   7.8G  0 part [SWAP]
├─nvme0n1p3 259:3    0 390.6G  0 part /
├─nvme0n1p4 259:4    0   9.8G  0 part 
├─nvme0n1p5 259:5    0   7.8G  0 part 
└─nvme0n1p6 259:6    0 505.7G  0 part 

Offline

#5 2021-12-21 13:02:35

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,811
Website

Re: [SOLVED] GRUB config file not showing another Arch OS

Perhaps the identical kernel & initramfs image names are confusing grub-mkconfig & os-prober.

Try a manual entry for the "other" Arch system. Something like this in the /dev/nvme0n1p{1,2,3} system should work:

menuentry 'Other Arch' {
   search --fs-uuid --set=root $uuid_nvme0n1p4
   linux /vmlinuz-linux root=UUID=$uuid_nvme0n1p6 rw quiet
   initrd /intel-ucode.img /initramfs-linux.img
}

Replace $uuid_nvme0n1p4 & $uuid_nvme0n1p6 with the actual UUIDs for those partitions, add the stanza to the end of /etc/grub.d/40_custom and re-generate grub.cfg afterwards.


Jin, Jîyan, Azadî

Offline

#6 2021-12-21 23:44:54

x_driver
Member
Registered: 2019-02-05
Posts: 14

Re: [SOLVED] GRUB config file not showing another Arch OS

Head,

Thanks for the help.  I followed your steps verbatim and the problem persisted.  Then I followed your steps again except for the part where you said to "re-generate grub.cfg" and I'm able to boot into both OS's.

2 questions.

1.  Does it matter that the /boot/grub/grub.cfg files are different in each OS?
2.  Do I need to be concerned when running a full system update via pacman?

Offline

#7 2021-12-22 11:29:01

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,811
Website

Re: [SOLVED] GRUB config file not showing another Arch OS

x_driver wrote:

I followed your steps verbatim and the problem persisted.  Then I followed your steps again except for the part where you said to "re-generate grub.cfg" and I'm able to boot into both OS's.

To which file did you add my posted code block? From your description it sounds like you edited /boot/grub/grub.cfg directly, which isn't what I suggested.

The "correct" approach is to add the text to the end of the file at /etc/grub.d/40_custom, which would then be added to grub.cfg by grub-mkconfig. It's not critical though because Arch users don't need to regenerate grub.cfg after kernel updates (the kernel image name is non-versioned, unlike most other distributions) but adding it to grub.cfg directly would cause it to be lost if grub.cfg is ever regenerated, which is what you have described.

x_driver wrote:

Does it matter that the /boot/grub/grub.cfg files are different in each OS?

Not really.

An alternative approach would be to use grub.cfg in the "other" Arch system to show a menu, like this:

menuentry 'Other Arch' {
   search --fs-uuid --set=root $uuid_nvme0n1p4
   configfile /grub/grub.cfg
}

But then you would have to go through two menus to boot the second system.

x_driver wrote:

Do I need to be concerned when running a full system update via pacman?

No, the kernel & initramfs images in Arch are non-versioned so the menuentry should remain functional even after kernel updates. The same applies to the µcode package.


Jin, Jîyan, Azadî

Offline

#8 2021-12-22 16:40:04

x_driver
Member
Registered: 2019-02-05
Posts: 14

Re: [SOLVED] GRUB config file not showing another Arch OS

Head,

Thanks again.

Head_on_a_Stick wrote:

To which file did you add my posted code block? From your description it sounds like you edited /boot/grub/grub.cfg directly, which isn't what I suggested.

Yeah, I edited this file.  I see the /etc/grub.d/custom_40 that I should be editing.  I'll make the appropriate changes to make it correct.

Offline

Board footer

Powered by FluxBB