From waproamd to NetworkManager
Last night my X server suddenly started doing this weird cycle where it would (apparently) allocate over 1GB of memory, then free it; and it repeated this cycle until I killed the X server. After I killed the X server, APM suspend/resume stopped working. Fun! So I rebooted, and into the newest Fedora kernel, kernel-2.6.14-1.1637_FC4. I also upgraded ieee80211 and ipw2100 from ATrpms (ieee80211-kmdl-2.6.14-1.1637_FC4-1.1.6-6.rhfc4.at and ipw2100-kmdl-2.6.14-1.1637_FC4-1.1.3-36.rhfc4.at, respectively).
Once I rebooted, waproamd no longer worked:
Nov 13 17:17:28 darkbook waproamd(wlan0)[4107]: Scanning...
Nov 13 17:17:28 darkbook waproamd(wlan0)[4107]: Corrupt scan result (2)
That’s all I got. waproamd’s page does note that you should stop using it in favor of wpa_supplicant. Additionally, it hasn’t been updated in quite some time. Rebuilding it didn’t rectify this problem, so alas, I had to scrap it.
I think my main problem with wpa_supplicant (other than it’s kind of
ugly configuration file with lots and lots of options, compared to
waproamd scripts that just call ifup) was that it had no way to
detect and properly configure the access points at school. The
school’s APs have “hidden” ESSIDs. Literally, iwlist scan shows
them as <hidden>. I have been told that <hidden> is something
specific to the ipw2100 driver, but I’m not so sure of that these
days. At any rate, I gather there’s some ap_mode=2 setting in
wpa_supplicant these days that will let you work with hidden access
points. I’m not sure if it uses the standard RH/FC ifup/ifdown
commands; I kind of doubt it. Further, I’m not sure it has an option
to kick off scripts for particular networks. For example, at home I
need something to start OpenVPN. (With waproamd, that just goes in
the appropriate script.)
Somehow I found
NetworkManager. It’s
in FC4 already: install NetworkManager and NetworkManager-gnome.
(Without that last one, you don’t get the applet and thus have zero
control over NetworkManager, or so it seems.) You probably want to
start the NetworkManager and dhcdbd services now (via service)
and at boot (via chkconfig). You may also want to mkdir -p
/etc/NetworkManager/dispatcher.d and enable/start the
NetworkManagerDispatcher service. When that last service is
started, scripts in /etc/NetworkManager/dispatcher.d get called with
the device name as their first argument and up or down as the
second argument. So I stuck some scripts in there to start OpenVPN,
restart ntpd, that sort of thing.
(Also, I got a lot of this information from http://www.ces.clemson.edu/linux/nm.shtml.)
One problem, though. My APM scripts rmmod ipw2100 at suspend. I’m
not sure if it’s still necessary to do this; it was at one time, and
as recently as my initial FC4 upgrade on this laptop. Generally it
seems like any time I take out some of my old APM tricks to get
suspend/resume working, I end up breaking suspend/resume. Which is to
say that the same problems I’ve always had still plague me. At any
rate, I wasn’t really interested in trying to run without that rmmod
at suspend time. The problem seems to be in
HAL: it doesn’t see the
network interface after you remove and re-insert the module. With the
version that came in FC4, I couldn’t get the device “node” (I don’t
know if that’s the right term, but I’ll roll with it for now) to
appear even after I did a service haldaemon restart. I heard that
newer HAL versions had some power management features. So, I upgraded
to hal-0.5.4.cvs20051111-1 from Fedora development (which is
Rawhide…? Or not?). I couldn’t find that it does anything
interesting with power management. Further, I dug into
D-BUS and Python a bit. I
came up with stuff like this:
import dbus
slashHal = "/org/freedesktop/Hal"
dottedHal = "org.freedesktop.Hal"
bus = dbus.Bus.get_system()
spm_obj = bus.get_object(dottedHal,
slashHal + "/Device/SystemPowerManagement")
spm = dbus.Interface(spm_obj, dottedHal + ".Device.SystemPowerManagement")
def getDev(udi):
obj = bus.get_object(dottedHal,
"%s/devices/%s" % (slashHal, udi))
return dbus.Interface(obj, dottedHal + ".Device")
card = getDev("pci_8086_1043")
wlan = getDev("net_00_0d_43_8f_68_f5")
computer = getDev("computer")
bridge = getDev("pci_8086_2448")
I tried stuff like spm.Hibernate() which bitched that the security
policy wouldn’t let me do that. (I think it wants me to be “at
console,” based on my uninformed interpretation of
/etc/dbus-1/system.d/hal.conf. I don’t know how it determines if
you’re “at console.”) card is the node for the PCI device that is
the wireless card. It’s there regardless of whether ipw2100 is loaded
or not. wlan would be the node for the actual network device, if it
existed, which it doesn’t. computer is the whole computer (I guess;
it’s the root of the tree) and bridge is the PCI bridge that both of
my network cards are on. You can call Rescan and Reprobe on any
of them with no positive effect (i.e., computer.Reprobe()).
Finally I figured out that, with the new version of HAL, service
haldaemon restart was putting the proper network device node in the
tree. So now that’s part of resume. Except when you do service
haldaemon restart, NetworkManager dies, so you have to start it back
up. Here’s my /etc/sysconfig/apm-scripts/apmcontinue as of now:
#!/bin/bash
case "$1" in
suspend|standby)
#dbus-send --system --dest=org.freedesktop.NetworkManager \
# --type=method_call /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.sleep
service NetworkManager stop
ifconfig wlan0 down
rmmod ipw2100
service vmware stop
;;
resume)
#dbus-send --system --dest=org.freedesktop.NetworkManager \
# --type=method_call /org/freedesktop/NetworkManager \
# org.freedesktop.NetworkManager.wake
service haldaemon restart
service NetworkManager start
chvt 1
chvt 7
;;
esac
You’ll note that I found the sleep/wake methods on NetworkManager, but if you’re going to stop and restart it, not a lot of point in bothering with them as near as I can tell.
I’ll also mention that it seems you can add a new device into HAL. Why should I have to do that, though?