How to run X applications on a guest VM in the cloonix network simulator

July 15, 2014 — Leave a comment

To run a program that uses a graphical user interface on a guest virtual machine running in the cloonix open-source network simulator, log into the guest VM from the host computer using SSH and forward the X11 display. Then, any X11 program you run on the guest VM using that SSH session, such as Wireshark, will display its X windows on the host computer.

Initial setup

First, we create a cloonix network simulation with at least one guest VM. In this example, we created three guest VMs named Cloon1, Cloon2, and Cloon3.

A cloonix network simulation with three guest VMs

A cloonix network simulation with three guest VMs

See previous posts related to using cloonix, if you need help setting up the example network.

Connect to guest VM via SSH

Open a new terminal window on the host computer. We do this so we can run X windows from the guests on the host. As discussed in the Cloonix v24 overview post, cloonix uses a patched version of the Dropbear SSH client so we use the dbssh command that is installed in the cloonix tree directory, ~/Netsims/cloonix-24.11.

The Dropbear SSH client automatically forwards X windows from the client machine to the server machine so we do not need to use any options when running the dbssh command in cloonix.

$ cd ~/Netsims/cloonix-24.11
$ ./dbssh root@Cloon1
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@ns235547:~# 

xeyes

Now we are connected to the virtual machine Cloon1 via an SSH session. Start an application on Cloon1 that uses the X display. A good example is the xeyes application:

root@ns235547:~# xeyes

We see the xeyes application running on the Cloon1 guest VM appear on the host computer’s desktop.

xeyes application running on Cloon1 guest VM displays on host computer

xeyes application running on Cloon1 guest VM displays on host computer

Wireshark

One of the most useful X applications we could run on a cloonix guest VM is the Wireshark packet analyzer. This works well with one issue: we need to execute the command twice to make it work. The cloonix development team is aware of this issue, but it is a very minor problem.

Wireshark error

The first time we run Wireshark on a guest VM and forward the X display to the host computer, we get an error message.

root@ns235547:~# wireshark

** (wireshark:1809): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-eUY6aXcskM: Connection refused

(wireshark:1809): Gdk-ERROR **: The program 'wireshark' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 200 error_code 10 request_code 130 (MIT-SHM) minor_code 1)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap
root@ns235547:~# 

Run the Wireshark command again and it works.

root@ns235547:~# wireshark
Wireshark running on a cloonix guest VM

Wireshark running on a cloonix guest VM

There is no obvious information in the X window that would indicate which Cloonix guest VM is running which X window, so it is best to keep things simple and run X11 applications on only one or two guest VMs at a time.

Conclusion

We can run applications that require a GUI interface on a cloonix guest VM by forwarding the X11 display from the guest VM to the host computer. This allows us to run programs like Wireshark or Firefox on the guest VM.

No Comments

Be the first to start the conversation.

Leave a Reply

Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*