On 12/15/21 16:14, Laszlo Ersek wrote:
Before posting v2, I intended to test it :) , so I installed a new RHEL5 guest, and tried to run virt-v2v (with the v2 patch) on it:
virt-v2v -i libvirt -o local -os ~/output rhel5.11
Unfortunately, things break before my code gets a chance to run; here:
(* Fail early if i_apps is empty. Certain steps such as kernel * detection won't work without this. If the list is empty it * likely indicates that libguestfs inspection is broken for * this guest. See for example RHBZ#1965147. *) if inspect.i_apps = [] then error (f_"inspection of the package database failed for ...
This seems to come from an empty apps list, from "convert/inspect_source.ml", which in turn invokes "g#inspect_list_applications2".
I turned to guestfish, and ran the following manually:
inspect-os inspect-get-mountpoints /dev/VolGroup00/LogVol00 inspect-list-applications2 /dev/VolGroup00/LogVol00
Indeed the last command does not return anything. I turned on "verbose" and "trace" then, and then I see a failure in the daemon:
libguestfs: trace: inspect_list_applications2 "/dev/VolGroup00/LogVol00" libguestfs: trace: inspect_get_type "/dev/VolGroup00/LogVol00" libguestfs: trace: inspect_get_type = "linux" libguestfs: trace: inspect_get_package_format "/dev/VolGroup00/LogVol00" libguestfs: trace: inspect_get_package_format = "rpm" libguestfs: trace: internal_list_rpm_applications \x1b[31;1merror: \x1b[0m\x1b[1mUnable to open /usr/lib/rpm/rpmrc for reading: No such file or directory. \x1b[0m\x1b[31;1merror: \x1b[0m\x1b[1mno dbpath has been set \x1b[0m\x1b[31;1merror: \x1b[0m\x1b[1mcannot open Packages database in \x1b[0mlibrpm returned 0 installed packages libguestfs: trace: internal_list_rpm_applications = <struct guestfs_application2_list(0)> libguestfs: trace: inspect_list_applications2 = <struct guestfs_application2_list(0)>
The file "/usr/lib/rpm/rpmrc" absolutely exists in the guest (I booted it up separately, and checked it).
It seems that "internal_list_rpm_applications" [daemon/rpm.ml] calls chroot, and uses a child project -- can that be related to the issue?
Anyway, I think I'll post v2, just saying that I could not actually test it.
BTW my libguestfs has been last built at commit d829f9ff9ae0 ("daemon/listfs: don't call "sgdisk -i" on bogus MBR partition table entry", 2021-11-26). Thanks Laszlo