Le 13/04/2017 à 19:33, Richard Owlett a écrit :
On 04/13/2017 10:48 AM, Pascal Hambourg wrote:
USB drive ? Then (hd1) is not the SD card ? If you boot with no USB
drive plugged in, there is no (hd1), right ?
Correct on all counts. IIUC the SD card slot is connected to a USB hub.
When not the booted system, it automatically mounted in the same
apparent manner as a USB flash drive.
I don't think so, because it appears as /dev/mmcblk0 in grub.cfg, i.e. a
MMC/SD card. A USB mass storage device would appear as /dev/sdb or so.
Then the SD card does not
appear as a usable device for GRUB and my twisted theory may still be
correct after all.
Ok then, here is my full theory. You're not going to like it.
We now know that the BIOS does not expose the SD card so GRUB cannot see
it and the search command fails and prints the error message.
But then how does the system on the SD card boot ?
The purpose of the search command is to set the $root variable value
with the device havind the searched UUID. As it fails, the variable
remains unmodified and keeps its previous value. The menu entry does not
set a default value for $root (which is rather unusual in my
experience), so the current value comes from a previous assignement in
grub.cfg. It's probably the root device of the system owning GRUB on the
hard disk drive.
(In GRUB's shell, you can print the $root value with the "set" command,
and check that this partition contains a
/boot/grub/vmlinuz-3.16.0-4-686-pae file directory with the command "ls
/boot/grub".)
GRUB uses $root as a default device used in paths which do not specify a
device, such as the ones in the linux and initrd commands of the menu
entry. By chance, it seems that this location contains the same kernel
as the one on the SD card, so GRUB can load and boot it from the hard
disk drive. But GRUB passes the SD card partition as the root device
root=/dev/mmcblk0p1 to the kernel command line, so the kernel comes from
the disk and the root filesystem comes from the SD card. Unlike GRUB,
the kernel does not rely on the BIOS to access the SD card.
David is right : you don't really boot from the SD card.
GRUB is on the HDD. The kernel is on the HDD. Only the root filesystem
is on the SD card.