← Back to team overview

kernel-packages team mailing list archive

[Bug 254731] [NEW] Network on PCMCIA Network card not restored after suspend/sleep

 

You have been subscribed to a public bug:

Binary package hint: acpid

Hello

I am using Ubuntu 8.04.1

At first: This bug might be related to the following bugs:
- #[152533]
- #[108441]

- I am using a Compaq Evo N620 laptop computer, with a Realtek Semiconductor RTL8180L pcmcia wlan card.
- I do not use Network Manager (it is not even installed).
- I am using wpa_supplicant in roaming mode to connect to my wpa_psk encrypted home network.

The bug:
When resuming from (acpid 1.0.4-5ubuntu9) suspend, the wlan connection is not restored.

The solution:
Lets have look at the file where acpid shuts down the network interfaces:

original `/etc/acpi/suspend.d/55-down-interfaces.sh`
{{{
#!/bin/sh

pccardctl eject

# Get rid of any currently running dhclients
killall dhclient dhclient3 2>/dev/null

# Find the currently running network interfaces...
INTERFACES=`/sbin/ifconfig | awk '/^[^ ]+/ {print $1}'`

# And shut them down
for x in $INTERFACES; do
    ifdown $x;
    ifconfig $x down;
done
}}}

As you can see, the pcmcia cards are ejected before checking, witch
interfaces are configured. After resuming, the script
`/etc/acpi/resume.d/62-ifup.sh` only restores those connections, that
were checked to be configured.

That explains why pcmcia network devices are not set up when resuming from suspend.
We can fix that easily by moving
{{{
pccardctl eject
}}}
to the end of the file.

Now imagine the case, that our pcmcia card is configured, then we
suspend the machine, pull out the pcmcia card and then turn the machine
on again. We certainly dont want `acpid` to run `ifup` for the ejected
interface.

original `/etc/acpi/resume.d/62-ifup.sh`
{{{
#!/bin/sh

# Bring up the interfaces (this should probably be left up to some policy
# manager, but at the moment we just bring back whatever we ifdowned)

for x in $INTERFACES; do
    ifup $x &
done
}}}

Hence we have to check, witch interfaces are still available when
resuming:

patched version of `/etc/acpi/resume.d/62-ifup.sh`
{{{
#!/bin/sh

# Bring up the interfaces (this should probably be left up to some policy
# manager, but at the moment we just bring back whatever we ifdowned)

# Find all interfaces which are currently available
AVAILABLEINTERFACES=`/sbin/ifconfig -a | awk '/^[^ ]+/ {print $1}'`

for x in $INTERFACES; do
    for y in $AVAILABLEINTERFACES; do
        if [ $x = $y ]; then
            ifup $x &
        fi
    done
done
}}}

Having done this, pcmcia network devices '''not using wpa_supplicant in
roaming mode''' should be set up correctly when resuming from suspend.

Now to the problem with wpa_supplicant.
If wpa_supplicant runs in roaming mode, meaning the `/etc/network/interfaces` looks like
{{{
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet manual
        wpa-driver wext
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
}}}
then the wpa_supplicant is started in background by `ifup`.

On the other hand, if you shout down the interface using `ifdown` (as
`/etc/acpi/suspend.d/55-down-interfaces.sh` does), the wpa_supplicant
process is not beeing terminated automatically. If you then try to set
up the network interface again using `ifup` (as
`/etc/acpi/resume.d/62-ifup.sh` does), the `wpa_supplicant` is not
started correctly. (This might be a bug of `wpa_supplicant` or
`ifupdown`, but it is easy to implement a work around here.)

Fortunately the `wpa_supplicant` brings a script called `/etc/init.d
/wpa-ifupdown` to terminate any wpa_supplicant process that was started
by `ifupdown`, so we just have to invoke that script in
`/etc/acpi/suspend.d/55-down-interfaces.sh` before running `ifdown` on
all active interfaces.

patched version of `/etc/acpi/suspend.d/55-down-interfaces.sh`
{{{
#!/bin/sh

# Get rid of any currently running dhclients
killall dhclient dhclient3 2>/dev/null

# Find the currently running network interfaces...
INTERFACES=`/sbin/ifconfig | awk '/^[^ ]+/ {print $1}'`

# Shut down anything, that runs via wpa_supplicant
if [ -x /etc/init.d/wpa-ifupdown ]; then
        /etc/init.d/wpa-ifupdown stop
fi

# And shut them down
for x in $INTERFACES; do
    ifdown $x;
    ifconfig $x down;
done

pccardctl eject
}}}

I have applied these changes to my system and now it runs perfectly.

I hope I could help any one out there.

Regards,
Holger Stephan

** Affects: linux (Ubuntu)
     Importance: Medium
         Status: Incomplete

-- 
Network on PCMCIA Network card not restored after suspend/sleep 
https://bugs.launchpad.net/bugs/254731
You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu.