LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Question about modprobe and blacklist (https://www.linuxquestions.org/questions/linux-newbie-8/question-about-modprobe-and-blacklist-4175469306/)

flyinggeorge 07-11-2013 02:57 PM

Question about modprobe and blacklist
 
Hello there! I'm asking this question mostly because I do not know exactly how to go about getting the answer.

This isn't a problem, really, but when I boot my system modprobe automatically loads 'psmouse' module for the touchpad on my laptop. Which is great, and would be really great if I didn't happen to have a wireless mouse around. I personally find that the touchpad gets in the way and I've always just used rmmod to remove the psmouse module. So my question is, if I were to blacklist the psmouse module, would I be able to load with modprobe? It seems like blacklisting the module is too permanent of a solution. Is there a way that I can prevent psmouse from loading on boot but still be able to modprobe it later if needed?

joe_2000 07-11-2013 03:03 PM

You could unload the module upon login:

Code:

modprobe -r psmouse
If you want to do that without having to type a password put the above command in a script and put it into e.g. /usr/local/bin editable only by root.
Then allow the script to be executed by the standard user with sudo by setting the NOPASSWD flag in the sudoers file. (use
Code:

visudo
to edit that file.)
Then you could put the call to that script in your autostart script.
You could then also assign a keyboard shortcut to that script to be able to easily switch the touchpad on and off

flyinggeorge 07-11-2013 03:06 PM

That's basically what I am doing now, although I had not considered adding modprobe -r or rmmod to any startup script.

Is there any other way to tell modprobe to not load that particular module on boot? Other than blacklist. Again, this isn't really a problem or anything, but curious minds would like to know.

I also don't keep my user in the sudoers file. I don't see much need to since I am the only user of this machine. Plus if someone got on this box it would be easier to get my user password than my root password I would imagine. So why give them the option of sudo -l or sudo su?

Edit* If I take psmouse.conf out of /lib/modprobe.d will udev still load it at boot time? Or am I misunderstanding the process? Also this wouldn't stop me from probing the module (modprobe psmouse) would it?

joe_2000 07-11-2013 04:56 PM

Quote:

Originally Posted by flyinggeorge (Post 4988615)
Is there any other way to tell modprobe to not load that particular module on boot? Other than blacklist. Again, this isn't really a problem or anything, but curious minds would like to know.

Hmm, I understand that, but sorry, don't know.

Quote:

Originally Posted by flyinggeorge (Post 4988615)
I also don't keep my user in the sudoers file. I don't see much need to since I am the only user of this machine. Plus if someone got on this box it would be easier to get my user password than my root password I would imagine. So why give them the option of sudo -l or sudo su?

Hmm, I don't know why it would be easier to get your user then root password. Note by the way that someone who has physical access to your machine can hack it in 2 minutes anyhow. You can just modify a boot paramater in grub (from the grub boot screen) and boot into a password-free root shell. If you want to keep people with physical access away from your machine you have to use other means than just disabling sudo.

I use sudo mainly to make commands password-free which would otherwise require root privileges. That enables me to conveniently call them from startup scripts and/or keyboard shortcuts. Obviously this should not be done with commands that could modify your system, but I think unloading the touch pad module should be ok...

flyinggeorge 07-11-2013 05:47 PM

I see what you mean about the sudoers file. I don't think I need to worry about anyone gaining access to my box as I live alone and none of my friends are linux savvy. I had just assumed (based on nothing of course :D ) that if someone were to use a net-based attack they would probably get into my user since I never log in as root unless I need to do something. On the other hand I have no idea how root kits work or anything like that, so you are probably right.

I'm not going to mark this solved yet, just in case anyone has any ideas that haven't already been stated. Thank you for your input, joe

joe_2000 07-12-2013 03:18 AM

I was just thinking of one more thing, which still is no direct answer to your question but may be useful to your original problem.

Have you used syndaemon yet? It locks your touchpad while typing. Again something you might want to put in your startup script:

Code:

syndaemon -d &

flyinggeorge 07-12-2013 03:58 PM

That is useful! Although you are correct, it's not exactly what I was looking for, that would probably work just as well. Still going to leave this thread open just in case anyone else knows anything. Thank you for your help, joe.

joe_2000 07-12-2013 04:10 PM

You are welcome :-)

wstewart90 07-13-2013 01:34 AM

I think you may want to check out /etc/X11/xorg.conf or /etc/X11/xorg.conf.d/. See if you have a synaptics input file in that directory or any other file related to input like evdev.conf or something. I believe on my distro I would just comment out <MatchIsTouchpad "on"> or change it to "off" but it could vary by distro. I believe that would be the most appropriate way to disable your touchpad.

wstewart90 07-13-2013 01:41 AM

Quote:

Originally Posted by flyinggeorge (Post 4988615)
That's basically what I am doing now, although I had not considered adding modprobe -r or rmmod to any startup script.

Is there any other way to tell modprobe to not load that particular module on boot? Other than blacklist. Again, this isn't really a problem or anything, but curious minds would like to know.

I also don't keep my user in the sudoers file. I don't see much need to since I am the only user of this machine. Plus if someone got on this box it would be easier to get my user password than my root password I would imagine. So why give them the option of sudo -l or sudo su?

Edit* If I take psmouse.conf out of /lib/modprobe.d will udev still load it at boot time? Or am I misunderstanding the process? Also this wouldn't stop me from probing the module (modprobe psmouse) would it?

If you actually have a psmouse.conf file and it's responsible for loading the psmouse module then you should be able to remove the file to solve your problem. I would only remove it if it has something simple in it like the name of the module and only that. If it has alot of extra text in it then I would just look through it and comment out the part that loads the psmouse module. I don't have a psmouse.conf yet the module still loads on my system so if that doesn't work then you may in fact need to stop the touch pad from loading through a file in the /etc/X11/xorg.conf.d/ directory. My guess is that evdev or the synaptics input driver loads the module in a method that I can only control the the xorg.conf files.

Also, if you remove the file, you should still be able to load the module with modprobe later on. Even if you blacklist the module you could always load it with "insmod /lib/modules/`uname -r`/kernel/drivers/input/mouse/psmouse.ko.gz". You can even set that up as an alias. insmod operates at a lower level so blacklisting the module wouldn't prevent you from loading it with insmod.

flyinggeorge 07-14-2013 05:20 PM

Actually I took a look in the .conf file (should have done that before posting, silly me.) and it doesn't have any options in it. It just has some commented out examples of options. I think I will try blacklisting psmouse and using insmod with an alias to load it if need be. Thank you for the suggestion.

Edit: Just gave that a shot and so far it's working. I haven't rebooted (I see no need to at this time.) but modprobe psmouse returns "No such module: psmouse" which is good. Using the insmod command, I am able to load the psmouse module and can remove it as before with rmmod psmouse.


All times are GMT -5. The time now is 06:54 PM.