libguestfs / virt-v2v

Virt-v2v converts guests from foreign hypervisors to run on KVM
GNU General Public License v2.0
97 stars 38 forks source link

Issues running `make check` #34

Closed bsanders closed 1 year ago

bsanders commented 1 year ago

I've built virt-v2v (2.2.0 from downloads on libguestfs.org, but also from git head of tree, 2.3.5, and 2.2.0), but every build fails make check at the same spot. I'm wondering if I have a too new/old version of the guestfs perl module?

All builds are done on an Ubuntu 22.04 system.

perl module in question is from the distro and is:

Package: libguestfs-perl
Version: 1:1.46.2-10ubuntu3

make check error:

SRCDIR=. LAYOUT=partitions-md ../../run --test ./make-fedora-img.pl
md_create: mdadm: bootdev: mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument at ./make-fedora-img.pl line 103.
/root/stable-v2v/virt-v2v-2.2.0/run: command failed with exit code 22
make[3]: *** [Makefile:921: stamp-fedora-md.img] Error 22
make[3]: Leaving directory '/root/stable-v2v/virt-v2v-2.2.0/test-data/phony-guests'
make[2]: *** [Makefile:734: check-am] Error 2
make[2]: Leaving directory '/root/stable-v2v/virt-v2v-2.2.0/test-data/phony-guests'
make[1]: *** [Makefile:629: check-recursive] Error 1
make[1]: Leaving directory '/root/stable-v2v/virt-v2v-2.2.0/test-data'
make: *** [Makefile:849: check-recursive] Error 1
rwmjones commented 1 year ago

It seems to be failing in the script here: https://github.com/libguestfs/virt-v2v/blob/c5c9aa2f77ff65e986e05023d232d6bad3caaace/test-data/phony-guests/make-fedora-img.pl#L103 which is calling: https://github.com/libguestfs/libguestfs/blob/188c5f7d939c9f3f753f400144035a77c9fb59ab/daemon/md.c#L96

but exactly why that fails is a mystery. I suggest:

$ LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 make -C test-data/phony-guests stamp-fedora-md.img 

which should print out a lot more detail.

bsanders commented 1 year ago

That's about as far as I followed it as well before thinking that I'd done something wrong and needed an adult.

It definitely printed more, so I put it in a pastebin: https://pastebin.com/Ukg5sT9M

Let me know if there's a better place to drop that data.

Here's a snippet that's got the nearby lines

commandrvf: stdout=n stderr=y flags=0x0
commandrvf: mdadm --create --run bootdev --level raid1 --raid-devices 2 /dev/sda1 /dev/sdb1
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: Defaulting to version 1.2 metadata
[   16.145753] md: personality for level 1 is not loaded!
mdadm: RUN_ARRAY failed: Invalid argument
[   16.147849] md: md127 stopped.
guestfsd: error: mdadm: bootdev: mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument
guestfsd: => md_create (0x12b) took 0.57 secs
libguestfs: trace: md_create = -1 (error)
md_create: mdadm: bootdev: mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument at ./make-fedora-img.pl line 103.
libguestfs: trace: close
libguestfs: closing guestfs handle 0x559335e08ad0 (state 2)
libguestfs: trace: internal_autosync
guestfsd: <= internal_autosync (0x11a) request length 40 bytes
umount-all: /proc/mounts: fsname=/dev/root dir=/ type=ext2 opts=rw,noatime freq=0 passno=0
umount-all: /proc/mounts: fsname=/proc dir=/proc type=proc opts=rw,relatime freq=0 passno=0
umount-all: /proc/mounts: fsname=/sys dir=/sys type=sysfs opts=rw,relatime freq=0 passno=0
umount-all: /proc/mounts: fsname=/dev dir=/dev type=devtmpfs opts=rw,relatime,size=629804k,nr_inodes=157451,mode=755,inode64 freq=0 passno=0
umount-all: /proc/mounts: fsname=/dev/pts dir=/dev/pts type=devpts opts=rw,relatime,mode=600,ptmxmode=000 freq=0 passno=0
umount-all: /proc/mounts: fsname=shmfs dir=/dev/shm type=tmpfs opts=rw,relatime,inode64 freq=0 passno=0
umount-all: /proc/mounts: fsname=tmpfs dir=/run type=tmpfs opts=rw,nosuid,relatime,size=252832k,mode=755,inode64 freq=0 passno=0
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/sdb
rwmjones commented 1 year ago

The crucial bit is indeed:

commandrvf: mdadm --create --run bootdev --level raid1 --raid-devices 2 /dev/sda1 /dev/sdb1
...
[   16.145753] md: personality for level 1 is not loaded!
mdadm: RUN_ARRAY failed: Invalid argument

Notice how the RAID1 module isn't loaded for some unclear reason. Apparently that is kernel/drivers/md/raid1.ko*. So I guess first of all make sure the module exists on the host. Then you could try modifying the script to add:

$g->modprobe ("raid1");

just before this line of code: https://github.com/libguestfs/virt-v2v/blob/c5c9aa2f77ff65e986e05023d232d6bad3caaace/test-data/phony-guests/make-fedora-img.pl#L103

If that fixes it then it's something to do with autoloading of modules not working. If it doesn't fix it then it's a host kernel or module problem of some sort.

bsanders commented 1 year ago

I did note that line - had no idea what the "personality" would be.

Relevant snip after inserting the modprobe

commandrvf: modprobe raid1
modprobe: FATAL: Module raid1 not found in directory /lib/modules/5.15.0-1042-kvm
guestfsd: error: modprobe: FATAL: Module raid1 not found in directory /lib/modules/5.15.0-1042-kvm
libguestfs: trace: modprobe = -1 (error)
modprobe: modprobe: FATAL: Module raid1 not found in directory /lib/modules/5.15.0-1042-kvm at ./make-fedora-img.pl line 103.
libguestfs: trace: close

Sure enough, modprobe raid1 on my building/host system (itself a "minimal install" VM) didn't work. So I re-created the build environment but on a non-minimal VM and now it's working (well, make check is proceding). Other tests are failing, but I assume there's just more dependencies I need to install - if I run into problems I can't work out I'll open a separate issue.

Thanks for your help!