haelix
haelix

Reputation: 4555

Why does dbus-daemon take 1min:30s to start?

$ time sudo dbus-daemon --system
real    1m30.111s
user    0m0.017s
sys     0m0.003s

Barebone ArchLinux inside docker on ArchLinux.

D-Bus Message Bus Daemon 1.12.16

Tried dbus-x11 from AUR, same. Every time.

Edit/Details: the sudo invocation above takes 1:30 to execute, but the actual dbus-daemon process is spawned right away, and continues to run during and after the 1:30, successfully (i.e. it works). Reason I need dbus-daemon? for avahi-daemon (more specifically, to be able to run avahi-browse --all and discover stuff on my network).

Edit2: seems even though 'everything works' despite this slowness (avahi, network service discovery etc), the container becomes dead slow. Barely running sudo echo 'something' takes 25 seconds (a figure perhaps related to a timeout of 25000 inside /usr/share/dbus-1/system.conf). Just like an infection. For what it's worth, after reading more, seems the frustration of needing dbus is not restricted to the world of containerization - plenty of articles/communities like this and this.

Upvotes: 4

Views: 1318

Answers (1)

Jack12816
Jack12816

Reputation: 111

I hit this issue with various Docker images, but not always. I digged deeper in this issue and found an interessting comment on the systemd repo.

The images I'm currently working on had systemd configured on passwd and group:

$ cat /etc/nsswitch.conf

passwd:      sss files systemd
group:       sss files systemd

Then I removed the systemd provider ($ sed -i 's/ systemd//g' /etc/nsswitch.conf) and the 90s hang was gone when starting with dbus-daemon --system --nofork. This was really a PITA to find out.

I could also verify that exactly this was the issue/difference for another Docker image I'm maintaining.

Upvotes: 1

Related Questions