LinuxQuestions.org
Help answer threads with 0 replies.
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 07-07-2004, 09:45 PM   #1
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
Question Using kernel modules


I never have completely understood how modules work, even though I've been dealing with several, and I think now is the time to learn. I understand that modprobe takes care of actually loading the module, but how is modprobe run at startup? I installed ndiswrapper (to get my wireless card to work), and followed the instructions to add "alias wlan0 ndiswrapper" to my /etc/modules.conf file. However, if I reboot, the module isn't loaded. What does this alias line do, how are modules normally loaded automatically at startup, and what to I have to do to get "modprobe ndiswrapper" done every time (other than adding that line to rc.local which doesn't seem like that right way... or is it?).

Also, after the module is loaded, the following commands need to be typed to get the interface up:

Code:
iwconfig wlan0 mode Managed
iwconfig wlan0 essid ESSID
ifconfig wlan0 up
Do I just add these commands to rc.local, or is there a more "official" way to bring up the wireless interface everytime I start up?

EDIT:
*smiles* I always seem to answer my question right after I ask it. I was taking a look around the rc.d folder and found rc.modules. Now my question is... I issued a command that supposedly "wrote the correct modprobe settings to load ndiswrapper automatically," but it didn't put anything in rc.modules, so should that alias be doing it by itself? And I still don't know about the second part of my question (bringing up the interface). Thanks again.

Last edited by jrdioko; 07-07-2004 at 09:48 PM.
 
Old 07-16-2004, 05:05 PM   #2
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Any ideas on this? I'd still like to know what the alias command does, if I need to still manually add it to rc.modules (even though it said it wrote the settings so it automatically starts), and what needs to be done to execute those ifconfig/iwconfig commands. Thanks!
 
Old 07-16-2004, 05:22 PM   #3
mandeltuete
Member
 
Registered: Mar 2003
Location: Switzerland
Distribution: Fedora 3
Posts: 75

Rep: Reputation: 15
About your network thing:
Look at /etc/rc.d/init.d
There should be a file called network or net or similar, depends on your distro.
In that file your network is going to be initialised. You may find a line like 'ifconfig eth0' or similar, change that to your iwconfig commands.
If you dont have a network file in init.d try something like that:

Code:
#!/bin/sh
case "$1" in
     start)
          iwconfig wlan0 mode Managed
          iwconfig wlan0 essid ESSID
          ifconfig wlan0 up
          ;;
     stop)
          ifconfig wlan0 down
          ;;
esac
You should really use your network file, if you already have one
 
Old 07-16-2004, 07:31 PM   #4
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Hmm... I looked around my rc.d folder and can't find exactly what you described, but I do have a section like what you typed out above in rc.inet1. Here's the section:

Code:
case "$1" in
'start') # "start" brings up all available interfaces:
  lo_up
  eth_up 0
  eth_up 1
  eth_up 2
  eth_up 3
  gateway_up
  ;;
'stop') # "stop" takes down all existing interfaces:
  gateway_down
  eth_down 3
  eth_down 2
  eth_down 1
  eth_down 0
  lo_down
  ;;
*) # The default is to bring up all interfaces:
  lo_up
  eth_up 0
  eth_up 1
  eth_up 2
  eth_up 3
  gateway_up
esac
I was a little confused at first but now I see those are calls to functions defined earlier in the script. I'd just stick those ifconfig and iwconfig lines in the appropriate sections, but the functions in that file have a whole bunch of checking things before that command is actually executed, so do I need to make a wlan0 function and figure that all out? The function checks for the modules and then does a whole bunch of things with dhcp (which I do need). I'd think the wireless driver would give me a little more information about what exactly to do here. Finally, I'm still curious about that alias line and the proper procedure for loading that module. Thanks!
 
Old 07-16-2004, 07:59 PM   #5
motub
Senior Member
 
Registered: Sep 2003
Location: The Netherlands
Distribution: Gentoo (main); SuSE 9.3 (fallback)
Posts: 1,607

Rep: Reputation: 46
You would do better to place your series of commands in /etc/rc.d/rc.local, which is where user/local setup commands are expected to be placed.

Hope this helps.
 
Old 07-16-2004, 08:05 PM   #6
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Actually looking through rc.inet1, it looks like that is where the various network interfaces are supposed to be brought up. It also looks as if those functions with all the dhcp setup would also be required for wlan0. I'm sure people use wireless cards, how am I supposed to go about doing this? I'm still looking for an answer about the alias line as well, since I need that module before I can do anything else. Thanks again.
 
Old 07-17-2004, 01:23 AM   #7
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi jrdioko,
The alias line in the modules.conf tells the kernel that when it needs the wlan0 device, it needs to load the "ndiswrapper" module.
In the slackware distribution you'fl always find the "/etc/rc.d/rc.modules" with a set of modprobes you need to load permanently. This file predates the auto loading of modules. Yes, there was a time the kernel couldn't load modules on the fly.
Normally you could put the "user things" in the "/etc/rc.d/rc.local". But this file is executed in the end of the startup and also all the time you change the run level. So, if you need your wlan device to start up to get an ip address to your machine, the right place to put it is "/etc/rc.d/rc.inet1". May be you can find some scripts in the contrib directory of your distro. If you don't have the cds or the cd doesnŽ t has anything, you can look at www.slackware.com. If you can't find anything, it's time to hands on. You can put your command lines in the rc.inet1.

Good luck!
 
Old 07-17-2004, 01:30 AM   #8
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Hmm... so the rc.modules file isn't used normally for loading modules? I guess I don't know much about them in the first place . So, if I understand you correctly, once I type an iwconfig or ifconfig command the module will be loaded at that time once the kernel sees I'm trying to do something with wlan0? I can probably copy the eth0 functions and substitute wlan0, but I'm still confused as to why the wireless driver didn't come with information about how to set this up or that the information isn't widely available (starting up wireless on bootup can't be that rare ). I guess I'll play with rc.inet1 and see if I can get something to work. I just want to confirm that I understood you correctly about that alias line. Thanks!
 
Old 07-17-2004, 02:10 AM   #9
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Yes, you did it. Wireless is a new thing. I never see any. Just read about it. There are zillions of pcs in the world which never needed wireless things. Soon, we will forget the time when all computers were connected using cables between then.
 
Old 07-17-2004, 12:56 PM   #10
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Original Poster
Rep: Reputation: 30
Heh, ok. One more question... that alias line doesn't seem to be working that way. I manually type "iwconfig wlan0 mode Managed" and I get "Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; No such device." Also, "ifconfig wlan0 up" gives me "wlan0: unknown interface: No such device." They'll only work correctly if I manually modprobe the driver. How can I get that alias to work?

EDIT:
I take that back. Now it won't work even if I do a manual modprobe. I guess my problem isn't with the alias line. This has happened before (it only works part of the time), so I'll look into getting a new wireless card. Thanks all anyway for your help.

Last edited by jrdioko; 07-17-2004 at 01:00 PM.
 
  


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
kernel: No module symbols loaded - kernel modules not enabled. Qucho Debian 9 05-26-2004 02:50 AM
Kernel Modules and modules.conf init Linux - General 0 02-20-2004 06:51 PM
new kernel (2.4.22 up from 2.4.20-6) - missing modules - use old modules? Simon Bridge Linux - Software 1 02-04-2004 05:52 AM
How to keep modules/drivers across kernel recompiles and kernel versions? Pisces107 Linux - General 5 01-21-2004 08:29 PM
Kernel modules: why are some kernel modules zipped? hampel Slackware 3 06-30-2003 06:33 AM


All times are GMT -5. The time now is 08:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration