Automatic diskless boot of media directors

From LinuxMCE
Revision as of 17:20, 13 June 2008 by Human (Talk | contribs) (Setup the media director in LinuxMCE)

Jump to: navigation, search

LinuxMCE allows media directors to be booted over the network. This means that you can boot up thin clients without hard drives, or systems with other operating systems without affecting what is already on the disk.

How to set it up

Enable PXE boot

This is also known as network boot and can be accessed in your computer's BIOS. The exact procedure varies depending on your PC. Normally you press F2 or DEL right after turning the PC on to enter the BIOS settings. There is then usually an advanced option to enable this.

Set the correct boot order

You are also going to want to set the boot order in the BIOS so the network boot comes first, and your hard drive second. However most BIOS's will make you first enable network boot, save your changes, restart the computer, and then enter the BIOS settings a second time to set the boot order.

Determine your network card's MAC address

This step is not needed since version 7.04

When network boot is working you should see at bootup the PC's mac address, and a messages about trying to contact a DHCP server, or trying to find a network boot image. This will be a new message you didn't see before and it means network boot is active on the PC. It will usually try for about 10 seconds to do a network boot image, and then give up and boot off the hard drive. This is what you want. When you see the message that it is trying to do the network boot, write down the mac address.

You can also get the mac address in Windows by running IPCONFIG command prompt, or in Linux by typing ifconfig as root from a console or a terminal.

Setup the media director in LinuxMCE

This step is not needed since version 7.04 although the May 7th release of 7.10 appears to require it

In LinuxMCE Admin go to Wizard > Devices > Media Directors. Add the media director if this is a new one, and set the mac address. The mac address should be a series of six 2 character sequences separated by colons, like this: 1A:00:F2:21:23:9F

Click 'update' to save your changes, and then click 'Setup Diskless Media Directors'. Wait for the popup window to finish. If this is a new media director you just added, go to Wizard, Restart and click 'Quick Reload Router' so the Router is aware of this new device.

Boot up from the network

Now turn on the PC. You should see that it gets an IP address and boots into the media director software. The first time you boot it, it can take up to 30 minutes to boot because it will be installing a lot of the software on the diskless image on the core.

After some time, you will see the avwizard screen where you can choose your UI, resolution and so forth. After finishing the avwizard, the system will setup your interface and eventually you will be prompted by the setup wizard where you should choose the media center setup and then go through your typical setup for this new MD.

How to use it

Using LinuxMCE. If this media director has a hard drive in it that contains another operating system (like Windows or Linux), then from the media director's on-screen orbiter, or from any other orbiter that is currently controlling that media director, hit the 'power' button and choose 'restart as windows/linux' to boot up the computer off the hard drive and use it like a normal PC. Then choose 'restart as LinuxMCE' from the orbiter to boot it back again into LinuxMCE.


PXE-Boot hangs up, looping......

I have an Asus A7N8X-deluxe board, with two NICs onboard. When I connect one of them the MD tries to boot via PXE. Everything seems to go its way until the line: filename tftpboot/pxelinux.0 comes up, for about 20 seconds and after this. After this, the last block written:

IP-Config eth0 complete (from adr: broadcast: netmask: gateway: dns0: dns1: rootserver: rootpath: filename tftpboot/pxelinux.0

is repeated about hours in a really fast way.....


It is switching NICs during the PXE boot. Disable one of the on-board NICs.


GRUB PXE network boot

In some situations, it may be more appropriate to use GNU GRUB bootloader:

  1. The machine does not support PXE booting directly (no boot-ROM).
  2. You can use a GRUB boot menu to decide wheter you want to boot LMCE or the native OS.
  3. Booting is a lot faster when you boot the native OS by skipping the network step.
  4. GRUB allows for easy adjustments of the boot parameters at boot-time.

This is described in detail at GRUB PXE network boot.

Reduce boot time

When using diskless boot, all data have to be read over the network connection. This can cause boot up times longer than desirable. To avoid long boot up times, you can tune the NFS mount options of the NFS root. Specifically, the rsize and wsize options. You might do a Internet search for resources on this. Another option is to implement suspending of the media director. Also know as standby, suspend or hibernate. This function is not integrated into LinuxMCE (yet), and requires some Linux shell hacking. See the Suspend article for more information.

Programmer's guide

The network boot images are contained in /usr/pluto/diskless/[deviceID]. If a network image is corrupted, just delete that directory, and re-run 'Setup Diskless Media Directors'.

When the user hits the power button to change which device is booted, the command is sent to "General Info Plugin", which updates /tftpboot/pxelinux.cfg/01-[mac address]. That file contains a line KERNEL or LOCALBOOT 0, depending on what the user wants to boot. If it's LOCALBOOT 0, then when the media director tries to do a network boot the Core will tell it to boot off the hard drive instead. General Info Plugin then sends the App Server running on that machine a command to reboot.

Since there is both a Linux and Windows version of App Server, if App Server is installed and running on the Windows PC, then LinuxMCE can still reboot it remotely back into the network boot even if it's running Windows. Also the Windows App Server utility gives you a tray icon to switch back to network boot.

Other Network Cards

If you get to the remote machine starting the boot process, but then fails with it unable to find eth0, the reason may be because the stock diskless image did not have your network card statically compiled. The linux image building process does allow for additional network modules to be loaded during the boot process. The installer that linuxmce uses builds this image from a base copy of the operating system (ubuntu) that is untar'd during the diskless setup process. It puts this into it's own directory that serves as a virtual harddrive for your diskless machine. In the /usr/pluto/diskless directory you should have a list of device numbers that correspond to your diskless machines. For example: '45' was the number for my diskless machine. Edit the file /usr/pluto/diskless/###/etc/initramfs-tools/modules and add on your nic's module. In my case I edit /usr/pluto/diskless/45/etc/initramfs-tools/modules and added sky2. Then run the /usr/pluto/bin/ script with the device number (directory name) of your diskless machine. In my case "/usr/pluto/bin/ 45". This script builds the initrd image and puts it in the proper place (symlinks it actually).

The driver used in my machine was the 'sky2' driver for Marvell Gigabit ethernet cards. Other drivers will be located in the /usr/pluto/diskless/xx/lib/modules/ directory.