On Sun, Dec 10, 2023 at 09:42:04PM -0500, Stefan Hajnoczi wrote:
> Hi,
> virt-builder --update debian-12 fails with:
> Setting up grub-pc (2.06-13+deb12u1) ...
> grub-pc: Running grub-install ...
> /dev/vda does not exist, so cannot grub-install to it!
> You must correct your GRUB install devices before proceeding:
> 
>   DEBIAN_FRONTEND=dialog dpkg --configure grub-pc
>   dpkg --configure -a
> dpkg: error processing package grub-pc (--configure):
>  installed grub-pc package post-installation script subprocess
> returned error exit status 1
> 
> Any idea why /dev/vda isn't available to grub-install in virt-builder?
>
> I guess there might be some special guest device configuration for the
> guestfs appliance that runs virt-builder steps, causing the device to
> appear as something other than /dev/vda.

virt-builder templates are generated using whatever default disk
interface virt-install chooses:

https://github.com/rwmjones/guestfs-tools/blob/master/builder/templates/debian-12.virt-install-cmd

which is probably virtio-blk.

However the libguestfs appliance, where virt-builder does its updates
etc, uses virtio-scsi.

TBH I don't think this is solvable from virt-builder.  I would either
"hold" the grub-pc package (see below), or do the update as a
firstboot operation, or try to get Debian to fix it in the grub-pc
package, or maybe we could switch the template to use UEFI in future.

Holding the grub-pc package is something like:

  virt-builder .. --run-command 'apt-mark hold grub-pc' \
                  --update \
                  --firstboot-command 'apt-mark unhold grub-pc'

(https://manpages.ubuntu.com/manpages/trusty/man8/apt-mark.8.html)

> If I omit --update on the virt-builder command-line and run
> "dpkg-reconfigure grub-pc" inside the guest after importing with
> virt-install then it succeeds and /dev/vda exists.

You could also use --firstboot-command 'apt update && apt-dist-upgrade'
but you'll have to work out the extra environment variables you need
to make apt run non-interactively.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
Libguestfs mailing list -- guestfs@lists.libguestfs.org
To unsubscribe send an email to guestfs-le...@lists.libguestfs.org

Reply via email to