libguestfs (as of 1.41.5) assumes the rpmdb is in Berkeley DB format - it looks for particular filenames and then uses db_dump to process those. This assumption is not valid since rpm >= 4.13, as rpm supports multiple different database backends. The only legitimate way to access the rpmdb is through librpm API.
I guess we might put librpm into the appliance. (Actually it turns out the rpm-libs is already in the appliance - I'm not sure what is pulling it in). But can librpm be pointed to an RPM db in a subdirectory / mountpoint?
Sure, librpm simply uses %{_dbpath} macro to locate the database, there's even a cli shortcut for changing it (--dbpath /some/place)
I mean is this settable from the librpm API? Anyway I guess this topic needs investigation.
Oh, of course it is. rpm cli is just any other librpm user really. Macros can be defined and undefined from the API, see rpmPushMacro()/rpmPopMacro()
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle. Changing version to 32.
Fixed in libguestfs 1.45.3.