StephenJungels.com :: Open source :: Articles :: Headless Debian/Windows Dual Boot How-to

How to set up a headless dual boot Debian/Windows system

This document describes the basic steps I used to set up a headless dual boot system.

Set up a headless Windows workstation

Set up a headless Debian workstation

Install Debian base system

Install X:

apt-get install x-window-system
apt-get install kde

Disable autoloading of X:

rm /etc/rc2.d/S99kdm
rm /etc/rc2.d/S99xdm

At some point during this process, ssh was installed. You may want to append public keys from remote systems onto your authorized keys file in order to allow passwordless logon. When using Debian, you will ssh in to start up the VNC server (it would also be possible to configure VNC to start automatically, but that would waste RAM on those occasions when you connect a monitor and work locally.)

Get VNC for Linux:

apt-get install vncserver

Optional: choose a fixed IP to simplify ssh:

ifdown eth0
emacs /etc/network/interfaces

Find the line that says

iface eth0 inet dhcp

Change it to

iface eth0 inet static
  address 192.168.1.4
  netmask 255.255.255.0
  gateway 192.168.1.1

(These settings will vary depending on your network setup.)

Test your new IP settings:

ifup eth0
ping www.google.com

How to start up VNC (via ssh):

vncserver -geometry 1024x768

(This will create an X display at HOST:1. Test it from a remote VNC client.)

At this point each system is a functioning headless workstation, but we still need a way to select which system to boot, headlessly. For this purpose we create a GRUB boot floppy and configure it to boot Windows. The version of GRUB on the hard disk is already configured to boot Debian, so we leave it alone. Insert floppy = Windows; remove floppy = Debian.

Create a GRUB boot disk

Format a floppy, create a filesystem on it, and mount the floppy:

fdformat /dev/fd0
mke2fs -v /dev/fd0
mkdir -p /mnt/floppy
mount -t ext2 /dev/fd0 /mnt/floppy

Set up the floppy:

cd /mnt/floppy
mkdir -p boot/grub
cd boot/grub

Copy a few files from the GRUB install on the hard disk:

cp /boot/grub/stage? .
cp /boot/grub/e2fs_stage1_5 .
cp /boot/grub/menu.lst .
ln -s menu.lst grub.conf

Unmount the floppy:

cd ~
umount /mnt/floppy

Now make GRUB set up the floppy as a boot loader

grub --device-map=/dev/null

The GRUB shell will start up. At the shell prompt type:

device (fd0) /dev/fd0
root (fd0)
setup (fd0)
quit

Now reboot with the floppy in the drive. It should throw up a menu and then boot into Debian. If this works you are ready for the last step.

Now edit the copy of menu.lst on the floppy:

mount -t ext2 /dev/fd0 /mnt/floppy
cd /mnt/floppy/boot/grub
emacs menu.lst

Find the line that reads "default 0" and change it to the index of the Windows entry in the menu.lst file. If there is an empty entry that acts as a separator, count that when calculating the index of the Windows entry:

# this works for me:
default 3

Save the file. The boot floppy is now configured to boot Windows, and you can shut down, disconnect the monitor, and install your headless workstation in its final location. The boot floppy will also be there in case your master boot record is ever damaged.

Recovery procedures

In the event that a master boot record is overwritten, you have several options:

Option 1: Get back Windows

Option 2: Get back the whole dual boot setup (not tested):

Comment on this article and its topic


Copyright © 2006-2008 Stephen Jungels. Written permission is required to repost or reprint this article

Valid HTML 4.01 Transitional

Last modified: Mon Oct 26 10:31:23 CDT 2009