LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-08-2022, 05:37 PM   #1
wlan0
LQ Newbie
 
Registered: Feb 2022
Location: USA
Distribution: Slackware
Posts: 7

Rep: Reputation: 0
Question dbus failed to connect to session bus


Hello,

I am having trouble getting anything that requires dbus to work.

I have the following in my /etc/X11/xinit/xinitrc.dwm file:
Code:
exec dbus-launch --sh-syntax --exit-with-session dwm
And I still cannot launch anything that requires dbus.
When I try to launch something such as mailspring:

Code:
[2 zypak-helper] Failed to connect to session bus: [org.freedesktop.DBus.Error.NotSupported] Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead.
Anything that requires dbus fails.

What am I doing wrong?
 
Old 02-08-2022, 11:21 PM   #2
mumahendras3
Member
 
Registered: Feb 2018
Location: Indonesia
Distribution: Slackware-current + s6 + s6-rc + s6-linux-init (github.com/mumahendras3/sl6ckware)
Posts: 126

Rep: Reputation: Disabled
Quote:
Originally Posted by wlan0 View Post
Hello,

I am having trouble getting anything that requires dbus to work.

I have the following in my /etc/X11/xinit/xinitrc.dwm file:
Code:
exec dbus-launch --sh-syntax --exit-with-session dwm
And I still cannot launch anything that requires dbus.
When I try to launch something such as mailspring:

Code:
[2 zypak-helper] Failed to connect to session bus: [org.freedesktop.DBus.Error.NotSupported] Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead.
Anything that requires dbus fails.

What am I doing wrong?
dbus-launch --sh-syntax will actually print out to stdout the required environment variables that are needed for other programs to find the newly launched dbus-daemon, hence you have to wrap the dbus-launch command with "eval" then exec to dwm.

A simpler way is to just use dbus-run-session like:

Code:
exec dbus-run-session -- dwm
At the end of your xinitrc.dwm.

EDIT:
Upon reading the dbus-launch man page, specifying the program to run as dbus-launch argument should automatically set the environment variables for the program specified as the argument. So I don't know why the DBUS_SESSION_BUS_ADDRESS is not picked up by your programs.

Last edited by mumahendras3; 02-08-2022 at 11:39 PM.
 
Old 02-09-2022, 07:24 AM   #3
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 781

Rep: Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895
Quote:
Originally Posted by mumahendras3 View Post
EDIT:
Upon reading the dbus-launch man page, specifying the program to run as dbus-launch argument should automatically set the environment variables for the program specified as the argument. So I don't know why the DBUS_SESSION_BUS_ADDRESS is not picked up by your programs.
Yes the program launched by 'dbus-launch' should have the DBUS_SESSION_BUS_ADDRESS environment variable set. The '--sh-syntax' option is useful for setting the DBUS_SESSION_BUS_ADDRESS in the originating script, in case more programs needed to be launched and made aware of a session dbus in the same script.

With the OP using 'exec' to start dwm, setting DBUS_SESSION_BUS_ADDRESS in the xinitrc script wont be used after that line so something else is going on.

Check if the DBUS_SESSION_BUS_ADDRESS environment variable is set prior to launching mailspring. If it is then something is unsetting DBUS_SESSION_BUS_ADDRESS when you start mailspring. I'm also not sure what 'zypak-helper' is. A preliminary search shows its some sort of sandboxing app so maybe that is clearing the DBUS_SESSION_BUS_ADDRESS variable somehow when it starts up?
 
Old 05-19-2022, 11:24 AM   #4
ernobe
Member
 
Registered: Nov 2004
Location: Costa Rica
Distribution: Debian SID
Posts: 37

Rep: Reputation: 15
According to https://dbus.freedesktop.org/doc/dbus-launch.1.html and https://dbus.freedesktop.org/doc/dbu...session.1.html you should not use dbus-launch to run your program, instead use dbus-run-session.
 
Old 05-19-2022, 01:27 PM   #5
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 781

Rep: Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895
Quote:
Originally Posted by ernobe View Post
According to https://dbus.freedesktop.org/doc/dbus-launch.1.html and https://dbus.freedesktop.org/doc/dbu...session.1.html you should not use dbus-launch to run your program, instead use dbus-run-session.
I've read those man pages before and didnt see anything about one method being preferred over the other so I'm not sure where you are seeing that. They both have very similar operation but dbus-launch has a few more options, where dbus-run-session is basically the same as 'dbus-launch --exit-with-session' as I understand it.

Either way, slackware uses a mix of dbus-run-session and dbus-launch across the various xinitrc and .desktop files, so we end up having to be familiar with both if you ever get into modifying those files.
 
Old 05-19-2022, 02:37 PM   #6
ernobe
Member
 
Registered: Nov 2004
Location: Costa Rica
Distribution: Debian SID
Posts: 37

Rep: Reputation: 15
The OP was not asking in this case for what is preferred, but for anything that will work. And of the two, dbus-run-session is the only one that specifically says that it is meant to run a program:

Quote:
dbus-run-session is used to start a session bus instance of dbus-daemon from a shell script, and start a specified program in that session.
 
Old 05-19-2022, 04:20 PM   #7
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 781

Rep: Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895Reputation: 895
I see what you meant. I thought we were talking about starting a 'dwm' X session, which can be done with either method.

The weird thing with the OP's problem was that the dbus address should have been set in the environment with either method, but the mailspring application claims it was not. Starting mailspring with dbus-run-session and no address set in the environment would just start mailspring in its own isolated session dbus, no? At any rate, I'll leave this thread for now, unless OP updates the situation.
 
Old 05-19-2022, 07:55 PM   #8
ernobe
Member
 
Registered: Nov 2004
Location: Costa Rica
Distribution: Debian SID
Posts: 37

Rep: Reputation: 15
As I mentioned in a recent post on Reddit, even if DBUS_SESSION_BUS_ADDRESS is set in the environment, dbus-run-session will change it to a unix:abstract one, run your program, then revert it to its previous value when your program exits. My Reddit post is on r/artixlinux, the subreddit of Artix Linux, which removes systemd and related annoyances like dbus. It took me a while to figure out, but as far as I'm concerned, you might as well give up on trying to set your own DBUS_SESSION_BUS_ADDRESS values, it's all been taken care of by dbus-run-session.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DBUS - Is it possible to have 2 instance of session bus or something similar? manojjk Programming 0 12-07-2012 05:44 PM
Failed to execute dbus-launch to autolaunch D-Bus session wds Linux - Desktop 1 04-21-2012 05:39 PM
Dbus System bus and Session bus mainloops deimus Linux - Distributions 0 08-20-2010 06:49 AM
[SOLVED] No DBUS session-bus found Widgeteye Slackware 1 06-22-2010 03:46 PM
Fedora Core 9 update dbus.exception & dbus.proxies & DBus.Error.AccessDenied errors trien27 Fedora 1 12-08-2008 11:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration