How to disable internal webcam?
I want to disable the internal webcam of my laptop running Ubuntu 13.10? As suggested here, I already disabled the concerning kernel modules by blacklisting them. But after reboot the modules are loaded nevertheless. What can I do to get rid of these modules?
My module blacklist lies in /etc/modprobe.d/blacklist-webcam.conf
and looks like this:
blacklist videodev
blacklist videobuf2_core
blacklist videobuf2_memops
blacklist videobuf2_vmalloc
blacklist uvcvideo
But lsmod
gives me (after reboot):
Module Size Used by
uvcvideo 80885 0
videobuf2_vmalloc 13216 1 uvcvideo
videobuf2_memops 13362 1 videobuf2_vmalloc
videobuf2_core 40499 1 uvcvideo
videodev 133509 2 uvcvideo,videobuf2_core
Edit:
When I do a sudo modprobe -r uvcvideo
the modules are gone. So I could write a script to do that. But I would not consider that as a clean solution ;-)
Solution 1:
- In your blacklist.conf change
blacklist videodev
toinstall videodev /bin/false
update-initramfs -u
reboot
For more details see Kernel Modules Blacklisting on the Arch Wiki:
Blacklisting
Blacklisting, in the context of kernel modules, is a mechanism to prevent the kernel module from loading. This could be useful if, for example, the associated hardware is not needed, or if loading that module causes problems: for instance there may be two kernel modules that try to control the same piece of hardware, and loading them together would result in a conflict.
Some modules are loaded as part of the initramfs.
mkinitcpio -M
will print out all automatically detected modules: to prevent the initramfs from loading some of those modules, blacklist them in /etc/modprobe.d/modprobe.conf. Runningmkinitcpio -v
will list all modules pulled in by the various hooks (e.g. filesystems hook, block hook, etc.). Remember to add that .conf file to the FILES section in /etc/mkinitcpio.conf, if you have not done so already, and rebuild the initramfs once you have blacklisted the modules, and reboot afterwards.Using files in /etc/modprobe.d/
Create a .conf file inside /etc/modprobe.d/ and append a line for each module you want to blacklist, using the blacklist keyword. If for example you want to prevent the pcspkr module from loading:
/etc/modprobe.d/nobeep.conf # Do not load the 'pcspkr' module on boot. blacklist pcspkr
Note: The blacklist command will blacklist a module so that it will not be loaded automatically, but the module may be loaded if another non-blacklisted module depends on it or if it is loaded manually.
However, there is a workaround for this behaviour; the install command instructs modprobe to run a custom command instead of inserting the module in the kernel as normal, so you can force the module to always fail loading with:
/etc/modprobe.d/blacklist.conf ... install module_name /bin/false ...
This will effectively blacklist that module and any other that depends on it.
Solution 2:
Just putting the list of modules in /etc/modprobe.d/blacklist.uvcdrver.conf should work. The file name can be anything. Just make sure the format and permissions are correct.