You are not logged in.

#1 2015-08-25 12:56:58

maggie
Member
Registered: 2011-02-12
Posts: 255

systemctl --user xxx: Failed to get D-Bus connection [solved]

I am trying to use the --user mode of systemctl but I get errors when refreshing it. I have a headless machine so something is probably missing but I do not know what.

systemctl --user daemon-reload
Failed to get D-Bus connection: No such file or directory

Last edited by maggie (2015-10-13 20:51:29)

Offline

#2 2015-08-25 13:04:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2015-09-19 07:38:54

maggie
Member
Registered: 2011-02-12
Posts: 255

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

I followed the three steps on the wiki but I experience a different error:

% systemd-run --user /bin/sleep 3600
Failed to start transient service unit: Process org.freedesktop.systemd1 exited with status 1

Created:
/etc/systemd/user/dbus.socket
/etc/systemd/user/dbus.service
/etc/systemd/system/user@.service.d/dbus.conf

Enabled:

# systemctl status dbus.socket
? dbus.socket - D-Bus System Message Bus Socket
   Loaded: loaded (/usr/lib/systemd/system/dbus.socket; static; vendor preset: disabled)
   Active: active (running) since Fri 2015-09-18 17:29:29 EDT; 10h ago
   Listen: /run/dbus/system_bus_socket (Stream)

Sep 18 17:29:29 pepper systemd[1]: Listening on D-Bus System Message Bus Socket.

Last edited by maggie (2015-09-19 07:57:33)

Offline

#4 2015-10-10 23:56:06

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 673
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

Failed to get D-Bus connection: No such file or directory

is what systemd tells me for any `--user` cmd when logged in via ssh. Same command runs without issue when typed straight on that same box. There might be some missing point in the wiki, but cannot add it since I dunno myself what it is atm.


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#5 2015-10-11 06:14:27

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,643
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

@maggie - I have found this to be the case too if I login remotely and use that command.  Does that make 3 of us?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Online

#6 2015-10-11 07:34:54

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

Weird, it works fine here using ssh... what is the output of the following commands if you run them in the ssh shell:

$ echo $XDG_RUNTIME_DIR
$ echo $DBUS_SESSION_BUS_ADDRESS
$ systemctl status dbus.service

Also, as stated in the wiki posted by Trilby, try removing any dbus.socket and dbus.service located under /etc/systemd/user/ or ~/.config/systemd/user/.

Last edited by mauritiusdadd (2015-10-11 09:24:22)


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#7 2015-10-13 01:16:24

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 673
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

Login remotelly there's no $XDG* or $DBUS*

$ systemctl status dbus.service (issued localy) gives 10 of the following for yesterday

oct. 12 20:42:03 gwenael dbus[419]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.NetworkManager.service': Uni...rectory.

, of which none for my last attempts via ssh.

Note I have just moved ../systemd/user/dbus.{service,socket} then `systemctl daemon-reload` (nothing else).


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#8 2015-10-13 01:20:49

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,643
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

I did a reinstall and everything works as expected.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Online

#9 2015-10-13 06:55:56

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

kozaki wrote:

Login remotelly there's no $XDG* or $DBUS*

That could be a problem,  XDG_RUNTIME_DIR should be set by systemd-logind at login through the module pam_systemd and DBUS_SESSION_BUS_ADDRESS relies on XDG_RUNTIME_DIR. If you are sure that there is a working dbus session for your user then, for testing purpose, you can try to set these environment variables manually

export XDG_RUNTIME_DIR="/run/user/$UID"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"

and then check if systemctl --user works. However you should find out why those variable are not set.

Last edited by mauritiusdadd (2015-10-13 14:32:53)


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#10 2015-10-13 14:16:04

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,643
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

Yes, in my case, the system build as from 2010 and likely contained config files I modified over the years.  Upon the reinstall, everything just worked™ including systemd --user operations without the need to do any of that the steps on this wiki page.

Last edited by graysky (2015-10-13 14:16:50)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Online

#11 2015-10-13 20:51:52

maggie
Member
Registered: 2011-02-12
Posts: 255

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

Thank you for that. After I reinstalled user mode works.

Offline

#12 2015-10-21 23:13:39

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 673
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

@grayski and@maggie you reinstalled the whole OS to get a workin systemd, do I understand well?

On the machine --Original Arch install from June2010-- defaults are:

$ echo $DBUS_SESSION_BUS_ADDRESS
unix:abstract=/tmp/dbus-PTwPdTrPLa,guid=9af3a9d155aeb5652041db7c5624aec5   «-- does not exist

┌(kozaki@gwenael)─(0)─(01:05  jeu. oct. 22)
$ echo $XDG_RUNTIME_DIR
/run/user/1000

Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#13 2015-10-22 07:30:39

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

@kozaki: Your should find out why DBUS_SESSION_BUS_ADDRESS is wrong... in particular use

$ pacman -Qikk systemd

to check if the module pam_systemd is not corrupted. Also check if there is any pacnew that has not been merged yet.

There is a similar thread here: https://bbs.archlinux.org/viewtopic.php?id=176528
And this could be related too: https://bugs.archlinux.org/task/46369


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#14 2015-10-25 00:00:45

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 673
Website

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

Thank you for your time mauritius

$ pacman -Qikk systemd
Nom                   : systemd
Version               : 226-3
<SNIP>
[Shows WARNINGs for a few missing localization files, nothing else]

Also boot always starts with a message like "version 224" (it's been a while I should have investigated this to understand what it refers to). But journal says

oct. 18 00:23:38 llewellyn systemd[1]: systemd 226 running in system mode. (+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS + <SNIP>

Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#15 2015-10-25 11:34:45

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: systemctl --user xxx: Failed to get D-Bus connection [solved]

If pacman says there are altered/missing files then there is something wrong in your system... and first of all you should do a full system update because the latest version of systemd is 227-1. After the update, check again if there are still missing/altered files. The variable should be set by dbus.socket, so please post also the full output of the following commands

$ ls -la /etc/systemd/user
$ ls -la /etc/systemd/system
$ systemctl status --all dbus.socket
$  cat /usr/lib/systemd/user/dbus.socket

About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

Board footer

Powered by FluxBB