WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How do I make wireless persistent? [RESOLVED]  (Read 8230 times)

Offline emptybee

  • Newbie
  • *
  • Posts: 15
How do I make wireless persistent? [RESOLVED]
« on: March 11, 2009, 03:02:16 PM »
Hi,

I have now got it so that after I boot up I only have to go to the root access terminal and write

root@box:/home/tc# cd /home/tc/rtl8187se_coffee/
root@box:/home/tc/rtl8187se_coffee# sh wlan0up
root@box:/home/tc/rtl8187se_coffee# wpa_supplicant -iwlan0 -c/home/tc/wpa_supplicant.conf

Then go to the Netcardconfig and type wlan0 in the interface box, click the DHCP Broadcast radio button and apply. I can then open opera and surf.

How can I automate this process? Also I know have loads of TCE's loading at boot (compiletc, linux-headers, wireless-2.6.26, wireless_tools, wpa_supplicant and associated tce)? Which ones can I remove now?

Thanks for any help you can give. Really enjoying learning about linux but this is stumping me. Could I write the commands into some kind of boot script so that its all done by the time the os loads?

Max
« Last Edit: March 19, 2009, 01:10:48 AM by emptybee »

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: How do I make wireless persistent?
« Reply #1 on: March 11, 2009, 05:46:30 PM »
For system startup commands, place them in /opt/bootlocal.sh
This is like a catch all for rc script, so it runs as root and likely will need full paths.
10+ Years Contributing to Linux Open Source Projects.

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #2 on: March 12, 2009, 07:01:02 AM »
I've tried that but it doesn't stay there. What boot options should I be using? Is there one type of persistence that works better than the others. I'm using a 2gb (fat32) usb key. Previously I've been using waitusb=5 tce=sda1/tce  on the first startup. Then removing the tce bit from the syslinux.cfg and making a cryptohome from the menu and changing the boot options so they now read waitusb=5 cryptohome=sda1. I don't understand the backup function that's ticked when you go to shutdown.

I'm also still having problems with the usb key changing from sda1 to sdb1 which obviously affects the cryptohome boot option. Does Tiny autosearch for the cryptohome file like it does for tce?

Thanks for all the help,

Max

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: How do I make wireless persistent?
« Reply #3 on: March 12, 2009, 12:34:02 PM »
/opt is typcially in ram.
The backup is specified by two files /opt/.filetool.lst and /opt/.xfiletool.lst
The use of these two files are discussed in the Core Concepts section of the website.
So also is the other persistent options, including persistent /opt
Either choose to use persistent opt or adjust the files mentioned above to perform a backup of your /opt directory.
10+ Years Contributing to Linux Open Source Projects.

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #4 on: March 13, 2009, 04:54:28 AM »
My bootlocal.sh is now persistent (via filetool.lst and backup) and now reads like this:

#!/bin/sh
# put other system startup command here
cd /home/tc/rtl8187se_coffee
sh wlan0up
wpa_supplicant -iwlan0 -c/home/tc/wpa_supplicant.conf

/opt/wlan0.sh &

This now has the effect of turning the wireless on after boot but it won't connect me to the network. I still have to go into a root terminal and type "wpa_supplicant -iwlan0 -c/home/tc/wpa_supplicant.conf" and then go to cpanel>netcardconfig and type wlan0 in the interface and click yes to dchp.

Why isn't the wpa_supplicant line having the desired part and how can I automate the interface bit.

Once again, thanks for all your help. After I get this working I'm planning to write a how to on the msi forums to get more people using this fantastic OS.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: How do I make wireless persistent?
« Reply #5 on: March 13, 2009, 06:59:20 AM »
Since your commands work when manually entered and not when in /opt/bootlocal.sh typically means either you need to specify the full path to an executeable, likely iwconfig and  wpa_supplicant, and/or you may need to add some sleep commands to allow some devices to fully register.
10+ Years Contributing to Linux Open Source Projects.

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #6 on: March 13, 2009, 07:33:45 AM »
Thanks for the reply. I'm not sure what the full path to wpa_supplicant is though as I assume its this which is causing the trouble. What command should I put in there to sort out the interface problem?

Thanks again for your help,

Max

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14544
Re: How do I make wireless persistent?
« Reply #7 on: March 13, 2009, 08:06:53 AM »
This will tell you where wpa_supplicant is:
Code: [Select]
$ which wpa_supplicant
Then you use the following "/path-to/wpa_supplicant -iwlan0 -c/home/tc/wpa_supplicant.conf"

..and "udhcpc -b -i wlan0" will connect you to your network

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #8 on: March 13, 2009, 09:15:43 AM »
Hi Jaunito, thanks for your help. The wireless is now turned on and connected after boot. Unfortunately the udhcpc line doesn't work. I've tried specifying the full path (/sbin/udhcpc -b -i wlan0) and put sleep=15 before it with no luck. However, once again, once at the Tiny Core desktop if the same command is run in root terminal it works.

Any suggestions why this is?

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: How do I make wireless persistent?
« Reply #9 on: March 13, 2009, 01:25:38 PM »
Using wpa_supplicant seems much more time sensitive than iwconfig.
I was finally able to test TC with wpa router, visiting a friend today.
After playing around with the script, what seems to work for this setup was adding a sleep and wait command.

After the modprobe ...
sleep 1

After the /usr/local/sbin/wpa_supplicant ....
wait $!
udhcpc -b -i ...

Using full path on wpa_supplicant and these two commands works here.

HTH
« Last Edit: March 13, 2009, 01:54:27 PM by roberts »
10+ Years Contributing to Linux Open Source Projects.

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #10 on: March 14, 2009, 06:00:59 AM »
I'm afraid this still isn't working. Are there any other ways of maybe making a script run as root immediately after boot? Thanks for all your help.

Max

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #11 on: March 14, 2009, 04:19:59 PM »
I've set up the key map today and interestingly if I put the command loadkmap after the wpa_supplicant line it doesn't work. If I put it before the wpa supplicant line then it does...

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: How do I make wireless persistent?
« Reply #12 on: March 16, 2009, 11:04:15 PM »
I have still been thinking of a possible automated solution for you.
The wpa_supplicant does take a significant amount of time.

What I did was to try to get as much separation between wpa_supplicant .. and the udhcpc ...

So I moved udhcpc to /home/tc/.profile Just before the last line, the one with startx
I added:

echo "Sleeping 10..."; sleep 10
sync
sudo udhcpc -b -i ath0

This seems to work. You will see the Sleeping and after still see that wpa_supplicant is outputing messages, i.e., it is still running

Then if you have the right amount of sleep you should see the
Sending discovery message and hopefully an ip assigned.

HTH
10+ Years Contributing to Linux Open Source Projects.

Offline emptybee

  • Newbie
  • *
  • Posts: 15
Re: How do I make wireless persistent?
« Reply #13 on: March 17, 2009, 06:29:48 AM »
Fantastic! Works a treat. Thank you so much for your help Roberts. Now all I have to do is set Opera to start on boot and weed out the extensions I no longer need. If I get some spare time over the next week I'll add a how-to to the MSI forums and hopefully get a few more people using this awesome mini OS.

Thanks again,

Max

Offline kinsa

  • Newbie
  • *
  • Posts: 5
Re: How do I make wireless persistent? [RESOLVED]
« Reply #14 on: March 31, 2009, 08:13:21 PM »
I have used the following on my bootlocal.sh:

Code: [Select]
#!/bin/sh
# put other system startup command here
modprobe rt2860sta
sleep 1
/usr/local/sbin/wpa_supplicant -B -Dwext -ira0 -c/etc/wpa_supplicant.conf
wait $!
/sbin/udhcpc -T 10 -A 30 -b -i ra0

Just play with the -T and -A values.