Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 54 down vote accepted
# udevadm control --reload-rules
share|improve this answer
1  
Do you need udevtrigger afterwards? –  Nils May 26 '12 at 20:28
14  
@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. –  Gilles Mar 5 '13 at 10:28
5  
udevadm trigger did the trick on CentOS 6 for me. –  astrostl Aug 7 '13 at 18:19
    
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. –  enthusiasticgeek Jan 22 at 20:25
    
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. –  kostix Mar 20 at 15:53

Udev uses the inotify mechanism to watch for changes in the rules directory, in both the library and in the local configuration trees (typically located at /lib/udev/rules.d and /etc/udev/rules.d). So you don't need to do anything when you change a rules file.

You only need to notify the udev daemon explicitly if you're doing something unusual, for example if you have a rule that includes files in another directory. Then you can use the usual convention for asking daemons to reload their configuration: send a SIGHUP (pkill -HUP udevd). Or you can use the udevadm command: udevadm control --reload-rules.

The udev rules are only applied when a device is added. If you want to reapply the rules to a device that is already connected, you need to do this explicitly, by calling udevadm trigger with the right options to match the device(s) whose configuration has changed, e.g. udevadm trigger --attr-match=vendor='Yoyodyne' --attr-match=model='Frobnicator 300'.

share|improve this answer
    
+1 for the Pynchon reference :) –  jasonwryan Oct 20 '12 at 20:50
    
+1 for the hint about reconnecting the device. facepalm –  Raphael Dec 5 '12 at 21:12

I'm adding this because some day I will need it... again.

Sometimes you get an incorrect matching of ethernet device numbers and MAC addresses. Sometimes this is really important, like when running in a VM and each device is assigned to a different VLAN.

  1. Bring the network interfaces down, then
  2. modify /etc/udev/rules.d/70-persistent-net.rules (or its equivalent)
  3. re-load with udevadm control --reload-rules and finally
  4. re-trigger with udevadm trigger --attr-match=subsystem=net
  5. bring the network interfaces up.

I was surprised how well this worked.

share|improve this answer
1  
on Red Hat: service network stop && udevadm control --reload-rules; udevadm trigger --attr-match=subsystem=net; service network start –  Alexander Torstling Feb 19 at 12:40

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.

share|improve this answer
6  
Can you show a reference/git commit? –  drahnr Jan 6 '14 at 9:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.