[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Installation reports: using a network console to remote install sarge



Hi all,
I thought I would share my recent experience with you of performing
totally remote installations of sarge.

I have several server machines I administer for my team that are located
in a room across the continent. They were running the corporate standard
RHEL2 or 3, which sucks so very much that I cannot express. Since I have
been tasked with administering these machines I wanted to install
debian- I've been a user since almost prehistory (I remember installing
rexx or bo using the wonderful technique of imaging my friends install).

Anyway, the new debian installer absolutely kicks the pants off that
anaconda rubbish I've had to tolerate up to now and this network console
http://wiki.debian.net/?DebianInstallerNetworkConsole absolutely blew my
mind. I wanted to build proper root on lvm on raid systems (I love that
setup- it's so neat and tidy) so I knew that I couldn't just deboostrap-
I'd be left with a pile of half redhat half debian stuff (I've been here
and tried it, and it's not pretty- the lvm stuff in redhat is pre 1.0,
and some of the older RH installs don't have mdadm and it's just a
mess). So the network install is the bonus I've been looking for.

Anyway the wiki instructions are pretty out of date so I've made up my
own:

1. Grab the debian installer source:
	apt-get source debian-installer

2. Get the build deps (this was fun: I wanted to create a sarge d-i,
with my laptop running sid, but I mostly managed it):
	apt-get build-dep debian-installer

This is where the instructions get vague. So I started hacking using a
local box where I could get to the keyboard and give it the magic 3
fingers if need be.

I first started by attempting to modify the hd-media image, since I
didn't really want the overhead of grabbing lots of stuff off the net- I
had a netinst image that should have worked, and I could drop the
preseed and iso images directly on the root of the server boxen (I would
avoid rebuilding the initrd by doing this). However several problems
occured:
	1. The netinst iso image did not contain ssh- which meant that the
second stage installation was be inaccessible.
	2. The (more serious) problem was that the iso on the disk held a file
handle open, meaning that the installer couldn't completely nuke the
disk (in fact, it didn't do it at all).

So I abandoned the hd-media hack and instead built a netboot image. 

Continuing the instructions from above:
3. Modify the build/pkg-lists/netboot/i386.cfg file, add to the top:
	#include "network-console"

4. Create a simple preseed file, with at least the following, and copy
it to the /tmp directory:

d-i netcfg/choose_interface            select eth0
d-i netcfg/disable_dhcp                boolean true
d-i netcfg/get_nameservers             string 192.168.2.3
d-i netcfg/get_ipaddress               string 192.168.2.25
d-i netcfg/get_netmask                 string 255.255.255.0
d-i netcfg/get_gateway                 string 192.168.2.1
d-i netcfg/confirm_static              boolean true
d-i netcfg/get_hostname                string myserver
d-i netcfg/get_domain                  string myhome.none
d-i debian-installer/network-console/password password password
d-i debian-installer/network-console/password-again password password

Note that you'll need the patch to bug #315030 to get the nameservers to
work- if not, you'll have to ssh to the shell to fix your resolv.conf.

5. Modify the build/config/local file, add:
	EXTRA_FILES=/tmp/<mypreseed.cfg>

This worked fine, except that it wouldn't read the preseed file I'd
built above. It insisted on querying DHCP. I found out that this is
because the netboot image does not allow for a _file_ preseed. I had to:

6. Modify the build/pkg-lists/netboot/common, _replace_ network-preseed
with file-preseed.

This (and the patch on bug #315030) solved all the remaining problems.
Yay! (One intriguing thing, the build netboot image only appears in the
build/tmp/netboot_2.6 directory, not the dest directory- but it's not
really a problem).

7. Build your netboot image:
	fakeroot make rebuild_netboot_2.6

8. Deploy your image to the target linux box. In the
build/tmp/netboot_2.6/ directory, there's a vmlinuz and initrd.gz. Copy
these files to your target box. Rename vmlinuz to debian-installer, the
initrd.gz to debian-installer-rd.gz, and move them to the boot
directory.

9. Modify your target box's bootloader config to add in the debian
installer image. For recent grub versions I used this:

title debian installer
        root (hd0,0)
        kernel /debian-installer DEBCONF_PRIORITY=critical rw
ramdisk_size=24000 root=/dev/rd/0 languagechooser/language-name=English
countrychooser/shortlist=US console-keymaps-at/keymap=us
preseed/file=/tmp/<mypreseed.cfg>
        initrd /debian-installer-rd.gz

For lilo:

image=/boot/debian-installer
	label=debinst
	read-write
	ramdisk=24000
	initrd=/boot/debian-installer-rd.gz
	append="root=/dev/rd/0 DEBCONF_PRIORITY=critical
languagechooser/language-name=English countrychooser/shortlist=US
console-keymaps-at/keymap=us preseed/file=/tmp/<mypreseed.cfg>"
	
(Note the root= is missing in this image- this is because lilo tries to
check that the root exists- which it probably won't. So I added it to
the append instead. It seemed to work).


10. Finally, reconfigure your bootloader default image to be the debian
installer, and reboot your target machine.

Once I ironed out the kinks, this has worked like a charm 3 times in a
row.

I ssh to installer@<target> once it starts responding to pings (remember
to switch your terminal to UTF-8) and select to start menu. Heck I
normally open 2 or 3 ssh sessions to tail the log files. It's awesome-
the whole debian-installer experience from 3000 miles away. Sweet.

Hope you all found this slightly useful. Feel free to pepper me with
questions if you so desire. I'm off to infect some more machines with
debian. I just need to figure out a boot loader for windows and I can
conquer the world :D 

Christian
	




Reply to: