YA Reason why I ♥ UNIX

Trying to do some work for the Mystery Hunt which starts on Friday at noon, and the wireless at MIT keeps deauthenticating me for reason 1. (Which apparently is the dreaded "unknown reason for deauthentication".) Reassociating makes everything work again. Fast, hack solution:

 while sleep 1s; do
  if iwconfig wireless |grep -q "ESSID:off"; then
    iwconfig wireless essid "MIT GUEST";
    echo "reset wireless";
  fi;
 done;

and I'm back at work with relatively continuous network connectivity.

Posted
Using wicd on UCR's WPA network

UC Riverside's wireless network uses WPA-EAP for the encrypted network. [The unencrypted network does a https based browser capture.] Unfortunately, none of the default wicd encryption templates support the precise brand of WPA that the network does, so you have to make your own template. Luckily, wicd makes this fairly simple:

Create a new template, say, /etc/wicd/encryption/templates/eap-only, with appropriate contents.

 name = EAP
 author = Don Armstrong
 version = 1
 require identity *Identity passwd *Password 

 -----
 ctrl_interface=/var/run/wpa_supplicant
 network={
    ssid="$_ESSID"
    key_mgmt=WPA-EAP
    identity="$_IDENTITY"
    password="$_PASSWD"
 }

Then tell wicd about this new template by editing /etc/wicd/encryption/templates/active and adding eap-only to the existing list of templates, and restart wicd /etc/init.d/wicd restart. [I'm not sure if restarting wicd is necessary, but it shouldn't hurt.]

Finally, configure the network using the appropriate wicd interface as usual.

Changing Grub2's default boot entry and halting

I have a mythtv box which (when working) records television shows for me. As I'm not interested in the vast majority of shows shown on US television, it spends most of it's time off, waiting for a show that I want to record. This requires using nvram-wakeup, and one of the oddities of my machine's bios is that it wants to be rebooted after setting the nvram. [This is likely due to Debian writing to the RTC after the nvram being updated, but not setting the RTC seems stupid.] After the reboot, the machine should halt, and grub should be configured to start the machine normally once the bios starts.

As grub2 now supports named default entries, this is fairly straightforward. We create a menu entry like the following in /etc/grub.d/40_custom:

 menuentry 'halt' {
         set saved_entry=0;
         save_env saved_entry;
         load_env;
         halt;
 }

make sure that GRUB_DEFAULT="saved" in /etc/default/grub; and set MythShutdownNvramRestartCmd to /usr/sbin/grub-set-default halt:

 mysql mythdb -e "UPDATE settings SET data='/usr/sbin/grub-set-default halt' WHERE value='MythShutdownNvramRestartCmd'";

and viola, the machine now behaves properly with grub2.