Re: [systemd-devel] how to correctly specify dependency on dbus
On Tue, 23.05.17 23:01, prashantkumar dhotre (prashantkumardho...@gmail.com) wrote: > Thanks. > my service runs during early bootup. > one intermittent issue I am seeing is that my service fails in > dbus_bus_get_private() with error: > > 07:45:19 : dbus_bus_get_private() failed with error: Failed to > connect to socket /var/run/dbus/system_bus_socket: No such file or > directory > > > dbus service started at 07:44:34 and my service started at 07:45:19 > which is 45 sec after dbus and also I see > /var/run/dbus/system_bus_socket present before this error. > not sure why dbus API is failing even though the socket is present. > So am I missing to add any dependency in my service file ? Maybe you haven#t configured dbus for socket activation, and dbus-daemon replaces the sockets already created or so? Also, /var/run is an old name for /run, and should nowadays just be a symlink. Is it possible that symlink is missing for you? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to correctly specify dependency on dbus
Thanks. my service runs during early bootup. one intermittent issue I am seeing is that my service fails in dbus_bus_get_private() with error: 07:45:19 : dbus_bus_get_private() failed with error: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory dbus service started at 07:44:34 and my service started at 07:45:19 which is 45 sec after dbus and also I see /var/run/dbus/system_bus_socket present before this error. #systemctl status dbus : * dbus.service - D-Bus System Message Bus Loaded: loaded (/lib/systemd/system/dbus.service; static; vendor preset: enabled) Active: active (running) since Tue 2017-05-02 07:44:34 UTC; 40s ago Docs: man:dbus-daemon(1) Main PID: 1574 (dbus-daemon) CGroup: /system.slice/dbus.service `-1574 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation 07:45:15: netstat -anp | grep dbus : unix 2 [ ACC ] STREAM LISTENING 116811/init /var/run/dbus/system_bus_socket unix 3 [ ] STREAM CONNECTED 118311574/dbus-daemon unix 3 [ ] STREAM CONNECTED 109071574/dbus-daemon unix 3 [ ] STREAM CONNECTED 118301574/dbus-daemon unix 3 [ ] STREAM CONNECTED 11833 1574/dbus-daemon/var/run/dbus/system_bus_socket unix 3 [ ] STREAM CONNECTED 11832 1574/dbus-daemon/var/run/dbus/system_bus_socket not sure why dbus API is failing even though the socket is present. So am I missing to add any dependency in my service file ? On Sat, Apr 29, 2017 at 10:36 PM, Lennart Poetteringwrote: > On Wed, 26.04.17 10:09, prashantkumar dhotre (prashantkumardho...@gmail.com) > wrote: > >> Hi >> For my service, I have: >> >> # cat my.service >> [Unit] >> Description=My Service >> After=dbus.service >> Requires=dbus.service >> ... >> ... >> >> Some time i see that my service fails to get dbus connection >> (dbus_bus_get_private() fails without any error msg). >> one possibility i think is that dbus is not fully initialized. >> From above service file config, i understand when i start my service, >> dbus service is started 1st and then my service. >> but i am not sure if my service start step is delayed until dbus is >> fully up , initialized and running and ready to accept conections. >> is there a way to specify this in my service file. > > Regular system services do not have to declare any explicit dependency > on D-Bus, as D-Bus is always and unconditionally available in the later > boot phase (where regular services are started) and during runtime. > > If your service runs during the early boot phase however (i.e. before > basic.target is reached, meaning your service has > DefaultDependencies=no set), then you do need an explicit dependency, > but should only specify it as After=dbus.socket + > Requires=dbus.socket (i.e. on the socket rather than the service). > > If you don't know whether your service is an early or late boot > service then it's almost certainly a late boot service. > >> For ex, for systemd-networkd,service, i see it specify like : >> >> # On kdbus systems we pull in the busname explicitly, because it >> # carries policy that allows the daemon to acquire its name. >> Wants=org.freedesktop.network1.busname >> After=org.freedesktop.network1.busname >> >> >> Can i use same (specifying After/Wants on a dbus name) ? > > Please ignore anything related to kdbus in the source, this is > supported no longer, and does not apply to regular D-Bus. > > > > Lennart > > -- > Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to correctly specify dependency on dbus
On Wed, 26.04.17 10:09, prashantkumar dhotre (prashantkumardho...@gmail.com) wrote: > Hi > For my service, I have: > > # cat my.service > [Unit] > Description=My Service > After=dbus.service > Requires=dbus.service > ... > ... > > Some time i see that my service fails to get dbus connection > (dbus_bus_get_private() fails without any error msg). > one possibility i think is that dbus is not fully initialized. > From above service file config, i understand when i start my service, > dbus service is started 1st and then my service. > but i am not sure if my service start step is delayed until dbus is > fully up , initialized and running and ready to accept conections. > is there a way to specify this in my service file. Regular system services do not have to declare any explicit dependency on D-Bus, as D-Bus is always and unconditionally available in the later boot phase (where regular services are started) and during runtime. If your service runs during the early boot phase however (i.e. before basic.target is reached, meaning your service has DefaultDependencies=no set), then you do need an explicit dependency, but should only specify it as After=dbus.socket + Requires=dbus.socket (i.e. on the socket rather than the service). If you don't know whether your service is an early or late boot service then it's almost certainly a late boot service. > For ex, for systemd-networkd,service, i see it specify like : > > # On kdbus systems we pull in the busname explicitly, because it > # carries policy that allows the daemon to acquire its name. > Wants=org.freedesktop.network1.busname > After=org.freedesktop.network1.busname > > > Can i use same (specifying After/Wants on a dbus name) ? Please ignore anything related to kdbus in the source, this is supported no longer, and does not apply to regular D-Bus. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] how to correctly specify dependency on dbus
Hi For my service, I have: # cat my.service [Unit] Description=My Service After=dbus.service Requires=dbus.service ... ... Some time i see that my service fails to get dbus connection (dbus_bus_get_private() fails without any error msg). one possibility i think is that dbus is not fully initialized. From above service file config, i understand when i start my service, dbus service is started 1st and then my service. but i am not sure if my service start step is delayed until dbus is fully up , initialized and running and ready to accept conections. is there a way to specify this in my service file. For ex, for systemd-networkd,service, i see it specify like : # On kdbus systems we pull in the busname explicitly, because it # carries policy that allows the daemon to acquire its name. Wants=org.freedesktop.network1.busname After=org.freedesktop.network1.busname Can i use same (specifying After/Wants on a dbus name) ? Appreciate your help on this. Thanks ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel