View Issue Details

IDProjectCategoryView StatusLast Update
0000065AlmaLinux-8-OTHERpublic2021-06-24 13:34
ReporterZnuff Assigned Tosfokin  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Summary0000065: virt-sysprep created images do not run the --firstboot script
DescriptionAs per title, we usually create our own templates/images for deployment.

Normally we just install the OS minimally, then install the packages that we need, dump to an image to a file, then run `virt-sysprep -a file.img --firstboot our-script.sh`.

This works fine with CentOS 8, Ubuntu 20 and so on -- as expected, on first boot the script runs via the installed `guestfs-firstboot.service` without issues.

On AlmaLinux 8.3 the initial script doesn't run at all.

I'm not sure what prevents it from running. I've run `virt-sysprep -v` against both CentOS 8 and AlmaLinux 8.3, and the output is the same in regards to the `--firstboot` part.
Steps To Reproduce1. Install AlmaLinux as a guest in a VM
2. Dump it to an image file (ie: qemu-img convert -O raw /block/device almalinux.img)
3. Run virt-sysprep on it -- virt-sysprep -a almalinux.img --firstboot our-script.sh
4. Deploy the newly created image in your environment
5. Expect our-script.sh to run via the installed guestfs-firstboot.service
6. Script doesn't run on first boot
Additional Informationhttps://libguestfs.org/virt-sysprep.1.html#firstboot-vs-script
TagsNo tags attached.
abrt_hash
URL

Activities

sfokin

2021-06-24 13:34

developer   ~0000281

Could you please help me with reproducing bug. I've had a problem on step 3.
Ive tried on Centos 8.4
===================
# virt-sysprep -a /media/sf_mount/almalinux.img --firstboot our-script.sh
[ 0.0] Examining the guest ...
virt-sysprep: error: libguestfs error: could not create appliance through
libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: internal error: qemu unexpectedly closed the
monitor: 2021-06-24T11:59:11.781802Z qemu-kvm: -blockdev
{"driver":"file","filename":"/media/sf_mount/almalinux.img","node-name":"libvirt-2-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}:
Could not open '/media/sf_mount/almalinux.img': Permission denied [code=1
int1=-1]

If reporting bugs, run virt-sysprep with debugging enabled and include the
complete output:

  virt-sysprep -v -x [...]
===================

i add LIBGUESTFS_BACKEND=direct and get
===================
# LIBGUESTFS_BACKEND=direct virt-sysprep -a /media/sf_mount/almalinux.img --firstboot our-script.sh
[ 0.0] Examining the guest ...
virt-sysprep: warning: mount_options: mount_options_stub:
/dev/mapper/cl-root: expecting a device name (ignored)
[ 21.2] Performing "abrt-data" ...
virt-sysprep: error: libguestfs error: glob_expand: glob_expand_stub: you
must call 'mount' first to mount the root filesystem

If reporting bugs, run virt-sysprep with debugging enabled and include the
complete output:

  virt-sysprep -v -x [...]
===================

Issue History

Date Modified Username Field Change
2021-04-21 16:14 Znuff New Issue
2021-04-24 09:26 alukoshko Assigned To => sfokin
2021-04-24 09:26 alukoshko Status new => assigned
2021-06-24 13:34 sfokin Note Added: 0000281