QEMU/KVM fails to start on openSUSE
sudo
seems to be the problem here. Using that you run the command as root, but root doesn't necessarily have access to your window manager. If you run xhost +
before trying to open the VM that should let root open the window that Qemu is trying to open.
Alternately, you could tell qemu to use a VNC server instead (add -vnc :<port>
like -vnc :1
to have it listen on all interfaces to port 5901 for VNC clients or -vnc localhost:1
to listen on just localhost). Then you could use vncviewer
or vinagre
or some other VNC viewer to connect to localhost:1
Or you could, apparently, use xdg-su -c "<qemu command"
, though I've never used that myself. It was offered as a solution here to a very similar problem.
And for what it's worth, qemu does not generally use ssh as part of it's startup.
Melab
Updated on September 18, 2022Comments
-
Melab over 1 year
I've gotten this to run before. I'm using the OVMF BIOS image and the EFI executables generated using this guide. I ran
sudo qemu-system-x86_64 -bios /usr/share/qemu-ovmf/bios/bios.bin -hda fat:/home/main/Documents/EFI_HD/
which ends up exiting with:Warning: default MAC address being used, creating potential for address conflict vvfat: /home/main/Documents/EFI_HD/ chs 1024,16,63 Unable to init server: Could not connect: Connection refused (qemu-system-x86_64:2549): Gtk-WARNING **: cannot open display
What might be causing this?
-
Admin over 8 yearsDo you have a graphical display? Are you running this remotely like over an ssh session or something like that?
-
Admin over 8 years@EricRenouf I have a graphical display. I'm using an install of openSUSE that is standard and pretty new. Like I said, this was working before? SSH is not being used that I know of (maybe it runs behind the scenes, but I don't know how QEMU works).
-
-
Melab over 8 yearsNeither of those work. Both xhost+xhost + and sudoxhost+sudo xhost + returned xhost:unab≤→opendisplayxhost: unable to open display "". xdg−suxdg-su returned kdesu:ca∩otco∩ect→XserverIP:0.0kdesu: cannot connect to X server IP:0.0 ("localhost" coming from $DISPLAY$DISPLAY, which I had read to IP:0.0IP:0.0 somewhere else). I want to know what changed to make it not work.
-
Eric Renouf over 8 years@Melab are you able to open any graphical things from the terminal where you're trying to run these things? Like if you have
xeyes
orxclock
or something like that installed can you open any of those before doing thesudo
? -
Devidas almost 5 years
xdg-su -c "<qemu command"
worked for me. +1 for that.