Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Remotely boot, choosing Linux or WinXP
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Tux's lil' helper
Tux's lil' helper

Joined: 14 Jun 2004
Posts: 128
Location: GA, USA

PostPosted: Wed Apr 19, 2006 4:48 pm    Post subject: HOWTO: Remotely boot, choosing Linux or WinXP Reply with quote

Maybe this isn't something that many people want to do, but I have a dual-booting machine (an office computer) which I wanted to be able to call up into Gentoo at night from a Gentoo server, for updates or whatever, while preserving the default Windows behavior during daytime hours. These are local installations of Gentoo and Windows (normally not network booted).

There are at least two ways to do this, and one is better for me than the other that I know. The first (slow) way is to use Wake-on-Lan to start the machine, then PXE or Etherboot to pull pxegrub from the server, supplying an appropriate grub.conf to boot Lin or Win. This works, but it involves two separate DHCP requests to the server, adding a few seconds to the whole process. It just seemed kludgey to me.

The way I'll outline uses Etherboot coupled with memdisk for Windows, and straight Etherboot for Linux. It's very slick.

Here I'm assuming the machine in question already dual-boots with GRUB.

First, set up dhcp and tftp on the server. I used a setup similar to


ddns-update-style interim;

#option option-150               code 150 = text; #for pxegrub

default-lease-time 86400; # 1 day
max-lease-time 259200;    # 3 days
log-facility local7;

option domain-name-servers;

subnet netmask {
        range dynamic-bootp;
        option broadcast-address;
        option routers;
        allow booting;
        allow bootp;
        next-server; #the TFTP server--absolutely necessary for Etherboot!

        #filename "/pxegrub"; #these are necessary for the pxegrub approach
        #option option-150   "(nd)/grub.conf";
        filename "/kernel.nb";
        server-name "";

If you get the "[!!]" response from "/etc/init.d/dhcp restart", it helps to run dhcpd standalone for the syntax checking. Of course, you can also differentiate this file by MAC address, etc.


INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -s ${INTFTPD_PATH}"

Of course also start up in.tftpd and dhcp and add them to the default runlevel.

Next, on the local machine go to and generate a .zlilo Etherboot image specific for your network card. Click "Configure," and turn off the 3-second delay. I'm looking for a good way to make the process default to the hd and Windows when the server can't be reached, without looping back around to GRUB, but haven't found it yet. Place the .zlilo file in the /boot folder of the local machine, with the name "etherboot." An entry like this in the local grub.conf will boot the .zlilo (you'll want to make this the default, with a low timeout):


title Etherboot
kernel /boot/etherboot

Now, on the server emerge syslinux and set up a working directory:

emerge syslinux
mkdir /work
cd /work
cp /usr/lib/syslinux/memdisk .

As explained here:, version 1.4.3 of mknbi doesn't work well with memdisk, so we'll use 1.4.4:


=net-misc/mknbi-1.4.4 ~x86


emerge mknbi
man mknbi

Now to prepare the images. We could use mknbi-linux here too; by default Etherboot supports pxe, nbi, or elf. Obtain the kernel bzImage from the local machine and put it in "/work".


mkelf-linux bzImage --rootdir="/dev/hdX" > /boot/netboot/kernelLin.elf

For Windows, it will be a little more complicated. As described here:,
download the Windows XP startup disks from (you may need to get the home or pro specific version, but I don't think it will matter for this).
Run this on a Windows machine, and pull cdboot1.img from the temporary directory as described. Then

mkdir /floppy
mount cdboot1.img -t vfat -o loop /floppy

Delete everything but from the image. Then copy in boot.ini and ntldr from c:\ on the client computer, and rename ntldr to setupldr.bin. Then

#make sure the directory /floppy is mounted! Otherwise it'll fill up your real filesystem. This might be dangerous--dunno, but it works for me.
#It saves about 80KB in the final gzipped image.
dd if=/dev/zero of=/floppy/zero

umount /floppy
gzip -9 cdboot1.img
mkelf-linux --rdnopad memdisk cdboot1.img.gz > /boot/netboot/kernelWin.elf

We need to turn off padding to make memdisk work, but other than that it's the same as described in the mknbi man page, for mkelf-linux.

At this point you're almost done--just copy the kernel which you want to boot to kernel.elf: (edit; I found out tftp doesn't like symlinks)
 cp /boot/netboot/kernelWin.elf /boot/netboot/kernel.elf

Sort of a lot of work for a few seconds, but those extra few seconds would be especially annoying (for me) since pxegrub replicates almost everything that Etherboot already did.


I left out something--for the Wake-on-Lan, just enable it in the BIOS or by hooking up the WoL connector on the motherboard of the local machine, and emerge wakeonlan on the server. Then just pass wakeonlan the MAC address of the local machine.


I hadn't noticed this: I guess I'll be trying that, i.e. set up BOOT_SECOND = BOOT_DISK at rom-o-matic, with Windows being the default hd GRUB selection.

EDIT 9/15/06:

I needed to pass the "raw" option to memdisk to get this to work with my new hardware. Well, this time I'm using it to boot Windows from an extended partition with no windows boot partition.

Last edited by evilben on Fri Sep 15, 2006 10:05 pm; edited 4 times in total
Back to top
View user's profile Send private message
Tux's lil' helper
Tux's lil' helper

Joined: 14 Nov 2003
Posts: 96
Location: Dortmund, Germany

PostPosted: Wed Apr 19, 2006 5:58 pm    Post subject: Reply with quote

nice howto. gonna try it tomorrow and post some feedback. it's exactly the thing i want to do for a long time. only terminal server function via vnc and gdm missing now. can't get it to work, but that's another topic :)
- Listen to Dispatch - smile - be happy -
- my (german) page
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum