LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-31-2006, 09:13 AM   #1
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Rep: Reputation: 15
Question Trigger action when module is inserted (wake on lan)


Hi forum,

can anyone tell me how to trigger an action when a module il inserted?

My aim is to activate wake on lan, I have to activate the option on my NIC everytime I boot, so the most logic way of doing this is to trigger the small line of code (that I don't remember by now ) every time I load the modle for my NIC.

Any idea anyone?
 
Old 03-31-2006, 11:34 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If your devices module supports options (modinfo modulename) why not add it to modules.conf, modprobe.conf or whatever the file is that lists module options? Else if it doesnt support options then you can possibly set it using ethtool/mii-tool using a "install <module> && { perform <action> }" line or post-install line.
 
Old 04-03-2006, 03:02 AM   #3
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Original Poster
Rep: Reputation: 15
It sounds clear, but still...

Hi unSpawn,

could you be a bit more explicit? I don't really get it how I can see if this module supports options... but let's suppose it does, what next?

Thanks for your answer!!
 
Old 04-03-2006, 07:47 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
could you be a bit more explicit?
Dunno if I can manage that. I thought I'd been quite verbose this time. OK. benefit of doubt, then...


I don't really get it how I can see if this module supports options...
Check with "modinfo modulename" where modulename is just the "short name" of your module. Like "processor" or "floppy".


but let's suppose it does, what next?
Find out what it is your distribution and kernel (there's a difference in the mechanism between how 2.4.x and 2.6.x kernels do this) uses to specify loading modules. Usually the conf files reside in /etc and are named something like modules.conf or modprobe.conf. Look inside these ASCII files for examples: if unsure post and I'm sure someone will comment.
 
Old 04-03-2006, 10:16 AM   #5
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Original Poster
Rep: Reputation: 15
Talking Did I get this right?

Hi unSpawn,

I'll try to be a bit clearer...
I'm runnig debian unstable on amd64 kernel 2.6.15-1-amd64-generic. The module that should trigger an action is my NIC driver (sk98lin). The action to trigger is ´ethtool -s eth0 wol G´.

So, I should add this somewhere in my /etc/modules.con?

I think we're geting close :d

Thanks for your help!
 
Old 04-03-2006, 10:33 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please look inside /etc/modules.conf for examples.
If unsure post and I'm sure someone will comment.
 
Old 04-03-2006, 05:43 PM   #7
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Original Poster
Rep: Reputation: 15
Is this correct?

Hi again,

I tried this (in /etc/modules.conf), and it doesn't seem to work

post-install sk98lin ethtool -s eth0 wol g

What next?
 
Old 04-04-2006, 12:00 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
it doesn't seem to work
Tell me in detail how you tested it?
Are there any errors? In your syslog?
Is this line below the "options sk98lin" line?
Just in case post your modules.conf anyway.
 
Old 04-05-2006, 02:38 AM   #9
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Original Poster
Rep: Reputation: 15
My modules.conf

unSpawn,

Alright, here's my modules.conf (I've cut it a bit 'cause it's quite long)

Code:
### This file is automatically generated by update-modules
#
# Please do not edit this file directly. If you want to change or add
# anything please take a look at the files in /etc/modutils and read
# the manpage for update-modules.
#
### update-modules: start processing /etc/modutils/0keep
# DO NOT MODIFY THIS FILE!
# This file is not marked as conffile to make sure if you upgrade modutils
# it will be restored in case some modifications have been made.
#
# The keep command is necessary to prevent insmod and friends from ignoring
# the builtin defaults of a path-statement is encountered. Until all other
# packages use the new `add path'-statement this keep-statement is essential
# to keep your system working
keep

### update-modules: end processing /etc/modutils/0keep

### update-modules: start processing /etc/modutils/actions
# Special actions that are needed for some modules

# The BTTV module, up to kernel 2.4.17, does not load the tuner 
# module automatically, so do that in here
if KERNEL_VER < 2.4.17
 	post-install bttv insmod tuner
 	post-remove bttv rmmod tuner
endif

### update-modules: end processing /etc/modutils/actions

### update-modules: start processing /etc/modutils/aliases
# Aliases to tell insmod/modprobe which modules to use

# Uncomment the network protocols you don't want loaded:
# alias net-pf-1 off		# Unix



...



# Crypto modules (see http://www.kerneli.org/)
alias loop-xfer-gen-0	loop_gen
alias loop-xfer-3	loop_fish2
alias loop-xfer-gen-10	loop_gen
alias cipher-2		des
alias cipher-3		fish2
alias cipher-4		blowfish
alias cipher-6		idea
alias cipher-7		serp6f
alias cipher-8		mars6
alias cipher-11		rc62
alias cipher-15		dfc2
alias cipher-16		rijndael
alias cipher-17		rc5

# IDE modules changed names in 2.4.22
if KERNEL_VER >= 2.4.22
   alias ide-mod ide-core
   alias ide-probe-mod ide-detect
endif


### update-modules: end processing /etc/modutils/aliases

### update-modules: start processing /etc/modutils/alsa-base
# autoloader aliases
alias char-major-116 snd
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0

...

above snd-mixer snd-mixer-oss
above snd-seq snd-seq-oss snd-seq-midi
above snd-emu10k1 snd-emu10k1-synth
above snd-via82xx snd-seq
# Cause a script to be run after snd-*-synth module initialization


post-install sk98lin ethtool -s eth0 wol g


post-install snd-emu8000-synth /lib/alsa/modprobe-post-install snd-emu8000-synth
post-install snd-emu10k1-synth /lib/alsa/modprobe-post-install snd-emu10k1-synth
# Cause a script to be run after card driver module initialization
post-install snd-ad1816a /lib/alsa/modprobe-post-install snd-ad1816a
post-install snd-ad1848 /lib/alsa/modprobe-post-install snd-ad1848

...

post-install snd-trident /lib/alsa/modprobe-post-install snd-trident
post-install snd-usb-audio /lib/alsa/modprobe-post-install snd-usb-audio
post-install snd-usb-usx2y /lib/alsa/modprobe-post-install snd-usb-usx2y
post-install snd-vx222 /lib/alsa/modprobe-post-install snd-vx222
post-install snd-vxpocket /lib/alsa/modprobe-post-install snd-vxpocket
post-install snd-wavefront /lib/alsa/modprobe-post-install snd-wavefront
post-install snd-ymfpci /lib/alsa/modprobe-post-install snd-ymfpci
# Prevent abnormal drivers from grabbing index 0
options snd-bt87x index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2

### update-modules: end processing /etc/modutils/alsa-base

### update-modules: start processing /etc/modutils/alsa-base-blacklist
# Uncomment these entries in order to blacklist unwanted modem drivers
# alias snd-atiixp-modem off
# alias snd-intel8x0m off
# alias snd-via82xx-modem off

### update-modules: end processing /etc/modutils/alsa-base-blacklist

### update-modules: start processing /etc/modutils/apm
alias char-major-10-134	apm
alias /dev/apm_bios		/dev/misc/apm_bios
alias /dev/misc/apm_bios	apm

### update-modules: end processing /etc/modutils/apm

### update-modules: start processing /etc/modutils/linux-sound-base_noOSS

...

alias sequencer off
alias soundcard off
alias usb-midi off

### update-modules: end processing /etc/modutils/linux-sound-base_noOSS

### update-modules: start processing /etc/modutils/paths
# This file contains a list of paths that modprobe should scan,
# beside the ones that are compiled into the modutils tools
# themselves.


### update-modules: end processing /etc/modutils/paths
I don't have anything about this in my syslog...

Maybe the problem is that I have to write a script that does my ethtool stuff so I don't have arguments in my modules.conf?

Hope it helps... (me )
 
Old 04-05-2006, 08:35 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Alright, here's my modules.conf (I've cut it a bit 'cause it's quite long)
Just an OT remark but if you're gonna cut things using something like "grep -v "^#" file|grep -i [a-z]" will show you only the used lines and leave out the comments. Makes it better readable IMHO. You'll know it comes in handy once you start working with large confs like for Squid or confs that have a lot of defaults, but commented out, like sshd_config.
BTW, I don't see nothing weird in your /etc/modules.conf.


I don't have anything about this in my syslog
Ah, OK. Maybe look for logfiles in /var/log/ksymoops/ if you have that directory.


Maybe the problem is that I have to write a script that does my ethtool stuff so I don't have arguments in my modules.conf?
That shouldn't be necessary. I'm wondering how you did test it doesn't work. Let's test it by adding this line in /etc/modules.conf (placing doesn't matter as long as it's on its own line:
Code:
post-install sk98lin /sbin/ethtool -s eth0 wol g 2>/tmp/sk98lin.err >/tmp/sk98lin.log
After you "rmmod sk98lin && modprobe sk98lin" check /tmp/sk98lin.err and /tmp/sk98lin.log and also post output of "modinfo sk98lin". Thanks.
 
Old 04-07-2006, 01:18 AM   #11
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Original Poster
Rep: Reputation: 15
I think I'm going slightly mad...

I've put this in my /etc/modules.conf:
<code>
post-install sk98lin /bin/echo zut > /home/benjalien/modprobelog
</code>
and when I run this:
<code>
rmmod sk98lin; modprobe sk98lin
</code>
nothing happens...
 
Old 04-07-2006, 02:07 AM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
It seems Debian insists on dynamically creating /etc/modules.conf from stuff in /etc/modutils. So try adding the line to /etc/modutils/local instead and run update-modules or equivalent after that.

BTW, saying "nothing happens" isn't very methodical. If you would have said: "the line still is in /etc/modules.conf and /var/log/ksymoops/* and syslog don't contain any (error) messages and there's nothing on stdout/stderr" we would have known you checked all possibilities given. If this still doesn't work you better start reading up on how to set up modules in Debian yourself.

Last edited by unSpawn; 04-07-2006 at 02:14 AM.
 
Old 04-25-2006, 01:16 AM   #13
benjalien
Member
 
Registered: Aug 2003
Location: Belgium
Distribution: Debian (i686/ppc/amd64)
Posts: 86

Original Poster
Rep: Reputation: 15
I may get the finger on the problem

UnSpawn,

first of all, sorry for the delay.

I think I may have some kind of answer, when I rmmod sk98lin, my eth0 doesn't go down, so I must be trying to get it to work on the wrong module...

I tought it was this module 'cause I'd looked in the 'lsmod -vv' and the module config tool (makr menuconfig). But it looks like I was wrong.

So, I'll think a bit more about it, and post again if I find something new, so I won't waste your time for nothing.

Thanks for you help until now, and see you soon for a post with something really new!

Benja
 
  


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
Wake on LAN DennyB Linux - Hardware 1 08-21-2007 07:27 AM
wake on lan upload-3 Linux - Networking 2 06-12-2006 01:00 PM
wake on lan ampena Debian 3 11-16-2005 06:21 AM
Wake-on-LAN dARkHunTEr Linux - Hardware 0 11-04-2003 04:17 PM
wake-on-lan PlatinumRik Linux - Hardware 1 04-09-2003 03:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:54 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
Open Source Consulting | Domain Registration