How to reload udev rules without reboot?

  • How should one reload udev rules, so that newly created one can function?

    I'm running Arch Linux, and I don't have a udevstart command here.

    Also checked /etc/rc.d, no udev service there.

    Please note that more recent versions of udev have dropped the inotify support so the reloading of the rules on change is needed more often these days.

    What is `udev`? Is it the manager of `/dev` ?

    @Sandburg yes it handles plug-n-play on Linux systems.

  • # udevadm control --reload-rules && udevadm trigger
    

    Do you need `udevtrigger` afterwards?

    @Nils Actually, you may need `udevtrigger` (or rather `udevadm trigger` on most distributions) instead (that, or plug the device out and back it). `--reload-rules` is almost always useless as it happens automatically.

    `udevadm trigger` did the trick on CentOS 6 for me.

    `udevtrigger` or `udevadm trigger` did not work for me. I found some devices will work after unloading and loading the module for the same (assuming it is loadable module). What I found out is one does not necessarily have to reboot the system. Example for a network device, I do `rmmod ixgbe`, `rmmod tg3`,`rmmod e1000` then `modprobe ixgbe`, `modprobe tg3`,`modprobe e1000` depending on type of network driver.

    Neither of things mentioned among the answers worked for me on Debian Jessie (8.0). The thing which worked is `ip link set $oldname name $newname` mentioned here. In my case, I needed to replace an iface named `lan` with a bridged iface (for KVM), and hence the original--now underlying--iface had to get its old name, `eth1`, back. So the trick was: 1) bring iface down; 2) fix network config up; 3) update udev naming rules file; 4) rename the iface using `ip link...`; 5) bring the bridge up.

    Don't forget, you may need to unplug and plug the device back in to load the new rules for it.

    for remote pcs and usb disks: `modprobe -r usb_storage ; modprobe usb_storage`

    I did have to `sudo udevadm trigger` after this, though removing the sudo didn't show any error, I didn't actually see any change until I ran it w/ sudo

    On Debian testing 'udevadm trigger' does not work. I had to unplug and plug usb ethernet card only then udev triggered new rule.

    I required `sudo udevadm trigger` instead of `udevadm trigger` as well. See my comments under this answer here: https://askubuntu.com/questions/1048870/permission-denied-to-non-root-user-for-usb-device/1187646#1187646. Doing it *with* sudo took ~2 sec, but doing it withOUT sudo took only ~0.2 sec. So clearly they are not doing the same thing for me.

    @JacobMinshall, if you or anyone else confirms `sudo` is in fact required, as I think it is, here's an answer for that to be upvoted to indicate that: https://unix.stackexchange.com/questions/39370/how-to-reload-udev-rules-without-reboot/567996#567996.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM