Category Archives: General

XBMC suspend/resume in Maverick

Few updates to my previous post:

  1. The format for the proc interface changed slightly (but significantly) from “disabled” to “*disabled”, scripts must be updated accordingly.
  2. One more step is required, details are in this post, but the short version is that you’ll need to enable wakup for the device at the sysfs level in addition to proc. I used the simple udev rule posted there and all works.

Linode hosting

Did a bit of digging a few weeks ago and came across Linode VPS. With better prices than Slicehost, data centers both here in the US as well as the UK and excellent reviews I ended up giving it a spin and eventually moving wholesale. Performance is much better with the new hosting, was able to set up a fully customized OS install (SELinux, encrypted fs) and then duplicate that image over from my primary ATL vm to my secondary in the UK. Yea, I’ve now got a fully distributed setup complete with a hot spare on a different continent (better than most ecommerce sites on the web today) for less than the price of my single Slice.

With a really nice management console and solid (so far) service, this is pretty much the best option I’ve seen in the VPS hosting space. I’d highly recommend it for anyone with a more technical background looking for a full-featured Xen host.

Moar RAID Win

Had to upgrade my storage over the past week and decided to see just how good Linux software raid (mdadm) and SATA hot plugging were these days. The current setup was a five disk array with two 1TB and three 750GB drives attached to an ASUS M3A76-CM motherboard in AHCI mode. My first issue was that all five drives were attached internally so access would require mucking about in the case to replace the three disks so I dug around and ended up purchasing a Supermicro CSE-M35T-1B so I would be able to swap the disks out easily.

After getting the original drives shifted into the new rack, it was as easy as 1-2-3(ish) to replace the drives (with the filesystem live):

  1. mdadm /dev/md1 --fail $PARTITION --remove $PARTITION
  2. Replace disk, create partition
  3. mdadm /dev/md1 --add $PARTITION, resync

Each resync after the replacement took 3-4 hrs and the fan in the rack kept the disks no warmer than 32C. After the final disk was done and synced, I expanded the array to include the new space:
mdadm --grow /dev/md1 --size=max
Then let lvm know the new space was usable:
pvresize /dev/md1
And ran vgdisplay to see my extra ~940GB.

Gawd it’s nice when stuff Just Works.

Enabling suspend/resume with XBMC in Ubuntu 9.10

Had issues after upgrading to Karmic with suspend/resume on my media box (Shuttle SN78S) where the system would suspend and then immediately resume (xbmc forum thread). After ruling out the nvidia blob as the culprit (my usual suspect), I did a bit more digging and found people able to make it work by disabling usb autosuspend but that didn’t make a difference at all for me. I did find some older documentation pointing to an oddity with the ehci driver and acpi wakeup causing this issue so I disabled it (via /proc/acpi/wakeup) and was able to suspend successfully. Wakeup via WOL succeeded as well, but not being able to resume via remote is a showstopper for me so I poked a bit more and enabled wakeup only for the USB device my remote sensor was attached to and voila!

To determine the USB device:

root@host:~#lsusb
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1784:0008 TopSeed Technology Corp.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In this case it’s easy as my remote sensor is the only device attached and it’s on bus 004.


root@host:~#cat /proc/acpi/wakeup |grep ^USB
USB0 S3 disabled pci:0000:00:02.0
USB1 S3 enabled pci:0000:00:04.0
USBB S3 disabled pci:0000:00:04.1
USB2 S3 disabled pci:0000:00:02.1

Now I have both the USB1 and USBB devices that show up on 04, but USB1 is the first so that was the one I enabled via:
echo "USB1" > /proc/acpi/wakeup

To make it persistent I added the following to /etc/rc.local (the ethtool command enables WOL and isn’t needed unless you want to wake your machine over the network):

# Enable wakeup for the remote
status=`cat /proc/acpi/wakeup | grep "USB1" | awk {'print $3}'`
if [ "$status" = "disabled" ]; then
echo "USB1" > /proc/acpi/wakeup
fi

/usr/sbin/ethtool -s eth0 wol g > /dev/null

The only other step I took was to work around the standard lirc borkage by disabling lirc and unloading the modules. This requires two files:
/etc/pm/config.d/01lirc_module

SUSPEND_MODULES="lirc_mceusb lirc_dev"

/etc/pm/sleep.d/10-lirc (must be executable, requires installing curl – apt-get install curl)

#!/bin/sh
# Disconnect XBMC from lirc and stop the daemon

case "$1" in
hibernate|suspend)
service lirc stop
;;
thaw|resume)
service lirc start
;;
*) exit $NA
;;
esac

As of 9.11 alpha 2, XBMC uses ConsoleKit in the Karmic packages so you need to make sure your session gets auth’d properly or you’ll end up with permission denied messages in the xbmc logs when it tries to suspend. If you’re using GDM or KDM it should Just Work. In my case I’m just starting x on tty1 for my xbmc user so I had to update my .xsession file to launch xbmc like so:
ck-launch-session /usr/bin/xbmc --standalone

Edit: As of 9.11 alpha2, XBMC takes care of connecting/disconnecting from the LIRC daemon so no need to do it in the lirc script. Also added info about the new ConsoleKit integration in alpha2.
Edit2: Maverick requires a few other tweaks to work properly, updates are here.

Ultimate Phone

Must have, can’t live without, omg, do wnat!

edit: updated the link so it actually works… thanks Vadim!

Switch to our mobile site