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 } stop_all /usr/lib/systemd/systemd-udevd --daemon udevadm trigger --action=add --type=devices echo $? #sleep 1 #udevadm settle udevadm control --exit echo $? # 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 # If you do not add `sleep 1` after the trigger to give udevd # extra time to finish its job, it'll take a long time to stop # but still not finishing its job # The settle service/command MIGHT work here, NOT because it # has a mechanism to make sure everything is done (maybe it # is expected to but it does not), BUT only because the extra # "overhead" it brings, so it might not work if it is "faster" # than `sleep 1` in certain case. # The question is, can there be something more reliable than # `sleep 1`?