xterm 在 mininet 中不起作用

IP_*_*ngr 6 python x11 mininet

我正在使用 mininet 版本 2.1.0。我的设置是这样的,我必须从远程机器运行 mininet 命令,例如,

ssh -X user@IP python mininet.py

X11转发似乎没问题。X 转发不仅仅在 mininet shell 中工作,但它在 SSH shell 中工作。

但是,我无法在 mininet 上运行 xterm 命令。运行 xterm 命令后,我没有得到任何输出。

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
Run Code Online (Sandbox Code Playgroud)

当我从本地机器启动 mininet 时,xterm 工作并打开一个新窗口。

在这种情况下,我应该在哪里查找与 xterm 相关的日志?

我已经花了一天多的时间在这上面。我也将 mininet 版本更新到最新的 2.2.1,但仍然没有成功。

提前致谢!

小智 9

“h1 xterm”命令在 mininet 控制台下不起作用的原因是:

如果您运行:“h1 echo $DISPLAY $XAUTHORITY”,则两个重要的 xterm 相关环境变量( $XAUTHORITY 、 $DISPLAY )不会传递到 mininet 控制台;两个变量都将返回空白。

为了保持主机环境变量不变,在mn命令中添加-E参数。“sudo -E mn” ,然后就可以成功运行“h1 xterm”了。


小智 5

当我迁移到 Ubuntu 18.04 时,Mininet xterm 停止工作。我所做的只是在 Ubuntu 中安装 xterm“sudo apt install xterm”。之后我启动了 mininet (sudo mn) 并调用了 mininet>xterm h1。xterm 窗口像往常一样弹出。希望这会有所帮助。