[Libguestfs] [PATCH v2v 2/2] convert: Remove /dev/mapper/osprober-* devices left around by grub2
Richard W.M. Jones
rjones at redhat.com
Tue May 17 11:18:38 UTC 2022
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
> >
>
> Hmm... I'm not sure why this is better than "dmsetup remove", but it
> does not really matter. We need these nodes to disappear only for the
> remainder of the conversion -- so command that effects that suffices!
>
> Reviewed-by: Laszlo Ersek <lersek at redhat.com>
Yeah, I'm not really sure what I was thinking there. I certainly
*meant* to use dmsetup remove, but maybe ... it's accidentally better?
The problem with running dmsetup is that we have to run the guest
command, which might not exist.
Fun fact I found when investigating this. Upstream os-prober dropped
the whole device mapper / dmsetup / osprober-linux-* stuff back in
2017. The current code doesn't mention osprober-linux-* at all.
So I guess the version in this RHEL 8 guest is quite old.
Since I'm still testing the (above) version of this patch, let's see
if "rm" actually works before doing any further work on this.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list