stop_all() { systemctl stop systemd-udevd-control.socket systemctl stop systemd-udevd-kernel.socket systemctl stop systemd-udevd.service systemctl stop systemd-udev-trigger.service systemctl stop systemd-udev-settle.service } # If you stop the udevd sockets after the service, you might see: # "Job for systemd-udevd.service canceled." # If you do not stop the sockets, you might also see the message, # and the job (applying a udev rule) will be finished after a long # time by the udevd spawned trigger_systemd() { systemctl start systemd-udevd.service systemctl start systemd-udev-trigger.service #sleep 1 #systemctl start systemd-udev-settle stop_all } # Udevd will wait for its timeout (30s by default) but not finish its job trigger() { /usr/lib/systemd/systemd-udevd --daemon udevadm trigger --action=add --type=devices echo $? #sleep 1 #udevadm settle udevadm control --exit echo $? } # Udevd will exit immediately no matter in spite of the timeout params # of all commands stop_all #trigger #trigger_systemd # The settle service/command serve as a reference here. # I am not sure if it is supposed to be the "safe guard" for this issue. # But if it works here, it is only because provide extra overhead, # not because of its internal mechanism.