# modprobe and iwconfig at boot (SOLVED)

## Ignatius881

Hello.

Well, I don't want to write these commands everytime I boot my system. And I want to know if there is a way to automatize the process.

This is what I have to write after login:

```
modprobe -r rt2800usb rt2x00usb rt2x00lib

modprobe rt2800usb

iwconfig wlan0 essid MY_ESSID key s:MY_KEY

ifconfig wlan0 up

dhcpcd wlan0
```

Thanks in advance.Last edited by Ignatius881 on Sun Dec 18, 2011 8:42 pm; edited 1 time in total

----------

## NeddySeagoon

Ignatius881,

Since you are using wireless-tools you can add the configuration to /etc/init.d/net

There is a fully commented example at /usr/share/doc/openrc-0.9.4/net.example.bz2

To automate what you have written (you should not need to) put the commands into a file in /etc/local.d/  with a file name ending in .start.

Read the script /etc/init.d/local to see whats going on.  Essentaily, all files in /etc/local.d/ with names ending in .start are run at startup.

Files ending in .stop are run at shutdown

----------

## Ignatius881

Thanks, it seems that it's working well  :Very Happy: 

----------

## Ignatius881

No, sorry, I was wrong.

I created the file /etc/local.d/wifi.start with these commands, including the dhcpcd wlan0, and I still have to activate manually the connection, either writing ifconfig wlan0 up or writing everything. And I also wrote these commands in /etc/init.d/net.

Apart from that, when booting, a message about wpa_supplicant appears.

```
 * Bringing up interface wlan0 

 *   Starting wpa_supplicant on wlan0 ... 

 *   /etc/wpa_supplicant/wpa_supplicant.conf not found                    [ !! ] 

 * ERROR: net.wlan0 failed to start 
```

But I neither installed wpa_supplicant (I use a WEP key) nor specified the use of wpa_supplicant in any file.

I use wicd and added it to boot with rc-update.

----------

## NeddySeagoon

Ignatius881,

Something has installed wpa-supplicant for you because its trying to start but can't because its configuration file is missing.

If you use wicd, you must not start any network services with the normal gentoo network scripts because wicd and teh scripts will both try to do something simalar at the same time. Neither will work.

You should ensure that only the net.lo script exixts in /etc/init.d/

Do you really mean that wicd has been added to the boot runlevel or the defualt runlevel?

net.lo is the only network interface that should be in the boot runlevel.  All the others and wicd should be in defualt.

----------

## Ignatius881

 *NeddySeagoon wrote:*   

> Ignatius881,
> 
> Something has installed wpa-supplicant for you because its trying to start but can't because its configuration file is missing.
> 
> If you use wicd, you must not start any network services with the normal gentoo network scripts because wicd and teh scripts will both try to do something simalar at the same time. Neither will work.
> ...

 

Mmm, I've put wicd in boot level because the wiki says that: http://en.gentoo-wiki.com/wiki/Wicd

OK, I'll delete all lines with modprobe and so on of those files which I created, /etc/local.d/wifi.start and /etc/init.d/net, and I also delete the net.eth0 and net.wlan0 files, if I've understood well.

----------

## Ignatius881

Thanks a lot, now I can say that it works perfectly  :Very Happy: 

----------

