how can i deactivate a udev rule?

Tom H tomh0665 at gmail.com
Sun Apr 24 20:56:07 UTC 2011


On Sat, Apr 23, 2011 at 7:34 AM, Robert P. J. Day <rpjday at crashcourse.ca> wrote:
>
>  this might more properly be a kernel question but for now, it's
> userspace related.  how can i deactivate a udev rule so that the
> appropriate device file is *not* created at module load time?  i tried
> commenting out the rule in the rules file, then i ran:
>
>  $ sudo udevadm control --reload-rules
>
> even though the udevadm man page suggests that's not necessary but
> that didn't do it.
>
>  specifically (and just as an exercise), i want to disable the
> creation of /dev/kvm when my kvm-intel module is loaded, just as a
> demonstration for how udev works.
>
>  right this second, i have no kvm-related modules loaded and there is
> no /dev/kvm file.  if i:
>
>  $ sudo modprobe kvm-intel    [on my intel core i3 system]
>
> not only are the kvm and kvm-intel modules loaded, but i predictably
> get the device file:
>
> crw-rw----+ 1 root kvm 10, 232 2011-04-23 07:30 /dev/kvm
>
> which i assume is due to the contents of the file
> /lib/udev/rules.d/45-qemu-kvm.rules:
>
> KERNEL=="kvm", GROUP="kvm", MODE="0660"
>
> and if i unload those modules, the /dev/kvm file vanishes -- all
> proper and appropriate behaviour.
>
>  but if i comment out that line in that udev file and load my kvm
> modules, i still get that /dev/kvm file.  what am i overlooking?

AFAIK, If loading the kernel module exports its data to sysfs (as it
should), udev'll create a device in spite of a rule not existing.




More information about the ubuntu-users mailing list