Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xterm not working in mininet

I'm using mininet version 2.1.0. My setup is such that I've to run the mininet command from a remote machine, e.g.,

ssh -X user@IP python mininet.py

X11 forwarding seems to be fine. X forwarding does not work from the mininet shell only, but it works from the SSH shell.

However, I'm unable to run xterm command on mininet. I'm not getting any output after running the xterm command.

mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3
h2 -> h1 h3
h3 -> h1 h2
*** Results: 0% dropped (6/6 received)
mininet> xterm h1
mininet> h1 xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted in
this environment. You may get a more descriptive message by running the 
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s

When I start the mininet from my local machine, xterm works and opens up a new window.

Where should I look for xterm related logs in such case?

I've already spent over a day on this. I also updated mininet version to the latest 2.2.1, but still no success.

Thanks in advance!

like image 411
IP_Engr Avatar asked Jun 26 '16 15:06

IP_Engr


2 Answers

The reason "h1 xterm" command is not working under the mininet console is:

two important xterm related environment variables ( $XAUTHORITY , $DISPLAY ) are not passing over to the mininet console, if you run : "h1 echo $DISPLAY $XAUTHORITY" ; both variables will return blank.

In order to keep the host environment variables unchanged, add -E argument to the mn command. "sudo -E mn" , and then you will be able to run "h1 xterm" successfully.

like image 169
Hong Liu Avatar answered Nov 15 '22 12:11

Hong Liu


when I moved to Ubuntu 18.04, Mininet xterm stopped working. all I did was to install xterm "sudo apt install xterm" in Ubuntu. after that I started mininet (sudo mn) and called mininet>xterm h1. the xterm window popped up as usual. hope this will help.

like image 6
user1930043 Avatar answered Nov 15 '22 12:11

user1930043