Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on start qemu socket when reinstall ('No KVM' message) #99

Open
insidesecurity-yhojann-aguilera opened this issue Aug 27, 2024 · 3 comments

Comments

@insidesecurity-yhojann-aguilera
Copy link

insidesecurity-yhojann-aguilera commented Aug 27, 2024

When reinstall Gnome Boxes from Flatpak can not install any vm, the app says "No KVM" but have KVM in host machine:

$ sudo kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

I try find the problem:

$ flatpak run org.gnome.Boxes
Ignoring /app/share/osinfo/.ref with missing '.xml' extension

(org.gnome.Boxes:2): GLib-CRITICAL **: 00:12:43.775: g_variant_new_string: assertion 'string != NULL' failed
Ignoring /app/share/osinfo/manifest.json with missing '.xml' extension

(org.gnome.Boxes:2): Boxes-WARNING **: 00:12:47.149: util-app.vala:448: Failed to execute: virsh capabilities
$ git clone https://gitlab.gnome.org/GNOME/gnome-boxes.git
cd gnome-boxes/
$ grep 'No KVM' . -iR
./NEWS:- Fix 'No KVM' warning visibility issues.
./src/vm-configurator.vala:        // No KVM-enabled guest caps :( We at least need Qemu
./src/assistant/assistant.vala:            show_error ("No KVM!\n");

In ./src/assistant/assistant.vala:

    private async void setup (string path) {
        if (!yield check_libvirt_kvm ()) {
            show_error ("No KVM!\n");
            return;
        }

Find the checker:

$ grep 'check_libvirt_kvm' . -iR
./src/util-app.vala:    public async bool check_libvirt_kvm () {

In ./src/util-app.vala:

    public async bool check_libvirt_kvm () {
        try {
            string standard_output;

            string[] argv = {"virsh", "capabilities"};

            yield exec (argv, null, out standard_output);
            int index = standard_output.index_of ("<capabilities");

            if (index < 0)
                throw new Boxes.Error.INVALID ("Unexpected output while running command '%s %s'", argv[0], argv[1]);

            standard_output = standard_output.substring (index);
            var kvm = extract_xpath (standard_output,
                                     "string(/capabilities/guest[os_type='hvm']/arch/domain[@type='kvm']/../emulator)");
            return kvm.length != 0;

        } catch (GLib.SpawnError.NOEXEC error) {
            critical ("libvirt is not installed correctly");
        } catch (GLib.Error error) {
            warning (error.message);
        }

        return false;
    }

Check kvm from the command virsh capabilities from host os:

$ virsh --version
10.0.0
$ virsh capabilities | wc -l
298

But now check kvm from the command virsh capabilities from flatpak app shell:

flatpak run --command=sh --devel --filesystem=$(pwd) org.gnome.Boxes
[📦 org.gnome.Boxes app]$ virsh --version
9.0.0
[📦 org.gnome.Boxes ~]$ virsh capabilities
error: failed to connect to the hypervisor
error: Failed to connect socket to '/app/var/run/libvirt/virtqemud-sock': No such file or directory

It seems that the Gnome Boxes app starts a qemu console socket which virsh connects to in order to get the capabilities but this fails because probably the qemu socket has failed for some reason.

Since it is a flatpak application and not a package as a service, I don't know how the qemu socket service is running. I have seen in the source code that many things are executed from the shell but there are no logs of it in any file or output from the same terminal, so I don't know how to reproduce the execution of the command that creates the socket to determine why it is not executed.

My version of the flatpak package is 46:

$ flatpak list
...
Boxes                                              org.gnome.Boxes                                              46.0                              stable               system

I solve this problem removing the flatpak package and installinux the apt package and libvirt manualy. For some reason the apt version doesn't work either, but knowing that the problem is the execution of libvirt I have installed and configured it manually and it has worked very well:

sudo apt -y install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst libosinfo-bin;
sudo systemctl start libvirtd;
sudo systemctl enable libvirtd;
sudo apt -y install gnome-boxes;

And that's it!.

However, something is wrong with the embedded qemu and libvirt binaries of this application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@insidesecurity-yhojann-aguilera and others