Virt-manager - cannot create VM

Hi,

I am trying to create a VM using virt-manager. Unfortunatelly, I am running into an error (logs bellow). My configuration.nix contains both lines from wiki.

Error launching details: 'NoneType' object has no attribute 'conn'

Traceback (most recent call last):
  File "/nix/store/k3k8d8zn5dnyf8y638yx4zzjvb6y9cxk-virt-manager-4.1.0/share/virt-manager/virtManager/vmwindow.py", line 36, in get_instance
    key = "%s+%s" % (vm.conn.get_uri(), vm.get_uuid())
                     ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'conn'
Error starting installation: constructor returned NULL

Traceback (most recent call last):
  File "/nix/store/k3k8d8zn5dnyf8y638yx4zzjvb6y9cxk-virt-manager-4.1.0/share/virt-manager/virtManager/createvm.py", line 1881, in _finish_clicked
    self._start_install(guest, installer)
  File "/nix/store/k3k8d8zn5dnyf8y638yx4zzjvb6y9cxk-virt-manager-4.1.0/share/virt-manager/virtManager/createvm.py", line 1978, in _start_install
    progWin.run()
  File "/nix/store/k3k8d8zn5dnyf8y638yx4zzjvb6y9cxk-virt-manager-4.1.0/share/virt-manager/virtManager/asyncjob.py", line 270, in run
    Gdk.Cursor.new_from_name(gdk_window.get_display(), "progress"))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: constructor returned NULL

I am not sure, what do do. Could someone please point me in a right direction?

It looks like another NixOS user had your exact problem (see this nixpkgs issue). According to them, the problem is a missing GTK cursor. They use home-manager, and solved their problem by setting this option:

home.pointerCursor.gtk.enable = true;

At what point in the process does this error occur? I also run virt-manager on my nixos machine, but I haven’t created a VM in some time, so I’m not sure whether or not this bug also affects me. (EDIT: I also do not use home-manager.) I use KDE Plasma 5; it’s possible that that brings in a compatible cursor. What desktop environment/window manager are you using?

I use KDE Plasma 5

should be fine since most desktop-environments bring some gtk and qtdefaults, including cursor

That was it, thank you.

I tried it, but at first, it threw errors at me. I had to change up the config a bit, but it works now. I was confused, because prior to reinstalling NixOS to encrypt the partition with LUKS, I didn’t have this setting and it worked.

Anyway, it does now. Thank you again!

What did you change? I am having the same problem and can not figure it out.

I ran into this too when I switched to hyprland (using wayland).

One fix is to force virt-manager to run under XWayland:

GDK_BACKEND=x11 virt-manager

But setting a GTK cursor is better. Something like this:

home.pointerCursor = {
  gtk.enable = true;
  package = pkgs.vanilla-dmz;
  name = "Vanilla-DMZ";
};

Note this is a home-manager setting. Anyone know how to do this without home-manager?

1 Like

Hi,
I’ve added this

  gtk = {
    enable = true;
    theme = {
      name = "Catppuccin-Mocha-Compact-Peach-Dark";
      package = pkgs.catppuccin-gtk.override {
        accents = ["peach"];
        size = "compact";
        variant = "mocha";
      };
    };

    cursorTheme = {
      name = "Catppuccin-Mocha-Peach-Cursors";
      package = pkgs.catppuccin-cursors.mochaPeach;
      size = 20;
    };
  };

  qt.enable = true;
  qt.platformTheme = "gtk";

  home.pointerCursor = {
    gtk.enable = true;
    x11.enable = true;
    package = pkgs.catppuccin-cursors.mochaPeach;
    name = "Catppuccin-Mocha-Peach-Cursors";
    size = 20;
  };