ubuntu 17.04/Debian 10
无法运行gparted
,错误信息“Gtk-WARNING **: cannot open display: :0.0
”,具体信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
~$ sudo gparted Created symlink /run/systemd/system/-.mount → /dev/null. Created symlink /run/systemd/system/home-longsky-mytest.mount → /dev/null. Created symlink /run/systemd/system/media-longsky-A624C9D724C9AB1F.mount → /dev/null. Created symlink /run/systemd/system/run-user-1000.mount → /dev/null. Created symlink /run/systemd/system/tmp.mount → /dev/null. No protocol specified (gpartedbin:5665): Gtk-WARNING **: cannot open display: :0.0 Removed /run/systemd/system/-.mount. Removed /run/systemd/system/home-longsky-mytest.mount. Removed /run/systemd/system/media-longsky-A624C9D724C9AB1F.mount. Removed /run/systemd/system/run-user-1000.mount. Removed /run/systemd/system/tmp.mount. |
具体的解释以及解决方法如下:
If running Ubuntu 17.10/Debian 10 or newer, this issue can arise when an application has not been updated with full support for Wayland. As a workaround until the application is updated, you can run
1 |
$ xhost +SI:localuser:root |
which will allow the root user to display applications on your desktop.
为了保证每次启动脚本都可以自动执行,可以把上面的命令加入到.bashrc
:
1 |
$ sed -i '$a\xhost +SI:localuser:root' ~/.bashrc |