[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

knoppix-halt breaks wake-on-lan (wol)



Hello, everyone,

This refers to Knoppix 6.4.4.  I don't have access to Knoppix 6.5.

The network interface fails (almost always) to enter wake-on-lan (wol)
mode on power off.  The problem is that /etc/init.d/knoppix-halt unloads
the network interface driver (lines 153-159).  I was able to work around
the problem by adding exceptions to the "Free modules" loop.

Details:
1. On several of my machines, even if the interface is already down, the
driver must remain loaded when the system shuts down.  If the driver is
unloaded prior to the power off system call, the driver is never called to
place the device in wake-on-lan (wol) mode.

2. On one other machine, the driver need only remain loaded until the
interface is brought down.  However, because knoppix-halt never (see note
below) brings the interface down prior to unloading the driver, the result
is the same.

I would imagine that this problem exists with a number of other drivers as
well.

Fix:
I inserted a check for net driver modules.  The resulting code was getting
sloppy, so I rewrote the "Free modules" section (lines 153-159) as
follows:

153: # Free modules
154: exceptions="eeepc_laptop" # Unloading eeepc_laptop disables WLAN in
the BIOS. Why?
155: # Some net drivers must remain loaded in order to set up wake-on-lan.
156: for i in /sys/class/net/*; do
157:     m=$(basename "$(readlink $i/device/driver/module)")
158:     [ -n "$m" ] && exceptions="${exceptions:+$exceptions|}$m"
159: done
160: while read module relax; do
161:     case "$exceptions" in
162:         *$module* ) true ;;
163:         * ) rmmod "$module" ;;
164:     esac
165: done </proc/modules >/dev/null 2>&1

I'm still learning linux, so there is probably a more reliable (and
simpler) way of finding all the network interface driver modules. 
Suggestions?

By the way, knoppix-halt never beings down any interfaces because the grep
on line 134 always finds "unionfs":
133: # Shut down network, if no nfs mounted
134: grep -q nfs /proc/mounts || ifdown -a >/dev/null 2>&1

-Andrew


Reply to: