Explanation about grub's search command in chapter 8.4 of lfs book is wrong
linuxscratch at gmail.com
Tue Jul 6 08:55:17 PDT 2010
A possible search usefulness:
Or, other search methods to deduce the root filesystem for the
kernel's "root=" parameter, or where the kernel is.
* Suppose that the grub directory is a subdirectory of boot
* Suppose that the boot directory is a subdirectory of root /
* Suppose that the kernel name is vmlinux-2.6.33 and it is located in boot
* This search command will find which (grub syntax) partitions contain
search -n -f /boot/vmlinux-2.6.33
* The result may show a list if it exist on multiple partitions as:
* You may be clever and deduce that (hd4,10) is what you want.
* You may find out which (kernel syntax) that drive is with:
* Cat may return information such as:
* It can then be deduced that the (kernel syntax) root partition is:
* So the linux line can have the parameter:
* The full linux line can then be:
linux (hd4,10)/boot/vmlinux-2.6.33 root=/dev/sdd10
* If boot is on a separate partition, omit the "/boot" component when
searching for the partition that holds the kernel.
* If boot is on a separate partition, you might also search for a
distinct filename, that is known to be on the system's root /
filesystem, in order to determine the "root=" parameter. At least it
can narrow down the choices.
This can be useful when struggling to boot from the grub2 command line
while struggling to producing a working grub.cfg. I have struggled
many times and I always appreciate the existence of a tool that can
help sort things out. Search is not limited to searching for UUID.
What I might be trying to say is that grub2 has a command that can
operate like the grub legacy command "find" and the name of that
command is "search".
To find what partition(s) a filename exist on, the search command is useful:
search -n -f filename
In long-param-notation that is:
search --no-floppy --file=filename
Thus it is technically incorrect to imply that "[ ... the search ...]
command only sets an internal GRUB variable used to find the kernel
It might be more precise to say something like:
* The above search lines set the GRUB variable "root" by searching
--fs-uuid, which is not considered standard practice for LFS systems.
The above set root commands are sufficient to establish the GRUB
Just reporting the discovery.
But, whatever you think.
More information about the lfs-dev