LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 11:26 AM   #1
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 102
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 11:35 AM. Reason: not recied a proper answer
 
Old 01-26-2012, 11:28 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You need to be root to load a module to the kernel. Put sudo before the command.
 
Old 01-26-2012, 11:41 AM   #3
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 102

Original Poster
Blog Entries: 1

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, 12: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, 08:34 AM   #5
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 102

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
ThanQ for the reply its working fine now!!!
 
Old 03-13-2016, 08: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, 11:51 AM   #7
rpittala
Member
 
Registered: Jan 2012
Location: PUNE
Distribution: SunOS sun4v sparc sun4v Solaris
Posts: 102

Original Poster
Blog Entries: 1

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


Reply



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 09:34 AM
insmod, operation not permitted alfrag Linux - Software 2 01-07-2009 01:59 AM
HDIO_SET_DMA failed: Operation not permitted new.thing Slackware 21 09-15-2007 05:46 PM
HDIO_SET_DMA failed: Operation not permitted (???) Ellops Slackware 8 08-11-2006 06:00 PM
HDIO_SET_DMA failed: Operation not permitted acjt Linux - Hardware 4 05-02-2003 10:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Open Source Consulting | Domain Registration