NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.71k stars 13.85k forks source link

Virt-Manager stopped working after update when using sway #207496

Closed Janik-Haag closed 1 year ago

Janik-Haag commented 1 year ago

Describe the bug

Virt-Manager throws an error when trying to create a vm, and does not create the vm

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use sway default.nix

    { config, lib, pkgs, ... }:
    {
    hardware.opengl.enable = true;
    
    environment = {
    loginShellInit = ''
      if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
        exec sway
      fi
    ''; # Will automatically open sway when logged into tty1
    variables = {
      #LIBCL_ALWAYS_SOFTWARE = "1";   # For applications in VM like alacritty to work
      #WLR_NO_HARDWARE_CURSORS = "1"; # For cursor in VM
    };
    };
    
    programs = {
    sway = {                              # Tiling Wayland compositor & window manager
      enable = true;
      extraPackages = with pkgs; [
        #autotiling      # Tiling Script
        wev             # Input viewer
        wl-clipboard    # Commandline Clipboard #alternative clipman/wayclip
        wlr-randr
        xwayland
      ];
    };
    };
    
    xdg.portal = {                                  # Required for flatpak with window managers
    enable = true;
    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
    };
    }

    home.nix

    
    { config, lib, pkgs, ... }:
    {
    hardware.opengl.enable = true;
    
    environment = {
    loginShellInit = ''
      if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
        exec sway
      fi
    ''; # Will automatically open sway when logged into tty1
    variables = {
      #LIBCL_ALWAYS_SOFTWARE = "1";   # For applications in VM like alacritty to work
      #WLR_NO_HARDWARE_CURSORS = "1"; # For cursor in VM
    };
    };
    
    programs = {
    sway = {                              # Tiling Wayland compositor & window manager
      enable = true;
      extraPackages = with pkgs; [
        #autotiling      # Tiling Script
        wev             # Input viewer
        wl-clipboard    # Commandline Clipboard #alternative clipman/wayclip
        wlr-randr
        xwayland
      ];
    };
    };
    
    xdg.portal = {                                  # Required for flatpak with window managers
    enable = true;
    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
    };
    }
    janik  …/flake    main $   03:15  cat modules/desktops/sway/home.nix
    { config, lib, pkgs, ... }:

{ imports = [ ../../programs/waybar.nix ]; wayland.windowManager.sway = { enable = true; config = rec { modifier = "Mod4"; input = { "type:keyboard" = { xkb_layout = "us,de"; }; "type:touchpad" = { tap = "enabled";

dwt = "enabled";

      #scroll_method = "two_finger";
      #middle_emulation = "enabled";
      natural_scroll = "enabled";
    };
  };
  output = {
    eDP-1 = {
bg = "~/.config/wallpaper/* fill";

}; }; menu = "rofi -show drun -show-icons"; terminal = "alacritty"; startup = [ {command = "nm-applet --indicator";}

{command = "bluemann-applet";}

    {command = "dbus-send --system --dest=org.freedesktop.ModemManager1 --print-reply /org/freedesktop/ModemManager1 org.freedesktop.DBus.Introspectable.Introspect";}
    {command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK";}
    {command = "hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK";}
    {command = "export BROWSER=\"firefox '%s' &\"";}
    # Launch Firefox on start
    #{command = "firefox";}
  ];
  bars = []; # No bar because using Waybar
  keybindings = {

Switch to Workspace

    "${modifier}+1" = "workspace number 1";
    "${modifier}+2" = "workspace number 2";
    "${modifier}+3" = "workspace number 3";
    "${modifier}+4" = "workspace number 4";
    "${modifier}+5" = "workspace number 5";
    "${modifier}+6" = "workspace number 6";
    "${modifier}+7" = "workspace number 7";
    "${modifier}+8" = "workspace number 8";
    "${modifier}+9" = "workspace number 9";
    "${modifier}+0" = "workspace number 10";

    # Move "application" container to window
    "${modifier}+Shift+1" = "move container to workspace number 1";
    "${modifier}+Shift+2" = "move container to workspace number 2";
    "${modifier}+Shift+3" = "move container to workspace number 3";
    "${modifier}+Shift+4" = "move container to workspace number 4";
    "${modifier}+Shift+5" = "move container to workspace number 5";
    "${modifier}+Shift+6" = "move container to workspace number 6";
    "${modifier}+Shift+7" = "move container to workspace number 7";
    "${modifier}+Shift+8" = "move container to workspace number 8";
    "${modifier}+Shift+9" = "move container to workspace number 9";
    "${modifier}+Shift+0" = "move container to workspace number 10";

Move Focus

    "${modifier}+h" = "focus left";
    "${modifier}+j" = "focus down";
    "${modifier}+k" = "focus up";
    "${modifier}+l" = "focus right";

    "${modifier}+Left" = "focus left";
    "${modifier}+Right" = "focus right";
    "${modifier}+Up" = "focus up";
    "${modifier}+Down" = "focus down";

    # Move Container
    "${modifier}+Shift+h" = "move left";
    "${modifier}+Shift+j" = "move down";
    "${modifier}+Shift+k" = "move up";
    "${modifier}+Shift+l" = "move right";

    "${modifier}+Shift+Left" = "move left";
    "${modifier}+Shift+Right" = "move right";
    "${modifier}+Shift+Up" = "move up";
    "${modifier}+Shift+Down" = "move down";

    # Toggle floating container and focus mode
    "${modifier}+space" = "focus mode_toggle";
    "${modifier}+Shift+space" = "floating toggle";

    # Focus and Layout stuff
    "${modifier}+a" = "focus parent";
    "${modifier}+b" = "splith";
    "${modifier}+w" = "layout tabbed";
    "${modifier}+e" = "layout toggle split";
    "${modifier}+s" = "layout stacking";
    "${modifier}+r" = "mode resize";
    "${modifier}+v" = "splitv";
    "${modifier}+o" = "splith";

    # Kill Container
    "${modifier}+Shift+q" = "kill";

    # Reload + Exit

"${modifier}+Shift+r" = "reload"; "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";

    #Full Screen
    "${modifier}+f" = "fullscreen toggle";

Exec Programms

"${modifier}+Return" = "exec alacritty"; "${modifier}+d" = "exec rofi -show drun -show-icons"; "${modifier}+Shift+d" = "exec swaymsg input \"1:1:AT_Translated_Set_2_keyboard\" xkb_switch_layout next"; "${modifier}+Shift+o" = "exec swaylock --screenshots --clock --effect-blur 7x5 --fade-in 0.5 --indicator --indicator-radius 100 --indicator-thickness 5 --effect-vignette 0.5:0.5 --ring-color bd93f9 --key-hl-color 50fa7b --line-color 00000000 -e --text-color ff79c6 -K"; "${modifier}+Shift+s" = "exec \"flameshot gui -c\"";

    #Volume

"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +10%"; "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -10%"; "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; "XF86AudioMicMute" = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle";

    #Brightness

"XF86MonBrightnessUp" = "exec brightnessctl set 10%+"; "XF86MonBrightnessDown" = "exec brightnessctl set 10%-"; }; }; extraSessionCommands = '' export XDG_SESSION_TYPE=wayland export XDG_SESSION_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway export SDL_VIDEODRIVER=wayland export _JAVA_AWT_WM_NONREPARENTING=1 export QT_QPA_PLATFORM=wayland ''; };

}


2. And Virt-Manager

{ config, pkgs, user, ... }:

{ boot.extraModprobeConfig = '' options kvm_intel nested=1 ''; users.groups.libvirtd.members = [ "root" "${user}" ]; virtualisation = { libvirtd = { enable = true; qemu = { verbatimConfig = '' nvram = [ "${pkgs.OVMF}/FV/OVMF.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd" ] ''; }; }; spiceUSBRedirection.enable = true; }; environment = { systemPackages = with pkgs; [ virt-manager qemu OVMF ]; }; }


### Expected behavior
A VM should be created

### Screenshots
![2022-12-19_17-37](https://user-images.githubusercontent.com/80165193/209417626-63d1767e-275d-4689-95da-cdf485f97891.png)

### Additional context
The issue started after updating on the unstable branch and from what i can make out of the stack trace it seems like some gtk/dependency issue. 

I opend an issue for QEMU before because i thought that this was the problem but after trying it with i3 it worked just fine on the updated versions so i closed the issue again. https://github.com/NixOS/nixpkgs/issues/206872

Stacktraces:
Error launching details..

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

Traceback (most recent call last): File "/nix/store/bjkzfis4wgh729sh16pr782rkw424nax-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..

Error starting installation: constructor returned NULL

Traceback (most recent call last): File "/nix/store/bjkzfis4wgh729sh16pr782rkw424nax-virt-manager-4.1.0/share/virt-manager/virtManager/createvm.py", line 1881, in _finish_clicked self._start_install(guest, installer) File "/nix/store/bjkzfis4wgh729sh16pr782rkw424nax-virt-manager-4.1.0/share/virt-manager/virtManager/createvm.py", line 1978, in _start_install progWin.run() File "/nix/store/bjkzfis4wgh729sh16pr782rkw424nax-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


### Notify maintainers
<!--
Virt-Manager:
@qknight 
@offlinehacker 
@fpletz
@globin 

Sway:
@primeos 
@Synthetica9 
-->

### Metadata
Nixos unstable with flakes

Janik@nixos: nix-shell -p nix-info --run "nix-info -m" this path will be fetched (0.00 MiB download, 0.00 MiB unpacked): /nix/store/a2mfyh90szmc055ivfnv182b5a4naq90-nix-info copying path '/nix/store/a2mfyh90szmc055ivfnv182b5a4naq90-nix-info' from 'https://cache.nixos.org'...

Janik-Haag commented 1 year ago

Okay I'm sorry i bothered you it was just me being dumb. For some reason virt-manager throws the before mentioned errors when not having a gtk-cursor theme installed. For anyone finding this issue in the future when using home-manager set:

home.pointerCursor.gtk.enable = true;
nixos-discourse commented 8 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/virt-manager-cannot-create-vm/38894/2