2016년 5월 7일 토요일

Launching a QEMU session remotely using X11 Forwarding

This week I needed to launch qemu-system (QEMU hypervisor GUI) from a server that did not have xorg/X11 graphical environment installed. Fortunately, as long as qemu is installed on the server and X11 is installed on your local machine, you can use X11 forwarding to launch the qemu-system window locally.

When I first tried to execute qemu-system directly on server no3, I got the following error:

$ qemu-system-x86_64 -enable-kvm -drive file=sheepdog:xenial
Unable to init server: Could not connect: Connection refused
...
gtk initialization failed

This is not surprising, since the server doesn't have xorg/X11 installed.

I then tried to use my local Xorg session to run qemu-system remotely using X11 forwarding, but got the following error:

[archjun@pinkS310 dotfiles]$ ssh -X fedjun@192.168.95.146 qemu-system-x86_64 -enable-kvm -drive file=sheepdog:xenial
fedjun@192.168.95.146's password: 
X11 forwarding request failed on channel 0
Unable to init server: Could not connect: Connection refused

Apparently this is due to xorg-x11-xauth not being installed on the no3 server running Fedora 23.

You also have to ensure the following is in /etc/ssh/sshd_config on the remote machine: 

X11Forwarding Yes
X11UseLocalhost no

After making these settings, X11 forwarding of qemu-system-x86-64 should work.

References: