LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-26-2012, 12:26 PM   #1
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 56
Blog Entries: 1

Rep: Reputation: Disabled
Red face ubuntu 11.4 insmod failed operation not permitted


rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ cat hello.c
#include<kernel.h>
#include<linux/module.h>
#include<linux/init.h>
int my_init(void)
{
printk("Hello world \n");
return 0;
}
void my_cleanup(void)
{
printk("Goodbye world \n");
}
module_init(my_init);
module_exit(my_cleanup);
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ make
make -C /lib/modules/2.6.35-22-generic/build M=/home/rajesh/raja/dev_drivers modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.35-22-generic'
Building modules, stage 2.
MODPOST 0 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.35-22-generic'
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ sudo insmod hello.ko
[sudo] password for rajesh:
insmod: error inserting 'hello.ko': -1 File exists
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ ls
hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile module.ko module.mod.c module.mod.o module.o modules.order Module.symvers
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ sudo insmod he
he hecubafb hed hexium_gemini hexium_orion
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ ls
hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile module.ko module.mod.c module.mod.o module.o modules.order Module.symvers


please help me out in solving

Last edited by rpittala; 01-26-2012 at 12:35 PM. Reason: not recied a proper answer
 
Old 01-26-2012, 12:28 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
You need to be root to load a module to the kernel. Put sudo before the command.
 
Old 01-26-2012, 12:41 PM   #3
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 56
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
tried with sudo ? yes ..still insmod failed

rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ cat hello.c
#include<kernel.h>
#include<linux/module.h>
#include<linux/init.h>
int my_init(void)
{
printk("Hello world \n");
return 0;
}
void my_cleanup(void)
{
printk("Goodbye world \n");
}
module_init(my_init);
module_exit(my_cleanup);
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ make
make -C /lib/modules/2.6.35-22-generic/build M=/home/rajesh/raja/dev_drivers modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.35-22-generic'
Building modules, stage 2.
MODPOST 0 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.35-22-generic'
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ sudo insmod hello.ko
[sudo] password for rajesh:
insmod: error inserting 'hello.ko': -1 File exists
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ ls
hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile module.ko module.mod.c module.mod.o module.o modules.order Module.symvers
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ sudo insmod he
he hecubafb hed hexium_gemini hexium_orion
rajesh@rajesh-Inspiron-N5110:~/raja/dev_drivers$ ls
hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile module.ko module.mod.c module.mod.o module.o modules.order Module.symvers
 
Old 01-27-2012, 01:29 AM   #4
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
Please read the error that it is throwing
Quote:
insmod: error inserting 'hello.ko': -1 File exists
That means you have already inserted this module and have not removed it. Use rmmod to remove the module and then try to insert it i.e.

Quote:
sudo rmmod hello
sudo insmod hello.ko
 
Old 01-27-2012, 09:34 AM   #5
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 56
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
ThanQ for the reply its working fine now!!!
 
Old 03-13-2016, 09:28 AM   #6
kshikhar
LQ Newbie
 
Registered: Mar 2016
Posts: 1

Rep: Reputation: Disabled
Thanks bsat

Quote:
Originally Posted by bsat View Post
Please read the error that it is throwing


That means you have already inserted this module and have not removed it. Use rmmod to remove the module and then try to insert it i.e.
Thanks a lot bsat!!
It worked
 
Old 03-13-2016, 12:51 PM   #7
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 56
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
My Friend Kshikhar, it does not make any sense when you respond to an old solved thread.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to install driver-insmod: error inserting 'foo.ko': -1 Operation not permitted Philmac Linux - Software 2 10-04-2010 10:34 AM
insmod, operation not permitted alfrag Linux - Software 2 01-07-2009 02:59 AM
HDIO_SET_DMA failed: Operation not permitted new.thing Slackware 21 09-15-2007 06:46 PM
HDIO_SET_DMA failed: Operation not permitted (???) Ellops Slackware 8 08-11-2006 07:00 PM
HDIO_SET_DMA failed: Operation not permitted acjt Linux - Hardware 4 05-02-2003 11:52 PM


All times are GMT -5. The time now is 11:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration