Examples

今天在调试dbus程序的时候,运行程序出现了getting session bus failed: //bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.

在网上收了一下解决方法,参考了https://blog.csdn.net/shallon_luo/article/details/4139737,最后发现是执行程序的用户不对。我是用root用户执行的程序,而session bus需要访问启动用户所在home目录的隐藏文件夹/home/xxxxx/.dbus/

该目录在用户目录xxxx下。因此,只需要将root改为用户目录即可:su xxxx。然后执行dbus可执行程序就不会出现类似的错误了。

原文地址:https://www.cnblogs.com/hjj801006/p/9550083.html