This page is specific to Ubuntu versions 8.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


If you have configured automated thin-client shutdown, maybe you'd like to configure your thin-clients to turn on automatically as well. This can be accomplished via WoL technology (Wake-on-LAN). This allows a system on your network to send a "magic packet" to the MAC address of a specified thin-client(s) to "wake up" (power on) without having to physically push a button. Pretty nifty!

To do this, we must configure a few aspects of our LTSP network. These configurations are described below:

  • Determine if your clients support Wake-on-LAN. Most newer systems support this BIOS feature (called "Wake on LAN", "WOL", "PME" (Power management events), or similar. Each BIOS is different - consult your documentation if you are unsure. If your clients' BIOSes do not support this, sorry! Maybe a newer BIOS revision supports it. Consult your hardware manufacturer's website for any available BIOS updates. If they do support it, enable it in the BIOS and read on!
  • Get MAC addresses of all clients you want to boot up automatically. This can be accomplished by logging into each client's chroot environment (you can follow instructions HERE to enable the root account in your chroot environment) and running ip addr. A nice alternative is if all of your thin-clients are booted up, you can automatically gather MAC addresses of connected clients (though possibly not a complete list, you'll want to test it) by running the following command from the server:

sudo ip neigh

Personally, I use this command and redirect the output to a text file in /etc/ltsp on the server for easy editing:

ip neigh | pcregrep -o '(?<=lladdr )\S+' | sudo tee /etc/ltsp/client-mac-addresses.txt
  • Install the wakeonlan package. This package will install the software necessary for your server to send the magic packets to the clients:

sudo apt-get install wakeonlan
  • Configure a wrapper script for wakeonlan to sleep between sending WoL packets to clients. AFAICT, wakeonlan has the functionality to read from a list of MACs (via the -f switch), but does NOT have the functionality to wait in between sending packets. Thinking to myself while initially setting this up, "Self, powering on 35 systems all at once might blow our electrical circuit!" So I wrote a very simple wrapper script to, instead, wait 2 seconds in between powering on each system listed in our file:

sudo vim /etc/ltsp/wol

/etc/ltsp/wol:

    #!/bin/bash
    #
    # Uses wakeonlan to bring up clients from a file, sleeping 2sec. in between.
    #
    while read line
    do
        /usr/bin/wakeonlan $line
        sleep 2
    done < /etc/ltsp/client-mac-addresses.txt

    # EOF

If you have multiple nics you may need to modify the wol script to specify the broadcast address of the interface to send the magic packets.

   /usr/bin/wakeonlan  -i 192.168.0.255 $line
  • Of course, we'll want this script executable:

sudo chmod +x /etc/ltsp/wol
  • Configure CRON to automate wakeonlan at your specified time. In this example we'll use 7:50am (Monday-Friday) as our bootup times:

sudo vim /etc/crontab

/etc/crontab:

50 7    * * 1-5 root    /etc/ltsp/wol
  • You're done! Enjoy automated bootup!

GOTCHA 1:

In my experience on some specific thin-client hardware, some Linux/LTSP (not sure which) bootup function disables the ability to use WoL, even though it is enabled in the BIOS. If you experience your systems not booting up via WoL, maybe you will benefit from the workaround I found, via the ethtool command. Create a file in your chroot environment and enable this command during bootup:

sudo vim /opt/ltsp/i386/etc/ltsp/wolfix

/opt/ltsp/i386/etc/ltsp/wolfix:

    #!/bin/bash
    #
    # Uses 'ethtool' to 'fix' WoL functionality since, for some reason, it's
    # turned off during bootup (even when, in BIOS, it is turned on).
    #
    ethtool -s eth0 wol g

    # EOF
  • Make this file executable as well:

sudo chmod +x /opt/ltsp/i386/etc/ltsp/wolfix
  • Edit your lts.conf file to execute this script upon client bootup:

sudo vim /var/lib/tftpboot/ltsp/i386/lts.conf

/var/lib/tftpboot/ltsp/i386/lts.conf:

RCFILE_01               = /etc/ltsp/wolfix
  • Update your client chroot:

sudo ltsp-update-image

* Reboot your thin-clients, and enjoy automated bootup!

(Substitute RCFILE_01 with a different number if you are already using it)

GOTCHA 2:

  • 2009/02/20 Lns: I've experienced the situation where certain specific hardware might not respond to WoL magic packets, even with the workaround implemented in GOTCHA 1. I've narrowed it down to when the user manually shuts the thin client down via LDM's "Shutdown" option in the menu. Apparently it uses the poweroff -p command. Manually using /sbin/halt (ala the Automated Shutdown Procedure) works fine. You can probably symlink / alias the commands to make it work as expected, until the bug/situation is fixed upstream.

NOTES:

  • If you are using dhcpd, then you can get the list of mac addresses that are supposed to correspond to a given hostname (when up), allowing you to wakeonlan <byhostname>. A simple tool called omwol can make this process easy, and also allows you to wake up a well named lab of machines with simple commands like:

$ omwol machinename 1 16

which would wake up hosts machinename1 through machinename16.


CategoryLtsp

UbuntuLTSP/AutomatedTCStartup (last edited 2011-05-16 15:31:35 by jengelh)