问题描述
安装Konquerer并重新启动我的笔记本电脑后,尝试从终端机中以root用户身份打开,编辑或访问文件时遇到以下错误(对我而言这是必需的)。
root@linuxBox:/home/v2r#
gnome-open /home/
(gnome-open:2686): GConf-WARNING **: Client failed to connect to the D-BUS daemon: //bin/dbus-launch terminated abnormally with the following error: No protocol specified Autolaunch error: X11 initialization failed.
GConf Error: No D-BUS daemon running
root@linuxBox:/home/v2r# No protocol specified Could not parse arguments: Cannot open display:
似乎dbus也未在/bin/
和/usr/bin/
中正确安装,请参见屏幕截图:
我将如何解决此问题并提前感谢您!
谢谢您的回答SirCharlo!它根本不能解决问题。请注意,它只会在蜂群生根时发生!
root@linuxBox:/home/v2r#
gnome-open /home/
(gnome-open:5170): GConf-WARNING **: Client failed to connect to the D-BUS daemon: Failed to connect to socket /tmp/dbus-2RdCUjrZ9k: Connection refused GConf Error: No D-BUS daemon running
root@linuxBox:/home/v2r# No protocol specified Could not parse arguments: Cannot open display:
最佳办法
夏洛爵士的回答对我有用。 ubuntu 12.04(精确穿山甲)上的相同问题。是的,我也使用su(root)。丢脸丢脸同样的问题,启动emacs。
问题似乎是当您执行su而不是在/root/.dbus/session-bus/中获取值时,DBUS_SESSION_BUS_ADDRESS保留了其值。
来自人dbus-launch:
...
The second common reason for autolaunch is an su to another user, and
display of X applications running as the second user on the display
belonging to the first user. Perhaps the ideal fix in this case would
be to allow the second user to connect to the session bus of the first
user, just as they can connect to the first user's display. However, a
mechanism for that has not been coded.
...
使用sudo,suedit,gksu。
或者,如果必须使用su,请尝试将其添加到/root/.bashrc中:
sessionfile=`find "${HOME}/.dbus/session-bus/" -maxdepth 1 -type f`
if [ -f "$sessionfile" ] ; then
if grep -q "^DBUS_SESSION_BUS_ADDRESS=" "${sessionfile}" ; then
export `grep "^DBUS_SESSION_BUS_ADDRESS=" "${sessionfile}"`
else
echo "DBUS_SESSION_BUS_ADDRESS not found in ${sessionfile}"
fi
else
echo "no session address file found in ${HOME}/.dbus/session-bus"
fi
次佳办法
我有同样的问题。在我的系统中,问题是由根拥有~/.dbus
引起的。更改所有权可以为我解决问题。我建议您也在系统上进行检查。
可以使用chown
命令来更改所有权。对于单个文件:
chown <user>:<group> file
对于目录及其子目录:
chown -R <user>:<group> folder
所以在这种情况下
chown -R <your user>:<your group> ~/.dbus
应该管用。
第三种办法
尝试export $(dbus-launch)
这在Opensuse 12.1上作为虚拟机运行时对我有用。
第四种办法
我也有dbus和vnc的问题。所以我加了
eval `dbus-launch`
到~/.vnx/xstartup
。它为我启动了gnome会话!
第五种办法
你可以试试这个吗?
sessionfile=`find "${HOME}/.dbus/session-bus/" -type f`
export `grep "DBUS_SESSION_BUS_ADDRESS" "${sessionfile}" | sed '/^#/d'`
然后重试您的命令。
gnome-open /home/