dbus启动失败:Couldn't connect to system bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
2015-07-27 10:38
351 查看
在没有开启x窗口的shell下启动dbus相关程序时会如上错误,详细原因如下:
This is not considered to be a bug. Auto-launching D-Bus sessions when
not under X11 would result in one new D-Bus session per application that
tried to use it, unable to communicate with other user-facing
applications that do not share that session; those sessions would also
never exit, leaving unused dbus-daemon and dbus-launch processes
building up indefinitely (until the next reboot). That's clearly not
useful or desirable, but in the absence of a clear and
machine-detectable definition of "session" we can't really improve on
it. (Under X11, the lifetime of the X server acts as the definition of
the session, so autolaunching can work and is useful.)
Applications that can usefully be run either with or without a D-Bus
session, such as pulseaudio, should treat errors in connecting to the
session bus as non-fatal, and continue to have the rest of their
functionality. I believe PA already does this, in fact; that message in
your syslog just tells you that the D-Bus part of its functionality will
not be active.
If you do need to start a D-Bus session while not under X11, you can run
dbus-launch as documented in the dbus-launch(1) man page, something like
this:
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
eval `dbus-launch --sh-syntax`
echo "D-Bus per-session daemon address is:"
echo "$DBUS_SESSION_BUS_ADDRESS"
fi
in which case you're responsible for getting the
DBUS_SESSION_BUS_ADDRESS environment variable to all the processes that
should share the session, and managing the lifetime of the session (i.e.
killing the session's dbus-daemon when appropriate). I have sent patches
upstream to add a dbus-run-session tool that runs a session for as long
as its child process is running and then terminates it (similar
semantics to schroot), but they haven't been merged yet.
Older versions of dbus-launch tried to monitor the lifetime of text
login sessions on virtual consoles, but the way they did that would
consume every second character of input (Debian bug #453755) and it
isn't clear whether it actually ended the session on logout either. This
was fixed by several changes between squeeze and wheezy.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690530
解决办法:
先执行命令
在运行dbus程序即可。
This is not considered to be a bug. Auto-launching D-Bus sessions when
not under X11 would result in one new D-Bus session per application that
tried to use it, unable to communicate with other user-facing
applications that do not share that session; those sessions would also
never exit, leaving unused dbus-daemon and dbus-launch processes
building up indefinitely (until the next reboot). That's clearly not
useful or desirable, but in the absence of a clear and
machine-detectable definition of "session" we can't really improve on
it. (Under X11, the lifetime of the X server acts as the definition of
the session, so autolaunching can work and is useful.)
Applications that can usefully be run either with or without a D-Bus
session, such as pulseaudio, should treat errors in connecting to the
session bus as non-fatal, and continue to have the rest of their
functionality. I believe PA already does this, in fact; that message in
your syslog just tells you that the D-Bus part of its functionality will
not be active.
If you do need to start a D-Bus session while not under X11, you can run
dbus-launch as documented in the dbus-launch(1) man page, something like
this:
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
eval `dbus-launch --sh-syntax`
echo "D-Bus per-session daemon address is:"
echo "$DBUS_SESSION_BUS_ADDRESS"
fi
in which case you're responsible for getting the
DBUS_SESSION_BUS_ADDRESS environment variable to all the processes that
should share the session, and managing the lifetime of the session (i.e.
killing the session's dbus-daemon when appropriate). I have sent patches
upstream to add a dbus-run-session tool that runs a session for as long
as its child process is running and then terminates it (similar
semantics to schroot), but they haven't been merged yet.
Older versions of dbus-launch tried to monitor the lifetime of text
login sessions on virtual consoles, but the way they did that would
consume every second character of input (Debian bug #453755) and it
isn't clear whether it actually ended the session on logout either. This
was fixed by several changes between squeeze and wheezy.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690530
解决办法:
先执行命令
eval `dbus-launch --sh-syntax`
在运行dbus程序即可。
相关文章推荐
- git基于历史commit创建分支
- git恢复误删除的文件
- Leetcode Q7:Reverse Integer
- 获取iOS项目名称及版本号
- centos查看哪些包提供指定头文件
- CodeForces 363B - Fence
- 【Unity NGUI游戏开发之三】TweenPosition位移动画(二):相对于UIAnchor不同分辨率下的完美适配位移动画
- Myeclipse配置Tomcat
- conkey conf
- git remote branch操作
- android 解析xml
- centos查看哪些包提供指定头文件
- 类加载器的工作原理
- cocos2dx中的屏幕适配
- stack栈
- 突破防盗链机制:使用referrer-killer
- 将图片转成二进制并生成Base64编码,可以在网页中通过url查看图片
- C#中的委托的简单使用
- Android高效加载大图、多图解决方案,有效避免程序OOM
- SVN Error:URL access forbidden for unknown reason