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
- Install Windows
- Get RealVNC server for Windows from RealVNC.com
- Run VNC. Configure it to start automatically.
- Get TweakUI, if necessary
- Use TweakUI to configure automatic logon
- Optionally select a fixed IP to simplify VNC
- Test VNC from a remote system
Set up a headless Debian workstation
Install Debian base system
Download iso and burn CD 1 of the Debian set: The iso is available here: http://linux.csua.berkeley.edu/, in the file debian-cd/3.1r0a/i386/debian-31r0a-i386-binary-1.iso.
Option 1: your computer can boot from CD: Boot up with the Debian CD in the drive, go into the BIOS to make sure CD boot is enabled, continue booting, and then work through the Debian install process.
Option 2: your computer can not boot from CD: Make "boot", "root", and "cd-drivers" floppies, then boot from the boot floppy and work through the install process. There is a directory on Debian CD 1 with floppy disk images. Under Windows you write these images to floppy using the program "rwwrtwin.exe", which is also on the CD.
apt-get install x-window-system
apt-get install kde
Disable autoloading of X:
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:
Find the line that says
iface eth0 inet dhcp
Change it to
iface eth0 inet static
(These settings will vary depending on your network setup.)
Test your new IP settings:
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:
mke2fs -v /dev/fd0
mkdir -p /mnt/floppy
mount -t ext2 /dev/fd0 /mnt/floppy
Set up the floppy:
mkdir -p 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:
Now make GRUB set up the floppy as a boot loader
The GRUB shell will start up. At the shell prompt type:
device (fd0) /dev/fd0
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
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:
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.
In the event that a master boot record is overwritten, you have several options:
Option 1: Get back Windows
Boot with a Windows startup disk
Option 2: Get back the whole dual boot setup (not tested):
- Boot with the GRUB boot disk
- When the menu comes up, select Debian & log on
Now restore GRUB to the MBR:
The GRUB shell starts up. In it type:
root (hd1) setup (hd0) quit
These instructions assume that Windows is on IDE disk 1 (master) and Debian is on IDE disk 2 (slave). If you have two partitions on a single disk, Debian first, use
root (hd0,0) setup (hd0) quit
Comment on this article and its topic
Copyright © 2006-2008 Stephen Jungels. Written permission is required to repost or reprint this article
Last modified: Mon Oct 26 10:31:23 CDT 2009