LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-29-2009, 04:08 AM   #1
Bluefightingcat
LQ Newbie
 
Registered: Oct 2008
Posts: 20

Rep: Reputation: 0
Start-up script to start wlan interface


Hi,

I've been fighting to get my wireless working and I've finally made some progress. I can actually manage to connect to my wireless network and so far it has been quite stable (fingers crossed).

However there is one slight nag. My wlan0 interface driver refuses to start at startup. When I type iwconfig its just not there. To fix this I have to manually run "rmmod rtl8187" and then "modprobe rtl8187". Then it works fine.

I've been trying to make a script to automate this but without success. I've tried both editing my rc.local and kde startup .xinitrc

Can anybody suggest how I could get those two commands to run automatically at startup after the boot process?

I'm running Arch Linux and KDE 4.3


BFC
 
Old 08-29-2009, 04:46 AM   #2
umarzuki
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 61

Rep: Reputation: 15
Quote:
Originally Posted by Bluefightingcat View Post
Hi,

I've been fighting to get my wireless working and I've finally made some progress. I can actually manage to connect to my wireless network and so far it has been quite stable (fingers crossed).

However there is one slight nag. My wlan0 interface driver refuses to start at startup. When I type iwconfig its just not there. To fix this I have to manually run "rmmod rtl8187" and then "modprobe rtl8187". Then it works fine.

I've been trying to make a script to automate this but without success. I've tried both editing my rc.local and kde startup .xinitrc

Can anybody suggest how I could get those two commands to run automatically at startup after the boot process?

I'm running Arch Linux and KDE 4.3


BFC
i never use arch but i believe adding that module into /etc/modules would do just fine
 
Old 08-29-2009, 05:04 AM   #3
Bluefightingcat
LQ Newbie
 
Registered: Oct 2008
Posts: 20

Original Poster
Rep: Reputation: 0
There is no such directory in my system.

BFC
 
Old 08-29-2009, 05:37 AM   #4
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
Have you looked at the Arch Wiki?

http://wiki.archlinux.org/index.php/Rtl8187_wireless

Arch, unlike, sad to say, most versions of Linux, usually has very good documentation, understandable for newcomers, in their wiki.
 
Old 08-29-2009, 06:13 AM   #5
Bluefightingcat
LQ Newbie
 
Registered: Oct 2008
Posts: 20

Original Poster
Rep: Reputation: 0
I've looked into the arch wikis several times. It doesn't help. All I need is a script to automatically run the commands on startup.

BFC
 
Old 08-29-2009, 01:29 PM   #6
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
You could probably just make your own script. I haven't used Arch in awhile, but I believe you load modules in /etc/rc.conf.
 
Old 08-30-2009, 01:52 PM   #7
Bluefightingcat
LQ Newbie
 
Registered: Oct 2008
Posts: 20

Original Poster
Rep: Reputation: 0
Could you be a bit more specific. I'm not such a huge expert. But your advice sounds promising.

BFC
 
Old 08-30-2009, 04:09 PM   #8
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
I'm sorry, I should have been, especially as I hate advice that masquerades as a self standing instruction.

Ok, I'm not at all familiar with KDE, so hopefully, all this will work. This time, I'm going to err on the side of giving too much information.

A script is just a series of commands, and doesn't have to be complex at all. From what I can gather, for some reason, you have to remove the r8187 module before adding it, which is a whole issue in itself, but at this point, we're not going to worry about that.

So, the commands you type, as far as I can see are just something like

rmmod (or modprobe -r, which does the same thing) rtl8187, then do modprobe rtl8187

So, you could make a simple script called startwireless.sh or whatever you want to call it, that just runs the commands for you. You can put it in /usr/local/bin, or even in your own home directory, making a directory $HOME/bin. Something like


Code:
#!/bin/sh
modprobe -r rtl8187
sleep 2
modprobe rtl8187
iwconfig <whatever commands you type there>
<and if necessary>
dhcpcd wlan0
Explanation:

I use /bin/sh rather than /bin/bash out of habit from the BSDs, and it also makes a script more portable--that is, I have to write little scripts that will run on AIX and Linux, so prefer /bin/sh. Often in Linux, that's just a link to /bin/bash, though in theory, using /bin/sh makes it more POSIX compliant--with the RH based distros at least, that doesn't seem to be quite true though, as it will accept bash-only things.

modprobe -r rtl8187

That's the same as rmmod rtl8187
sleep 2

That just pauses for 2 seconds to sort of give it time, in case it needs it, and can usually be left out.

modprobe rtl8187

That's what you usually do manually.

iwconfig with your usual commands--again, all a script is, at bottom, is a collection of commands.

Then, if iwconfig just connects it to the WAP (Wireless Access Point) but doesn't give it an address, run dhcpcd on the interface.

After creating the script--we'll say you decide to put it in /usr/local/bin, make it executable

chmod 755 /usr/local/bin/startwireless.sh

Now, when you boot up, you should just have to type something like

startwi <then hit the tab key, which should complete the command>

which will, hopefully, run all these commands for you and connect you.


For example, I use wpa_supplicant on RH based systems. I am never sure how I will be connecting, but usually, when using wireless, it will be at home. So my own startwireless.sh script is just


service wpa_supplicant start
dhclient wlan0

In this case, the wpa_supplicant service reads a configuration file that connects it to my home network, and RH based systems use dhclient rather than dhcpcd.

If doing this, you probably want to comment out the various network lines in /etc/rc.conf, as I think that will start the dhcpd command, and you can't call it if it's already running.

Hope this helps.

It's crude, but should work. The more sophisticated way would be to figure out exactly why you have to rmmod and then modprobe, then set it all up in /etc/rc.conf, but the kludgy method above should work.
 
  


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
want to start script when wlan interface goes up nrsorte Linux - Wireless Networking 5 03-26-2007 07:24 AM
GUI Interface does not start hobz Linux - Newbie 5 10-16-2004 09:02 AM
HELP! Can't start graphical interface fclifton Linux - Software 2 08-19-2004 12:29 PM
HELP! Can't start graphical interface fclifton Linux - Newbie 2 08-15-2004 03:51 AM
combining bus and start topology WLAN noinO Linux - Wireless Networking 0 09-03-2003 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:59 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