On 05/17/22 15:09, Richard W.M. Jones wrote:
On Tue, May 17, 2022 at 01:10:32PM +0200, Laszlo Ersek wrote:
On 05/17/22 12:59, Richard W.M. Jones wrote:
These devices can be left around by grub2 when it runs the osprober tool after we run “/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg”. They are read-only mirrors of existing filesystems. These confuse later steps in conversion, specifically fstrim.
Reported-by: Ming Xie Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2003503 --- convert/linux_bootloaders.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/convert/linux_bootloaders.ml b/convert/linux_bootloaders.ml index a70b65a41c..7c5fb0be3f 100644 --- a/convert/linux_bootloaders.ml +++ b/convert/linux_bootloaders.ml @@ -345,7 +345,14 @@ object (self) method remove_console = self#grub2_update_console ~remove:true
method update () = - ignore (g#command [| grub2_mkconfig_cmd; "-o"; grub_config |]) + ignore (g#command [| grub2_mkconfig_cmd; "-o"; grub_config |]); + + (* Grub2 runs osprober which sometimes leaves around read-only + * device-mapper maps covering existing filesystems. These + * confuse later steps (especially fstrim). So just delete + * any if found. (RHBZ#2003503). + *) + ignore (g#command [| "bash"; "-c"; "rm -f /dev/mapper/osprober-*" |])
method get_config_file () = grub_config
I'd like to make this change (on top):
- ignore (g#command [| "bash"; "-c"; "rm -f /dev/mapper/osprober-*" |]) + ignore (g#command [| "sh"; "-c"; "rm -f /dev/mapper/osprober-linux-*" |])
Bash might in theory not exist. I guess it's unlikely, but POSIX defines 'sh' so we know that must exist. It's not as if we're using any bash features here.
The other part of the change is that the device nodes created by the old & buggy osprober were always called "osprober-linux-*", so we may as well be more specific about that.
Sure; both are good ideas.
I still cannot reproduce this bug locally. I can force grub2-mkconfig to run -- creating a guest like this is sufficient:
$ virt-builder rhel-8.4 --edit '/etc/sysconfig/grub: s|^GRUB_CMDLINE_LINUX="|GRUB_CMDLINE_LINUX="resume=/dev/sda1 |'
However it doesn't reproduce the bug observed.
I think it's OK; you did test the fix, just on an image from someone else. And we have confirmation from multiple independent tickets that this symptom exists. Thanks! Laszlo