[solved, partly] Re: Grub menu entry for a system on a second drive.
Tim & all,
From: Tim Woodall <debianuser@woodall.me.uk>
Date: Fri, 25 Oct 2024 22:35:50 +0100 (BST)
> It's possibly not reading the grub.cfg you think it is reading. I've
> hit this problem before - IIRC grub uses the grub.cfg from the *first*
> place it finds one - this can even be a partition (or in my case a LV)
> that is not used anywhere on any system.
That's it! The working system is in (hd0,gpt1) and update-grub2 was
updating (hd0,gpt1)/boot/grub/grub.cfg. Grub2 was displaying the menu
according to (hd0,gpt2)/boot/grub/grub.cfg which hadn't changed since
an earlier installation.
Therefore booted into (hd0,gpt1), as usual, and execute "grub-install
/dev/sda". The fresh grub refers to (hd0,gpt1)/boot/grub/grub.cfg
which has the stanza from (hd0,gpt1)/etc/grub.d/40_custom as intended.
After that, a further problem. The grub ls command didn't show the
USB attached drive containing the Void Linux system. A Web search
found mention of grub command nativedisk which I added.
cat /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 "Void linux"{
insmod part_gpt
insmod ext2
echo 'Grub is running nativedisk to allow access to a USB store.'
nativedisk
echo 'These disks are accessible.'
ls
echo 'Setting root part.'
set root='(usb2,gpt6)'
echo 'Booting Linux.'
linux /boot/vmlinuz-6.6.56_2 root=UUID=e5c7eb47-8d4c-49da-9038-09c27e8e8990 ro
echo 'Loading ramdisk.'
initrd /boot/initramfs-6.6.56_2.img
}
The USB attached drive was then reported by grub2 ls. Then another
problem. Appears the drive doesn't respond quickly enough for the
linux command to succeed. Grub2 shows this.
...
Booting Linux.
error: error communication with USB Mass Storage device.
Loading ramdisk.
error: you need to load the kernel first.
Press any key to continue...
A bug in grub2 nativedisk? The USB 2.0 adapter is too slow? Replace
with a USB 3 adapter?
This setup is needed only to configure the USB connected system. When
working, the drive will be installed in another machine. Currently
speed isn't required. Any ideas for a software solution?
Thanks, ... P.
--
VoIP: +1 604 670 0140
work: https://en.wikibooks.org/wiki/User:PeterEasthope
Reply to: