Subject: Re: bug#28445: match-error in 'device-sexp->device' while building system

From: Mark H Weaver <[email-masked]>
Date: Mon, 18 Sep 2017 13:29:14 -0400

Hi Ludovic,

[email-masked] (Ludovic Courtès) writes:

> Mark H Weaver <[email-masked]> skribis:
>
>> At least for some transition period, it would be good to find a way to
>> cope with (store (device #f)) in some older system generations.
>>
>> What do you think?
>
> I think the patch below, which is Marius’ patch + adjusts
> ‘read-boot-parameters’ to cope with #f store-device, should solve the
> issue.
>
> Could you check if it works for you?

I applied this, and my system boots, but there are errors that occur
within GRUB that didn't happen before this batch of recent commits (the
ones I mentioned reverting earlier).

At two points during boot, GRUB prints an error (paraphrasing): no such
device: /dev/mapper/jojen-root.

* It happens once after entering my disk encryption password for GRUB,
  but before the menu is displayed.

* It happens again after selecting the desired menu item, but before
  loading the kernel.

The origin of these problems can be seen in the diff between my old
grub.cfg and the new one:

--8<---------------cut here---------------start------------->8---
--- /gnu/store/5vw8y4kyl0606wg0sgh8xsm2czshdprl-grub.cfg	1969-12-31 19:00:01.000000000 -0500
+++ /boot/grub/grub.cfg	2017-09-18 05:19:39.240461714 -0400
@@ -21,7 +21,7 @@
 }
 
 # Set 'root' to the partition that contains /gnu/store.
-search --file --set /gnu/store/21ngnlx9k0x9x2jj1px7mdlb4j6mzz6x-grub-2.02/share/grub/unicode.pf2
+search --label --set /dev/mapper/jojen-root
 
 if loadfont /gnu/store/21ngnlx9k0x9x2jj1px7mdlb4j6mzz6x-grub-2.02/share/grub/unicode.pf2; then
   setup_gfxterm
--8<---------------cut here---------------end--------------->8---

Above, it changed from a working method to a non-working method to find
the encrypted partition within GRUB.

--8<---------------cut here---------------start------------->8---
@@ -42,15 +42,20 @@
 set default=0
 set timeout=5
 menuentry "GNU with Linux-Libre 4.13.2 (beta)" {
-  search --file --set /gnu/store/r64778rd9s1hy1yjbvlr17yq16vhwblq-linux-libre-4.13.2/bzImage
-  linux /gnu/store/r64778rd9s1hy1yjbvlr17yq16vhwblq-linux-libre-4.13.2/bzImage --root=/dev/mapper/jojen-root --system=/gnu/store/3lprqk4zdwhz4lvryhalymf2xks8f6yr-system --load=/gnu/store/3lprqk4zdwhz4lvryhalymf2xks8f6yr-system/boot
-  initrd /gnu/store/rqn1zs2pjbk54b1mpsy98qwsbkxj94q5-raw-initrd/initrd
+  search --label --set /dev/mapper/jojen-root
+  linux /gnu/store/r64778rd9s1hy1yjbvlr17yq16vhwblq-linux-libre-4.13.2/bzImage --root=/dev/mapper/jojen-root --system=/gnu/store/7i0f249xi92fjf4r6990s2rmlhjhiq9w-system --load=/gnu/store/7i0f249xi92fjf4r6990s2rmlhjhiq9w-system/boot
+  initrd /gnu/store/0cpz988g0yvq4wimiqw2zd7cc18ak4p4-raw-initrd/initrd
 }
--8<---------------cut here---------------end--------------->8---

and here, the same issue with GRUB's "search" command previously
searching for a file, and now searching for a label that doesn't exist.

Here's what ends up in the 'parameters' file of my new system:
  (store (device "/dev/mapper/jojen-root") (mount-point "/"))

It manages to boot anyway, but it pauses and prompts me to press a key
(to make sure I saw this error) twice during early boot.  It would be
good to handle this root filesystem configuration more gracefully.

Or is my OS configuration to blame?

     Thanks!
       Mark