Grub can't find boot image file on /home

Hi I’m new to OpenSUSE but after a few flight hours I like it. A lot to learn coming from Debian.

I’ve installed Slowroll on / and have /home on a separate ext4 partition.
On /home I have a boot image file chromeos.img with ChromeOS.

I’ve created and booted this image file in Debian on the same laptop. And I moved the image file and the same grub.d entry file to OpenSUSE. Of course did the grub update.

To my surprise, the image cannot be booted by grub on OpenSUSE.

I can boot OpenSUSE and Windows, however when I choose ChromeOS, I get grub-core errors of which 2 related to not to find the boot image file on /home:

  1. grub-core… search.c:316 … no such device … /home/ed/Brunch/chromeos.img
  2. grub-core/fs/btrfs.c:2159: file ‘/home/ed/Brunch/chromeos.img’ not found

Based on reference to btrfs.c in grub error 2 it seems that OpenSUSE grub expects the image file to be located in / and cannot be on another partition with ext4.
Any help is appreciated.

Please find below the grub entry file script:

#!/bin/sh
exec tail -n +3 $0

menuentry 'Brunch' --class 'brunch' {
	
	rmmod tpm
	img_path="/home/ed/Brunch/chromeos.img"
	img_uuid="84ba7bbb-66ee-4bef-88dd-1c7fe16de3d3"
	search --no-floppy --set=root --file ${img_path}
	loopback loop ${img_path}
	source (loop,12)/efi/boot/settings.cfg
	if [ -z ${verbose} ] -o [ ${verbose} -eq 0 ]; then
		linux (loop,7)${kernel} boot=local noresume noswap loglevel=7 options=${options} chromeos_bootsplash=${chromeos_bootsplash} ${cmdline_params} \
			cros_secure cros_debug img_uuid=${img_uuid} img_path=${img_path} \
			console= vt.global_cursor_default=0 brunch_bootsplash=${brunch_bootsplash} quiet
	else
		linux (loop,7)${kernel} boot=local noresume noswap loglevel=7 options=${options} chromeos_bootsplash=${chromeos_bootsplash} ${cmdline_params} \
			cros_secure cros_debug img_uuid=${img_uuid} img_path=${img_path}
	fi
	initrd (loop,7)/lib/firmware/amd-ucode.img (loop,7)/lib/firmware/intel-ucode.img (loop,7)/initramfs.img
}

This is just an educated guess, since I’m not a regular image user, but I would expect with home being a separate filesystem you need:

`img_path="/ed/Brunch/chromeos.img"`

Show output of

findmnt --real -u -o +uuid
ed@chuwi-tw:~> findmnt --real -u -o +uuid
TARGET SOURCE FSTYPE      OPTIONS                                                                                                   UUID
/      /dev/nvme0n1p5[/@/.snapshots/1/snapshot]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=265,subvol=/@/.snapshots/1/snapshot                 83decb12-928e-4c44-a517-5474f94826a0
├─/run/user/1000/doc
│      portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000                                                       
├─/root
│      /dev/nvme0n1p5[/@/root]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/@/root                                  83decb12-928e-4c44-a517-5474f94826a0
├─/boot/grub2/i386-pc
│      /dev/nvme0n1p5[/@/boot/grub2/i386-pc]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=263,subvol=/@/boot/grub2/i386-pc                    83decb12-928e-4c44-a517-5474f94826a0
├─/.snapshots
│      /dev/nvme0n1p5[/@/.snapshots]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=264,subvol=/@/.snapshots                            83decb12-928e-4c44-a517-5474f94826a0
├─/boot/efi
│      /dev/nvme0n1p4
│             vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 54BC-1F2A
├─/opt /dev/nvme0n1p5[/@/opt]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=261,subvol=/@/opt                                   83decb12-928e-4c44-a517-5474f94826a0
├─/boot/grub2/x86_64-efi
│      /dev/nvme0n1p5[/@/boot/grub2/x86_64-efi]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=262,subvol=/@/boot/grub2/x86_64-efi                 83decb12-928e-4c44-a517-5474f94826a0
├─/srv /dev/nvme0n1p5[/@/srv]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/@/srv                                   83decb12-928e-4c44-a517-5474f94826a0
├─/var /dev/nvme0n1p5[/@/var]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@/var                                   83decb12-928e-4c44-a517-5474f94826a0
├─/usr/local
│      /dev/nvme0n1p5[/@/usr/local]
│             btrfs       rw,relatime,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@/usr/local                             83decb12-928e-4c44-a517-5474f94826a0
└─/home
       /dev/nvme0n1p8
              ext4        rw,relatime,data=ordered                                                                                  cfb717fb-82ca-4f28-a322-f885360f5da8

p5 is root, p8 is /home.
The img_uuid mentioned in grub entry is the part-UUID of p8, needed as chromeOS boot parameter

Before the grub menu is shown I can’t read a flashing message, also not by putting this in grub.cfg:

set default=0
sleep --interruptible --verbose 60

That is not going to work. grub is not aware of your /etc/fstab or where /home is mounted. The path /home/ed/... does not include device part and so it relative to the current $root which is by default set to the location of /boot/grub2, i.e. in your case device with / filesystem.

You need to include device where this image is located. Something like

search --fs-uuid --set home cfb717fb-82ca-4f28-a322-f885360f5da8
img_path=($home)/ed/Brunch/chromeos.img

error handling remains as exercise. See info grub2 for other search command options.

After a few trials, first removing the search error by using fs-uuid instead of file, I could find the culprit, which is the file name.

Although the same grub2 version on Debian 12 and Tumbleweed, the filesystems are different, which make config file break.

Here the script that works on TW

menuentry 'Brunch' --class 'brunch' {
	rmmod tpm
#	img_path="/home/ed/Brunch/chromeos.img"
	img_path="/ed/Brunch/chromeos.img"
	img_uuid="84ba7bbb-66ee-4bef-88dd-1c7fe16de3d3"
	search --no-floppy --set=root --file ${img_path}
	loopback loop ${img_path}

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.