# Trying to configure wlan0 to come up at boot-time...

## plonka2000

Hi,

I've finally configured my wireless lan card (Netgear WG511) to recognise, however, I seem unable to bring it up at boot-time.

The only way I can get the interface up and configured is if I use:

```
# ifconfig wlan0 up
```

then:

```
# iwconfig wlan0 essid my_wlan
```

This is how my wlan0 is configured:

As instructed by another, I input edited this line in my /etc/init.d/net.wlan0:

```
# For pcmcia users. note that pcmcia must be added to the same

# runlevel as the net.* script that needs it.

depend() {

   use wireless hotplug pcmcia

}
```

This is my /etc/init.d/wireless:

```
#!/sbin/runscript

start(){

  ebegin "Configuring wireless interface"

  $IWCONFIG $IFACE essid $ESSID

  $IWCONFIG $IFACE mode Managed

  $IWCONFIG $IFACE key restricted $WEP_KEY

  eend $?

}
```

This is my /etc/conf.d/wireless:

```
IWCONFIG=/usr/sbin/iwconfig    # Path the your iwconfig prog

IFACE=wlan0                    # Interface that the wireless card is on

ESSID=my_wlan            # Your AP's ESSID

WEP_KEY=1234567890             # Your WEP key 

MANAGED=true                   # Managed or Ad-hoc
```

These config scripts I got from a helpful guy called GordSki, but they seem unable to work for me.

The thread I got these configs from is here.

Is there anyone that can see a flaw in this config and can see why it will not start at boot?

Thanks anyone for any help.

----------

## ikaro

hi.

try to symlink the device to the net.lo and add the service to start at boot, I assume that the wired network is starting at boot.

else, rc-update add net.lo default

----------

## plonka2000

 *ikaro wrote:*   

> hi.
> 
> try to symlink the device to the net.lo and add the service to start at boot, I assume that the wired network is starting at boot.

 

Do you mean the command:

```
# ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0 
```

Because as far as I know, this is not what is supposed to be done for Wifi connections?

Am I wrong? I basically need the device 'wlan0' to:

1) Start on boot.

2) Connect to my essid wifi network (Encryption not important as I've secured it in other ways  :Wink: )

 *ikaro wrote:*   

> else, rc-update add net.lo default

 

I've already set the device to start on boot.

Thanks for your help.  :Smile: 

----------

## plonka2000

Sorry I forgot to say, yes the wired network works fine.

I've also managed to make some progress.

I've put this into my /etc/conf.d/local.start file:

```
ifconfig wlan0 up

iwconfig wlan0 essid my_wlan

dhcpcd wlan0
```

now I can run:

```
# /etc/init.d/net.wlan0 start
```

and I get this output:

```
* Keeping kernel configuration for wlan0
```

But it still doesnt seem to bring wlan0 up at bootup...  :Confused: 

Here is the output of dmesg from when the network drivers start up:

```
NET: Registered protocol family 2

IP: routing cache hash table of 2048 buckets, 16Kbytes

TCP established hash table entries: 16384 (order: 5, 131072 bytes)

TCP bind hash table entries: 16384 (order: 4, 65536 bytes)

TCP: Hash tables configured (established 16384 bind 16384)

NET: Registered protocol family 1

NET: Registered protocol family 17

ReiserFS: hda3: found reiserfs format "3.6" with standard journal

ReiserFS: hda3: using ordered data mode

ReiserFS: hda3: journal params: device hda3, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: hda3: checking transaction log (hda3)

ReiserFS: hda3: Using r5 hash to sort names

VFS: Mounted root (reiserfs filesystem) readonly.

Freeing unused kernel memory: 148k freed

Adding 506036k swap on /dev/hda2.  Priority:-1 extents:1

b44.c:v0.95 (Aug 3, 2004)

ACPI: PCI interrupt 0000:00:0f.0[A] -> GSI 15 (level, low) -> IRQ 15

eth0: Broadcom 4400 10/100BaseT Ethernet 00:0e:a6:11:06:cb

ndiswrapper version 1.1 loaded (preempt=yes,smp=no)

ReiserFS: hda5: found reiserfs format "3.6" with standard journal

ReiserFS: hda5: using ordered data mode

ReiserFS: hda5: journal params: device hda5, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: hda5: checking transaction log (hda5)

ReiserFS: hda5: Using r5 hash to sort names

ReiserFS: hda6: found reiserfs format "3.6" with standard journal

ReiserFS: hda6: using ordered data mode

ReiserFS: hda6: journal params: device hda6, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: hda6: checking transaction log (hda6)

ReiserFS: hda6: Using r5 hash to sort names

ReiserFS: hda7: found reiserfs format "3.6" with standard journal

ReiserFS: hda7: using ordered data mode

ReiserFS: hda7: journal params: device hda7, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: hda7: checking transaction log (hda7)

ReiserFS: hda7: Using r5 hash to sort names

b44: eth0: Link is down.

b44: eth0: Link is up at 100 Mbps, half duplex.

b44: eth0: Flow control is off for TX and off for RX.

NET: Registered protocol family 10

Disabled Privacy Extensions on device c03fce20(lo)

IPv6 over IPv4 tunneling driver

ohci1394: $Rev: 1223 $ Ben Collins <bcollins@debian.org>

ACPI: PCI interrupt 0000:00:02.3[B] -> GSI 10 (level, low) -> IRQ 10

ohci1394: fw-host0: Unexpected PCI resource length of 1000!

ohci1394: fw-host0: OHCI-1394 1.0 (PCI): IRQ=[10]  MMIO=[bf800000-bf8007ff]  Max Packet=[2048]

ohci_hcd: 2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)

ACPI: PCI Interrupt Link [LNKE] enabled at IRQ 3

PCI: setting IRQ 3 as level-triggered

ACPI: PCI interrupt 0000:00:03.0[A] -> GSI 3 (level, low) -> IRQ 3

ohci_hcd 0000:00:03.0: OHCI Host Controller

ohci_hcd 0000:00:03.0: irq 3, pci mem 0xbf000000

ohci_hcd 0000:00:03.0: new USB bus registered, assigned bus number 2

hub 2-0:1.0: USB hub found

hub 2-0:1.0: 2 ports detected

ACPI: PCI Interrupt Link [LNKF] enabled at IRQ 7

PCI: setting IRQ 7 as level-triggered

ACPI: PCI interrupt 0000:00:03.1[B] -> GSI 7 (level, low) -> IRQ 7

ohci_hcd 0000:00:03.1: OHCI Host Controller

ohci_hcd 0000:00:03.1: irq 7, pci mem 0xbe800000

ohci_hcd 0000:00:03.1: new USB bus registered, assigned bus number 3

hub 3-0:1.0: USB hub found

hub 3-0:1.0: 2 ports detected

ACPI: PCI Interrupt Link [LNKG] enabled at IRQ 5

PCI: setting IRQ 5 as level-triggered

ACPI: PCI interrupt 0000:00:03.2[C] -> GSI 5 (level, low) -> IRQ 5

ohci_hcd 0000:00:03.2: OHCI Host Controller

ohci_hcd 0000:00:03.2: irq 5, pci mem 0xbe000000

ohci_hcd 0000:00:03.2: new USB bus registered, assigned bus number 4

hub 4-0:1.0: USB hub found

hub 4-0:1.0: 2 ports detected

ieee1394: Host added: ID:BUS[0-00:1023]  GUID[00e018000047fdb0]

eth1394: $Rev: 1224 $ Ben Collins <bcollins@debian.org>

eth1394: eth1: IEEE-1394 IPv4 over 1394 Ethernet (fw-host0)

usb 3-1: new low speed USB device using ohci_hcd and address 2

eth0: no IPv6 routers present

input: USB HID v1.11 Mouse [Microsoft Microsoft Wireless Optical Desktop® 1.00] on usb-0000:00:03.1-1

ACPI: PCI interrupt 0000:00:10.0[A] -> GSI 11 (level, low) -> IRQ 11

Yenta: CardBus bridge found at 0000:00:10.0 [1524:1411]

Yenta: ISA IRQ mask 0x0000, PCI irq 11

Socket status: 30000020

ndiswrapper: driver netwg511 (NETGEAR,09/06/2004, 2.1.25) loaded

PCI: Enabling device 0000:02:00.0 (0000 -> 0002)

ACPI: PCI interrupt 0000:02:00.0[A] -> GSI 11 (level, low) -> IRQ 11

PCI: Setting latency timer of device 0000:02:00.0 to 64

ndiswrapper: using irq 11

Real Time Clock Driver v1.12

USB Universal Host Controller Interface driver v2.2

wlan0: ndiswrapper ethernet device 00:09:5b:ef:3f:0e using driver netwg511, configuration file 1260:3890:1385:4800.5.conf

wlan0: encryption modes supported: WEP, WPA with TKIP, WPA with AES/CCMP

Loaded prism54 driver, version 1.2
```

----------

## plonka2000

Hi,

Does anyone know how I can issue this 1 line before wlan0 is started at bootup?:

```
iwconfig wlan0 essid my_wlan
```

I've worked out that for some reason my wlan0 connection is being recognised properly by ndiswrapper but its not specifying the essid of my wireless network...

After issuing:

```
iwconfig wlan0 essid my_wlan
```

I can now:

```
# /etc/init.d/net.wlan0 start

 * Bringing wlan0 up via DHCP...                                          [ ok ]

 *   wlan0 received address 192.168.0.4
```

Which is excellent but I need to issue the command before wlan0 is brought up in order to have the network start at bootup.

Is there a config file similar to /etc/conf.d/local.start that I can put this line into?

Or is there some way to specify this while wlan0 is being brought up?

Thanks anyone.

----------

## UberLord

/etc/conf.d/net

```
preup() {

if [[ ${IFACE} == "wlan0" ]]; then

   iwconfig wlan0 essid my_wlan

fi

return 0

}
```

Or emerge baselayout-1.11.10-r6 which already has handy wireless support  :Smile: 

EDIT: missed a bracketLast edited by UberLord on Thu Apr 07, 2005 1:24 pm; edited 1 time in total

----------

## plonka2000

 *UberLord wrote:*   

> /etc/conf.d/net
> 
> ```
> preup()
> 
> ...

 

Excellent...  :Very Happy:  I'll check that out...

Do i need to just paste that somewhere into /etc/conf.d/net or is it a process of editing it in?

 *UberLord wrote:*   

> Or emerge baselayout-1.11.10-r6 which already has handy wireless support 

 

Is that similar to ndiswrapper? What exactly is baselayout?

Is it like an init script manager?

I've found it on gentoo packages site but all it lists it as is:

 *Quote:*   

> Filesystem baselayout and init scripts

 

I'm not sure what it does...  :Confused: 

----------

## UberLord

 *plonka2000 wrote:*   

>  *UberLord wrote:*   Or emerge baselayout-1.11.10-r6 which already has handy wireless support  
> 
> Is that similar to ndiswrapper? What exactly is baselayout?
> 
> Is it like an init script manager?
> ...

 

It's a set of scripts that controls the running of Gentoo init scripts and a few other things. It's a core package - you already have it. However, it's not marked "stable" yet - but it will be Very Soon (tm).

The new version comes with vastly improved networking support scripts.

----------

## plonka2000

 *UberLord wrote:*   

> It's a set of scripts that controls the running of Gentoo init scripts and a few other things. It's a core package - you already have it. However, it's not marked "stable" yet - but it will be Very Soon (tm).
> 
> The new version comes with vastly improved networking support scripts.

 

Cool, I've been reading the changlog and there is a lot of mention of correcting ESSIDs... Which is very cool...

But is this a collection of tools like 'wireless-tools' or one single utility?

Btw, the script you provided earlier, is that to put into /etc/conf.d/net or is it interface specific code so would I need to input it into my /etc/conf.d/net.wlan0 instead?

----------

## UberLord

 *plonka2000 wrote:*   

> Cool, I've been reading the changlog and there is a lot of mention of correcting ESSIDs... Which is very cool...
> 
> But is this a collection of tools like 'wireless-tools' or one single utility?

 

It's a collection of scripts to handle networking depending on what you have installed

baselayout-1.11.x provides an "iwconfig" module which handles wireless configuration if you have the "wireless-tools" package installed

"wpa_supplicant" module handles wireless in a different manner if you the the "wpa_supplicant" package installed.

For more info, see a doc in progress

http://dev.gentoo.org/~uberlord/net-book

 *Quote:*   

> 
> 
> Btw, the script you provided earlier, is that to put into /etc/conf.d/net or is it interface specific code so would I need to input it into my /etc/conf.d/net.wlan0 instead?

 

/etc/conf.d/net

----------

## plonka2000

I really need assistance because I'm completely baffled...  :Confused: 

Most of last night I spent trying to get this command to work:

```
iwconfig wlan0 essid transformers
```

...but to no avail.

I'm sure the problem is everything is booting up in the wrong order...

Because I get this error every time:

```
* Running preup functions...

wlan0: unknown interface: no such device

Error for wireless request "Set ESSID" (8B1A):

  Set failed on device wlan0: no such device

* Bringing up wlan0...
```

And of course wlan0 errors because the essid is not set!  :Crying or Very sad: 

I've been using this script as advised:

```
preup()

if [[ ${IFACE} == "wlan0" ]]; then

   iwconfig wlan0 essid my_wlan

fi

return 0

}
```

But no joy as I always get the above error...

I've emerged "baselayout-1.11.x" "wpa_supplicant" as advised and I'm trying to configure /etc/wpa_supplicant.conf  now...

Anyone?

----------

## plonka2000

Is there anyone who is able to point me in the right direction?

As a point of note, the script posted above works perfectly on my laptop, which uses an identical PCMCIA Netgear WG511 wireless card...

One thing to note is I've been watching the bootup sequences very carefully and when my laptop boots, wlan0 is brought down quite a while before the "Bringing up wlan0" script is run...

So for some reason it seems my laptop is able to 'make' a wlan0 interface, bring it down, then bring it up as normal with the normal bootup script...

...but my other PC is not able to 'make' this interface like the laptop does.

I'm even more confused now...

Does any of this make sense to anyone?  :Confused: 

Anyone have any advice?

----------

## UberLord

https://bugs.gentoo.org/show_bug.cgi?id=78495

----------

## plonka2000

 *UberLord wrote:*   

> https://bugs.gentoo.org/show_bug.cgi?id=78495

 

This might sound like a bit of a n00bish question, but how do I apply that patch?  :Question: 

----------

## UberLord

```

cd /etc/hotplug

patch -p0 < /path/to/patch

```

----------

## plonka2000

Just before I had to leave for work, I applied the patch and rebooted.

Now my server doesnt boot... It errors when it starts mounting /dev/hda3

unfortunately, I was unable to write down the error I get because I had to run to work... But it was pretty serious... Then I had a prompt to choose a runlevel. Thats all I remember for now... Though I do remember it saying that something was missing...

This is bad.

I've booted from the livecd, run sshd and I'm looking round the filesystem to see whats going on.

I'm unable to chroot in because there is no /bin directory...

here is a listing:

```
# /mnt/gentoo/

boot             home             mnt              proc             sbin             sys              usr

dev              lib              opt              root             softscripts.new  tmp              var
```

What exactly is going on here...?!?!

Does anyone have any idea?  :Crying or Very sad: 

----------

## plonka2000

 *plonka2000 wrote:*   

> I've booted from the livecd, run sshd and I'm looking round the filesystem to see whats going on.
> 
> I'm unable to chroot in because there is no /bin directory...
> 
> here is a listing:
> ...

 

Upon further investigation, it seems there is more missing, which suggests that its possibly a partition problem.

Is there a particular tool I can use to recover my Reiserfs /dev/hda3 ?

----------

## plonka2000

Hi,

I've been working to restore this partition, in this thread.

I've managed to get further than before, but anyone interested in helping please help here.

----------

