Restarting udev on CentOS 6 (tethering a mobile phone using proxoid)

7,133

Those instructions aren't very good. Udev automatically detects changes to the rules files in normal circumstances, you don't need to restart it after changing or adding a file in /etc/udev/rules.d. On the other hand, the rules are applied when a device is plugged in: if you change the rules, it doesn't affect devices that are already connected. The instructions are telling you to restart the udev subsystem to apply the new rules.

If you already know the rules you want to add, add them first, then plug your device in. If you do things in that order, you don't need to do anything else.

You may need to first plug in your phone to find its vendor ID, then write a rule accordingly. If so, the easiest way to apply your changes is to unplug your phone and plug it back in after you've added the rule. Alternatively, to reapply the rules for a particular device, run

udevadm --trigger --attr-match=idVendor=xxxx

where xxxx is your phone's vendor ID.

See also How to reload udev rules without reboot?

Share:
7,133

Related videos on Youtube

Ayush Kumar
Author by

Ayush Kumar

Updated on September 18, 2022

Comments

  • Ayush Kumar
    Ayush Kumar almost 2 years

    I am trying to use proxoid (a proxy server to allow tethering like facility for mobile phones). This guide says that I need to restart the process udev similar to (in Ubuntu):

    sudo /etc/init.d/udev restart
    

    lsusb does list the mobile phone but I do not see a running process or a binary named as udev. There is a process udevd on CentOS /sbin/udevd. Is it the same as udev? I could not find specific information to CentOS as the centos.org site seems to be down for several hours now.

  • goldilocks
    goldilocks over 11 years
    It seems to me you did not bother to read the question properly? It was not asking about how to install udev (which does have installed/uninstallable/reinstallable userland components such as udevd), it was asking about how to restart the udev service which is a pretty normal straightforward thing for which there are normal straightforward commands.
  • goldilocks
    goldilocks over 11 years
    ...to be fair I just noticed the title of the question did include the word "Installing". Still, a quick read might have made this clear (?)
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 11 years
    @goldilocks Udev notices changes to its configuration directories through inotify (I think even CentOS 5 is not so ancient as to predate that). The only time you'd restart udev is when upgrading it.
  • goldilocks
    goldilocks over 11 years
    @Gilles : Yes -- I addressed that (implicitly) in my answer (see "However"). The issue here is not mine, it's from the google code doc the OP is consulting (might help to actually: read the original post, read the link the post refers to, read my answer). I'm not saying vonbrand is wrong, just that his/her answer is not particularly informative or helpful.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 11 years
    @goldilocks Your answer is correct but mostly irrelevant. The problem is not to re-read the rules file, that happens automatically. The problem is to apply the new rules. See my answer.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 11 years
    Reloading the rules happens automatically. What you need to do is apply the new rules, either by plugging the device out and back in, or running udevadm trigger.
  • goldilocks
    goldilocks over 11 years
    @Gilles : It's irrelevant to you because you already understand a) the difference between a process and a service b) udev, what it is and how to use it. The OP obviously does not, so that needs to be sorted out. I focussed on (a) because (b) is in fact less relevant (as you say, the rules are reloaded automatically, so anything and everything is irrelevant. Strictly, the questioner does not not need to know or do anything...)