通过Pacman安装的virt-manager无法创建虚拟机问题求助
Looks like you're hitting a dependency mismatch issue with the libosinfo library, which virt-manager relies on to load OS profiles for virtual machines. The error TypeError: could not get a reference to type class when initializing Libosinfo.Loader() almost always points to a broken, outdated, or mislinked libosinfo installation on your Parabola system.
Since the Flatpak version works (it bundles its own dependencies), the problem is definitely with your system-level packages. Let's walk through the most reliable fixes:
1. Reinstall libosinfo and its core dependencies
Corrupted library files or incomplete installations are the most common cause here. Run these commands to refresh and reinstall the affected packages:
# First, update your system to ensure you're getting the latest package versions sudo pacman -Syu # Reinstall libosinfo and the OS info database, overwriting any conflicting files sudo pacman -S --overwrite '*' libosinfo osinfo-db
The --overwrite '*' flag forces pacman to replace any conflicting or corrupted files that might be blocking virt-manager from accessing the library.
2. Validate and update the osinfo database
Sometimes the OS profile database itself is outdated or improperly populated, which breaks virt-manager's ability to list available OS options. Fix this with:
# Check for database validity issues sudo osinfo-db-validate # Update the database to the latest libre-compatible profiles sudo osinfo-db-update
This ensures virt-manager has access to all the necessary metadata to populate the VM creation dialog.
3. Verify package integrity
If reinstalling didn't resolve the issue, check if the libosinfo package has any corrupted or missing files:
pacman -Qkk libosinfo
This command lists any files that are modified, missing, or have checksum mismatches. If you see errors, repeat step 1—this time the overwrite should fix the corrupted files. Also, make sure you don't have any AUR versions of libosinfo installed (they can conflict with the official Parabola package).
4. Fix GObject Introspection bindings
The error occurs in the Python context, so the gobject-introspection bindings for libosinfo might be broken. Reinstalling the introspection package can resolve this:
sudo pacman -Syu gobject-introspection
After running this, close all open virt-manager windows completely and restart the application to apply the fix.
Final Note
Parabola's focus on free software means some packages might differ slightly from upstream Arch. If none of these steps work, double-check that you're using only official Parabola repositories (no third-party repos that might ship modified versions of libosinfo).
After each step, make sure to fully quit virt-manager (not just minimize) and restart it before testing the VM creation dialog again.
内容来源于stack exchange

