[systemd-devel] reliable way to check if udev is ready to serve requests

Lennart Poettering lennart at poettering.net
Fri Oct 12 08:42:33 UTC 2018


On Fr, 12.10.18 03:57, Michael Biebl (mbiebl at gmail.com) wrote:

> > > is there a reliable way to check from a shell script that udevd is
> > > running and able to serve request?
> > > Say you want to run "udevadm trigger" but only if udevd is actually
> > > able to process that request.
> > >
> > > There is a udev_ctrl_send_ping() function, which looks like it could
> > > be perhaps used for those. Unfortunately this is not exposed via
> > > "udevadm control"
> >
> > systemctl is-running systemd-udevd-kernel.socket
> 
> I forgot to add, that systemd-udevd is not necessarily started by
> systemd in this particular case. So I can't use systemctl...

Well, that depends on the init system you want to use, so consider
asking their community for help, how they allow you to check whether a
socket is started up correctly (or a service, in case socket
activation is not supported).

For legacy systems udevd still supports forking things into the
background, hence if you know when the udevd starter process (i.e. the
"parent") exits then you should know when the service is up.

Either way, this is really out of scope for systemd, it's a question
you can only answer in the context of the init system used, as on
socket activation capable systems udev will be able to process events
that happen even before the daemon itself is up while on legacy
systems the daemon must be up first.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list