我正在尝试让 GUI 与 WSL2 一起使用,但我尝试的任何方法都不起作用。
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0export LIBGL_ALWAYS_INDIRECT=1完成此操作后,我尝试执行一些曾经在 WSL1 下运行的程序。
在 的情况下nemo,我收到以下错误:
Unable to init server: Could not connect: Connection refused
Could not parse arguments: Cannot open display:
Run Code Online (Sandbox Code Playgroud)
当尝试运行时gedit,我收到以下错误:
Unable to init server: Could not connect: Connection refused
(gedit:6704): Gtk-WARNING **: 01:07:05.762: cannot open display: 172.19.64.1:0
Run Code Online (Sandbox Code Playgroud)
输入echo $DISPLAY产生以下输出:172.19.64.1:0
我还卸载了 Ubuntu,手动删除了 AppData 中的残留内容,并重新安装了 Ubuntu。如果这一点很重要:我没有创建 UNIX 帐户,而是使用 root(在重新安装 Ubuntu …