You are not logged in.

#1 2023-07-11 05:25:52

drewk
Member
Registered: 2021-09-01
Posts: 9

[SOLVED] os-prober not detecting second Arch install

I've been dual booting Arch and Windows without issue but I'm having some trouble adding a second Arch install to my grub.cfg. With the UEFI firmware settings I can change the boot order and use the second Arch no problem, but it's not detected by os-prober when I mount its ESP to /mnt/otherarch.

Here's some more info:

$ lsblk -f
NAME        FSTYPE FSVER LABEL           UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1      vfat   FAT32                 F9B1-32DC                               887M    13% /boot
└─sda2      ext4   1.0                   2a2e8a28-3177-4295-968d-d6096da93874  864.5G     0% /
sdb
├─sdb1      vfat   FAT32                 61C3-721C                             887.2M    13% /mnt/otherarch
└─sdb2      ext4   1.0                   e6245030-334d-46f8-b304-660e2e5696fb
nvme0n1
├─nvme0n1p1 ntfs         System Reserved DCAEE788AEE75A12
├─nvme0n1p2 ntfs                         7C6EE92B6EE8DEC0
├─nvme0n1p3 vfat   FAT32                 FA3B-83B8                              69.4M    28% /mnt/windows
└─nvme0n1p4 ntfs                         2208FFA008FF70E1
# parted -l
Model: ATA Samsung SSD 870 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  1075MB  1074MB  fat32              boot, esp
 2      1075MB  1000GB  999GB   ext4


Model: ATA INTEL SSDSC2BF18 (scsi)
Disk /dev/sdb: 180GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  1075MB  1074MB  fat32              boot, esp
 2      1075MB  180GB   179GB   ext4


Model: Samsung SSD 970 EVO 1TB (nvme)
Disk /dev/nvme0n1: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size   File system  Name  Flags
 1      1049kB  525MB   524MB  ntfs               msftdata
 2      525MB   1000GB  999GB  ntfs               msftdata
 3      1000GB  1000GB  105MB  fat32              boot, esp, no_automount
 4      1000GB  1000GB  547MB  ntfs               hidden, diag, no_automount
# os-prober
/dev/nvme0n1p3@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi

Also, not sure if this is important, but for both Arches I had to install GRUB to the fallback path using

grub-install --target=x86_64-efi --efi-directory=/boot --removable

for my motherboard to detect them.

Thank you for any help with this!

Last edited by drewk (2023-07-12 22:47:53)

Offline

#2 2023-07-11 07:43:32

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,237

Re: [SOLVED] os-prober not detecting second Arch install

Are the actual kernels placed on /mnt/otherarch ? Can you post an ls from there?

Offline

#3 2023-07-11 14:31:01

drewk
Member
Registered: 2021-09-01
Posts: 9

Re: [SOLVED] os-prober not detecting second Arch install

$ ls /mnt/otherarch
EFI  grub  initramfs-linux-fallback.img  initramfs-linux.img  intel-ucode.img  vmlinuz-linux

Offline

#4 2023-07-11 15:05:39

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,237

Re: [SOLVED] os-prober not detecting second Arch install

From eyeballing the os-prober source. Mount it logically correctly i.e.

mount /dev/sdb2 /mnt/otherarch
mount /dev/sdb1 /mnt/otherarch/boot

it needs to know your root partition to properly generate the initrd entry.

Or just punch up a correct entry yourself, you can load existing grub configs into an existing one: https://wiki.archlinux.org/title/GRUB#GNU/Linux

Last edited by V1del (2023-07-11 15:08:36)

Offline

#5 2023-07-11 16:06:35

drewk
Member
Registered: 2021-09-01
Posts: 9

Re: [SOLVED] os-prober not detecting second Arch install

Ok, with it mounted logically, os-prober does detect it:

$ lsblk /dev/sdb
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sdb      8:16   0 167.7G  0 disk
├─sdb1   8:17   0     1G  0 part /mnt/otherarch/boot
└─sdb2   8:18   0 166.7G  0 part /mnt/otherarch
# os-prober
/dev/nvme0n1p3@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
/dev/sdb2:Arch Linux:Arch:linux
# 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 Windows Boot Manager on /dev/nvme0n1p3@/EFI/Microsoft/Boot/bootmgfw.efi
Found Arch Linux on /dev/sdb2
Adding boot menu entry for UEFI Firmware Settings ...
done
$ cat /boot/grub/grub.cfg
#
# 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 ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  2a2e8a28-3177-4295-968d-d6096da93874
else
  search --no-floppy --fs-uuid --set=root 2a2e8a28-3177-4295-968d-d6096da93874
fi
    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=-1
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=-1
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/06_grub-customizer_menu_color_helper ###
### END /etc/grub.d/06_grub-customizer_menu_color_helper ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2a2e8a28-3177-4295-968d-d6096da93874' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod fat
	set root='hd0,gpt1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  F9B1-32DC
	else
	  search --no-floppy --fs-uuid --set=root F9B1-32DC
	fi
	echo	'Loading Linux linux ...'
	linux	/vmlinuz-linux root=UUID=2a2e8a28-3177-4295-968d-d6096da93874 rw  loglevel=3 splash
	echo	'Loading initial ramdisk ...'
	initrd	/intel-ucode.img /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-2a2e8a28-3177-4295-968d-d6096da93874' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-2a2e8a28-3177-4295-968d-d6096da93874' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod fat
		set root='hd0,gpt1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  F9B1-32DC
		else
		  search --no-floppy --fs-uuid --set=root F9B1-32DC
		fi
		echo	'Loading Linux linux ...'
		linux	/vmlinuz-linux root=UUID=2a2e8a28-3177-4295-968d-d6096da93874 rw  loglevel=3 splash
		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-2a2e8a28-3177-4295-968d-d6096da93874' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod fat
		set root='hd0,gpt1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  F9B1-32DC
		else
		  search --no-floppy --fs-uuid --set=root F9B1-32DC
		fi
		echo	'Loading Linux linux ...'
		linux	/vmlinuz-linux root=UUID=2a2e8a28-3177-4295-968d-d6096da93874 rw  loglevel=3 splash
		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/25_bli ###
if [ "$grub_platform" = "efi" ]; then
  insmod bli
fi
### END /etc/grub.d/25_bli ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p3)' --class windows --class os $menuentry_id_option 'osprober-efi-FA3B-83B8' {
	insmod part_gpt
	insmod fat
	search --no-floppy --fs-uuid --set=root FA3B-83B8
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry 'Arch Linux (on /dev/sdb2)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-e6245030-334d-46f8-b304-660e2e5696fb' {
	insmod part_gpt
	insmod ext2
	set root='hd1,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  e6245030-334d-46f8-b304-660e2e5696fb
	else
	  search --no-floppy --fs-uuid --set=root e6245030-334d-46f8-b304-660e2e5696fb
	fi
	linux /boot/vmlinuz-linux root=/dev/sdb2
	initrd /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux (on /dev/sdb2)' $menuentry_id_option 'osprober-gnulinux-advanced-e6245030-334d-46f8-b304-660e2e5696fb' {
	menuentry 'Arch Linux (on /dev/sdb2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--e6245030-334d-46f8-b304-660e2e5696fb' {
		insmod part_gpt
		insmod ext2
		set root='hd1,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2  e6245030-334d-46f8-b304-660e2e5696fb
		else
		  search --no-floppy --fs-uuid --set=root e6245030-334d-46f8-b304-660e2e5696fb
		fi
		linux /boot/vmlinuz-linux root=/dev/sdb2
		initrd /boot/initramfs-linux.img
	}
}

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

### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
	fwsetup --is-supported
	if [ "$?" = 0 ]; then
		menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
			fwsetup
		}
	fi
fi
### 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 ###

But after rebooting and selecting "Arch Linux (on /dev/sdb2)" I get:

error: file `/boot/vmlinuz-linux` not found.
error: you need to load the kernal first.

Is os-prober looking at the wrong partition? Shouldn't it should say Arch Linux (on /dev/sdb1) not /dev/sdb2?

Or just punch up a correct entry yourself

Ok, I'll try that

Offline

#6 2023-07-11 17:19:48

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,237

Re: [SOLVED] os-prober not detecting second Arch install

It's loading the wrong root part... It should load the second ESP as grubs root, but use the uuid of the root partition for the initramfs line, it doesn't seem to grok the semantics of the second partition

Offline

#7 2023-07-12 22:50:31

drewk
Member
Registered: 2021-09-01
Posts: 9

Re: [SOLVED] os-prober not detecting second Arch install

Custom grub.cfg is working perfect. From UEFI I booted into the other arch and copied its menu entry in the 10_linux section, then rebooted into my primary arch and pasted it into /etc/grub.d/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 'Arch Linux SANDBOX' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-e6245030-334d-46f8-b304-660e2e5696fb' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod fat
	set root='hd1,gpt1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1  61C3-721C
	else
	  search --no-floppy --fs-uuid --set=root 61C3-721C
	fi
	echo	'Loading Linux linux ...'
	linux	/vmlinuz-linux root=UUID=e6245030-334d-46f8-b304-660e2e5696fb rw  loglevel=3 splash
	echo	'Loading initial ramdisk ...'
	initrd	/intel-ucode.img /initramfs-linux.img
}

Then I just changed the menu entry title and regenerated the config. It's unfortunate about os-prober not working, thankfully the manual configuration was easy enough

Offline

Board footer

Powered by FluxBB