Web lists-archives.com

Re: Possibly erroneous "device not present" message during boot

On Thu 13 Apr 2017 at 20:05:22 +0200, Pascal Hambourg wrote:

> 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.

$root not being set bothered me. Could this (from grub-pc's changelog.gz)
be the reason?

 * util/grub.d/00_header.in: Only set root variable when GRUB_DRIVE
   could be identified by update-grub.

A way to identify how the OS sees the card is to use 'lsblk' before
and after inserting the card in the card reader.

What GRUB makes of the OS device could be seen with

 grub-probe OS_device  (/dev/sdc1, say)

'Twould be nice to know.

> (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.

The ultimate outcome gives every sign of success. However, strange
(and very often unwelcome) things can happen when the kernels on
the HDD and the booting device are different. Upgrading the HDD OS
to Stretch while leaving the distribution on the card at Jessie
would very likely not lead to a good experience.