LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   insmod error "operation not permitted" as root (https://www.linuxquestions.org/questions/linux-software-2/insmod-error-operation-not-permitted-as-root-836570/)

Philmac 10-06-2010 12:05 PM

insmod error "operation not permitted" as root
 
Hello,

I am trying to install a third party driver and the provided makefile makes a call to insmod. Whenever I try to install this I run "su", so I am root and should have permissions. However, when I run "make install" I get the following output:

Code:

# make install
Unloading any instances of foo module
Loading new foo into running kernel
insmod: error inserting 'foo.ko': -1 Operation not permitted
make: *** [install] Error 1

Like I said before, I'm doing this as root, so I don't see how this is possible. Additionally, every time I try to do this it seems to cause a lot of damage to whatever kernel I'm currently booted in; USB and ethernet (and hence the Internet) stop working and I have to wipe the kernel and reinstall it.

I'm currently running Fedora 9 kernel 2.6.27.25-78.2.56.fc9.x86_64

Any ideas?

Thanks in advance

mf93 10-06-2010 09:04 PM

try changing the permissions of the folder in which the makefile is located
for example:
Code:

# chmod -R 744 foo.d
where foo.d is the directory in which makefile resides

Philmac 10-07-2010 09:05 AM

Quote:

Originally Posted by mf93 (Post 4120018)
try changing the permissions of the folder in which the makefile is located
for example:
Code:

# chmod -R 744 foo.d
where foo.d is the directory in which makefile resides

Thanks for your reply mf93. I just tried what you said and according to "ls -l" the permissions for the directory are now "drwxr--r--". Unfortunately, I still get the exact same error message when I try "make install". Could it be a permissions issue with another directory? I have access to all the source files and can make any changes that might be necessary.

unSpawn 10-07-2010 09:23 AM

Try running 'make -n install 2>&1|tee /tmp/make.txt'. This will --dry-run the install part and log all details to the "/tmp/make.txt" plain text file. Maybe reading it shows some clues wrt commands, paths or permissions else you could attach it.

mf93 10-07-2010 09:35 AM

If changing the permissions for the install directory didnt fix it i doubt it will be a permissions problem.

Philmac 10-07-2010 09:42 AM

Quote:

Originally Posted by unSpawn (Post 4120521)
Try running 'make -n install 2>&1|tee /tmp/make.txt'. This will --dry-run the install part and log all details to the "/tmp/make.txt" plain text file. Maybe reading it shows some clues wrt commands, paths or permissions else you could attach it.

Thanks for your reply unSpawn. I'm new to Linux so I don't know how to interpret any of this -- here's the output.

Code:

$ make -n install 2>&1|tee /tmp/make.txt
echo "Unloading any instances of foo module"
if [ "`awk '/bar/ {print $1}' /proc/modules`" = "foo" ]; then \
        rmmod foo; \
        fi;
echo "Loading new foo into running kernel"
/sbin/insmod foo.ko
echo "Copy newly build module to /lib/modules/2.6.27.25-78.2.56.fc9.x86_64/kernel/drivers/company"
if [ ! -d /lib/modules/2.6.27.25-78.2.56.fc9.x86_64/kernel/drivers/company ]; then \
                mkdir /lib/modules/2.6.27.25-78.2.56.fc9.x86_64/kernel/drivers/company; \
        fi;
cp -f foo.ko /lib/modules/2.6.27.25-78.2.56.fc9.x86_64/kernel/drivers/company/foo.ko
echo "Remove previous foo character device file"
rm -f /dev/foo
echo "Creating character special file for driver"
mknod -m 666 /dev/foo c `awk '/bar/ {print $1}' /proc/devices` 0
echo "Adding entry to /etc/rc.d/rc.local"
if [ -f rc.local.temp ]; then \
                rm -r rc.local.temp; \
        fi;
if [ -f /etc/rc.d/rc.local ]; then \
                cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak; \
        else \
                touch /etc/rc.d/rc.local; \
        fi;       
# copy all lines, except those for foo module to temp file
awk 'BEGIN { eat=0; last=0; } \
        /load foo kernel module/ { eat=1; } \
        /end of foo load/ { eat=0; last=1 } \
        { \
        if (eat && last==0) true; \
        else if (eat==0 && last) \
        last=0; \
        else if (eat==0 && last==0) print  >> "rc.local.temp" \
        }'  <  /etc/rc.d/rc.local
#add entry for foo in the new file
echo "#load foo kernel module" >> rc.local.temp
echo "if [ -f /lib/modules/2.6.27.25-78.2.56.fc9.x86_64/kernel/drivers/company/foo.ko ]; then \\" >> rc.local.temp
echo "insmod /lib/modules/2.6.27.25-78.2.56.fc9.x86_64/kernel/drivers/company/foo.ko; \\" >> rc.local.temp
echo "fi;" >> rc.local.temp
echo "#end of foo load" >> rc.local.temp
#copy temp file to /etc/rc.d
mv -f rc.local.temp /etc/rc.d/rc.local
chmod 755 /etc/rc.d/rc.local


catkin 10-07-2010 09:50 AM

Can you install other modules?

Is there any more information in dmesg or the /var/log/[debug|messages|syslog|<other>] files?

Is the module for the correct architecture?

Does the module depend on other modules being loaded first (but likely a different error message if so)?

Philmac 10-07-2010 10:43 AM

Quote:

Originally Posted by catkin (Post 4120555)
Can you install other modules?

Is there any more information in dmesg or the /var/log/[debug|messages|syslog|<other>] files?

Is the module for the correct architecture?

Does the module depend on other modules being loaded first (but likely a different error message if so)?

Thanks for your reply catkin.

Can you install other modules?
I honestly don't know; I just started using Linux and this driver is the first time I've ever even heard of a module. Are there any fairly innocuous modules out there that I could use to test this?

Is there any more information in dmesg or the /var/log/[debug|messages|syslog|<other>] files?

dmesg
Code:

foo: module license 'Proprietary' taints kernel.
foo: DeviceName PCI interface not found
foo: DeviceName PCI interface not found
foo: DeviceName PCI interface not found

/var/log/messages
Code:

Oct  6 12:27:49 lisa kernel: foo: module license 'Proprietary' taints kernel.
Oct  6 12:27:49 lisa kernel: foo: DeviceName PCI interface not found
Oct  6 12:54:47 lisa kernel: foo: DeviceName PCI interface not found
Oct  7 10:02:33 lisa kernel: foo: DeviceName PCI interface not found

I didn't find anything else.

Is the module for the correct architecture?
Getting the module to simply compile was a big hassle. One of the things I had to change was replacing "i686" with "core2" in the makefiles (after updating gcc), so I think it's now compiled for my architecture.

Does the module depend on other modules being loaded first (but likely a different error message if so)?
Not that I'm aware of; the vendor's installation instructions don't mention any.

Philmac 10-08-2010 01:26 PM

Figured it out (sort of)! Had to replace insmod with depmod -a and modprobe then copy foo.ko to lib/modules/$(uname -r)/kernel/drivers/misc/

unSpawn 10-09-2010 03:13 PM

Quote:

Originally Posted by Philmac (Post 4121729)
Figured it out (sort of)! Had to replace insmod with depmod -a and modprobe then copy foo.ko to lib/modules/$(uname -r)/kernel/drivers/misc/

Thanks for posting your solution.

mf93 10-11-2010 10:36 PM

why is it only sort of figured out? and if youve solved it mark the thread solved


All times are GMT -5. The time now is 04:19 PM.