In RHEL7 kvm host, running virt-customize/virt-sysprep command against a RHEL8 KVM image fails.
Environment
- Red Hat Enterprise Linux (RHEL) 7 KVM host
- Red Hat Enterprise Linux (RHEL) 7 virt-customize
- Red Hat Enterprise Linux (RHEL) 7 virt-sysprep
- Red Hat Enterprise Linux (RHEL) 8 KVM image
Issue
- In RHEL7 kvm host, running virt-customize/virt-sysprep command against a RHEL8 KVM image fails with the following error message.
$ sudo virt-customize -a rhel-8.0.qcow2 --root-password password:SomePassword12345!
virt-customize: warning: mount: mount exited with status 32: mount: wrong
fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so. (ignored)
virt-customize: error: libguestfs error: is_dir: is_dir_stub: you must call
'mount' first to mount the root filesystem
If reporting bugs, run virt-customize with debugging enabled and include
the complete output:
virt-customize -v -x [...]
# virt-sysprep -a <RHEL8 image>
[ 0.0] Examining the guest ...
virt-sysprep: warning: mount_options: mount exited with status 32: mount:
wrong fs type, bad option, bad superblock on /dev/mapper/rhel-root,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so. (ignored)
virt-sysprep: warning: mount_options: mount: /boot: mount point is not a
directory (ignored)
[ 2.8] 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 [...]
Resolution
Customizing RHEL8 KVM image on RHEL7 KVM host is not supported. Copy the RHEL8 KVM image to a RHEL8 KVM host and run virt-customize/virt-sysprep on the host.
Unsupported Workaround
The following information has been provided by Red Hat, but is outside the scope of the posted This content is not included.Service Level Agreements and support procedures (Production Support - Red Hat Customer Portal). The information is provided as-is and any configuration settings or installed applications made from the information in this article could make the Operating System unsupported by Red Hat Global Support Services. The intent of this article is to provide information to accomplish the system's needs. Use of the information in this article at the user's own risk.
-
Download and unpack the libguestfs binary appliance
$ sudo -i # curl -O https://download.libguestfs.org/binaries/appliance/appliance-1.53.4.tar.xz # export LIBGUESTFS_BACKEND=direct # tar xvfJ appliance-1.40.1.tar.xz -C $HOME/ -
Point LIBGUESTFS_PATH to the path
# export LIBGUESTFS_PATH=$HOME/appliance/ -
Run virt-customize command
# virt-customize -a rhel-8.0.qcow2 --root-password password:SomePassword12345!
Root Cause
This issue is caused by the forward compatibility of xfs file system between RHEL7 and RHEL8.
Xfs file system in RHEL8 uses reflink and sparse files, but RHEL7 kernel does not understand them and refuses to mount it.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.