On 20/03/2019 00:43, Bruce Dubbs wrote:
>
> After a long thread on -support today I did a test build on a USB drive
> today. These are some observations.
>
> The USB drive was /dev/sdg. I only had one partition on the MSDOS style
> partition table.
>
> From the host I installed GRUB with
> grub-install /dev/sdg
>
> To boot, I needed a grub.cfg file:
>
> # Begin /boot/grub/grub.cfg
> set default=0
> set timeout=5
>
> insmod ext2
> set root=(hd0,1)
>
> menuentry "GNU/Linux, vmlinuz-5.0-lfs-SVN-20190305" {
> linux /boot/vmlinuz-5.0-lfs-SVN-20190305 rootdelay=10
> root=/dev/sdg1 ro
> }
>
> When booting, I had to tell the system firmware (BIOS) to boot from the USB
> drive.
>
> In grub.cfg the line
>
> set root=(hd0,1)
>
> refers to GRUB's view of the system where it thinks the boot drive is hd0.
> This allows GRUB to find the kernel, load it and then start it.
>
> The kernel, on the other hand, searches the entire system for hard drives and
> identifies them as it finds them. In my case I have six hard drives in the
> system. sda, sdb, sdc, sdd, sde, and sdf. The USB drive is thus identified as
> sdg. The linux boot line then requires
>
> root=/dev/sdg1 rootdelay=10
>
> The rootdelay is needed so the system has time to find the USB drive, but
> /dev/sdg1 is needed for the kernel to find the root partition. The fstab file
> also needs the same drive designations as the kernel command line.
>
> If this USB drive is inserted into another system with a different disk
> configuration, then these values will need to be changed. The workaround is
> to use UUID or PARTUUID designations. PARTUUID is only available on GPT
> partition tables [sic], but plain UUID requires an initrd to be created and
> loaded by GRUB.
>
Good summary. I think one of the issues that occured is that the kernel on the
USB stick did not have all the drivers to be able to recognize all the drives
that the host had recognized (sorry for English, hope it is clear
nevertheless). So the host kernel was seeing the USB drive as /dev/sde, while
the lfs kernel could see it as /dev/sdd.
I had not thought of grub seeing the drive it sits on as hd0... That makes
sense.
Pierre
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
Do not top post on this list.
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
http://en.wikipedia.org/wiki/Posting_style