Aerospace



Home

Company Information

Information Request

Linux How-to Guides

ADSP 21xx
Digital Signal Processing
Tutorials

SW Utilities

On-line Order Form

Aerospace Projects

Commercial Projects

Circuit Boards

Server Support


Bonk

Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now?

Please make a donation to help with maintenance.


Mandrake Autoinstall Howto Guide

System: Mandrake 10.0

In a corporate environment, it is important to be able to rapidly create workstations to a predefined specification. Mandrake Linux has a couple of options to help you do this, but getting them to work is not quite clear and the wizards are a little buggy still.

It also helps knowing a few Unix disk duplication tricks, so I start with discussing those.


Duplicate a Hard Disk

The simplest way to replicate a machine, is to duplicate the hard disk of a reference system. Linux has a utility called dd (disk duplicate) for this exact purpose. This utility writes a raw byte stream to the disk and you can do various weird things with it. This utility is very old, as manifest by its odd parameter handling - no dashes. If you want to erase a disk drive totally:

  • # dd if=/dev/zero of=/dev/hda

There are a few problems with that command. Firstly, it takes forever and once done, the workstation won't boot anymore. It will also overwrite the Master Boot Record and some system BIOSs don't appreciate it when the MBR is all zeroes. So you should store a copy of a valid MBR somewhere to get you out of a fix:

  • # dd if=/dev/hda of=/root/mbr.img bs=512 count=1

That will save the very first block of 512 bytes, the MBR, to a file. You can then write the MBR back using the reverse of the above command (transpose if and of), when needed.

Another way to fix the MBR, is with a DOS boot floppy. Take an old DOS or Windows98/ME boot disk, start up and do this:

  • A> fdisk /mbr

That usually works to revive a zonked disk, but sometimes fdisk will report "MBR NOT written!", in which case you need that 512 byte image to use with dd.

What we really want to do, is duplicate a disk drive. Install a second drive in the reference machine and do this:

  • # dd if=/dev/hda of=/dev/hdb

That will make a perfect copy of drive hda to drive hdb, provided that drive hdb is the same size or larger than hda. The copy process will continue until it runs out of data at the end of the source disk. Beware though: Get the 'if' and 'of' the wrong way around and the result will be rather disappointing.

This is also a very simple (though inefficient) way to keep a mirror of a disk drive in a server. Install a second drive and run the above from cron.weekly. If the primary drive breaks, then you can yank it and reboot. Sometimes, simplicity is best.

If you are paranoid or work with sensitive information, then you can use dd to erase a disk drive before you junk a workstation. Once overwritten with zeroes or worse - random numbers - it becomes very difficult to recover any data from the drive - though not completely impossible. Overwriting with pseudo-random numbers is easy, but this is even slower than overwriting with zeroes. You need a huge mug of coffee and much patience, since the experience is somewhat like watching paint dry, as it can take more than 30 minutes to copy a large disk:

  • # dd if=/dev/random of=/dev/hda

No matter how many times you overwrite the data on a hard disk, the original data can still be recovered with special tools, but few people have the need, the money and patience to do that. You can use the same method to erase a floppy disk, but it is so easy to recover data off a used floppy disk, that it is not worth the trouble. If you really need to destroy a floppy disk, use a pair of scissors and if you really need to destroy a hard disk, use a very big hammer...


Make a Linux Boot Floppy

When messing around with disk drives, you are going to need a boot floppy disk eventually. It is also handy to have a boot image to put on an El Torito bootable CDROM. A problem with a boot floppy disk is that the Mandrake image doesn't fit on a standard diskette, so you have to format it a little differently - Here is a boot floppy disk recipe:

Insert a floppy disk in the drive.
Mandrake will likely automount it, so you have to undo that:
# umount /mnt/floppy

Format the floppy at 1.72 MB:
# fdformat /dev/fd0u1722 

Create a good old DOS VFAT file system:
# mkfs -t vfat /dev/fd0u1722

Make it a Linux disk:
# syslinux -s /dev/fd0u1722

Mount the floppy:
# mount /mnt/floppy 

Copy the kernel image:
# cp /boot/vmlinuz /mnt/floppy

Copy the the init ram disk image:
# cp /boot/initrd.img /mnt/floppy

Create a syslinux.cfg configuration file - change hda1 to your disk drive if
different:
# cat > /mnt/floppy/syslinux.cfg
default linux
prompt 1
timeout 10
label linux
kernel vmlinuz
append root=/dev/hda1 initrd=initrd.img quiet devfs=mount acpi=off
^D

(Hit Ctrl-D to create the file after the above)

Unmount the floppy:
# umount /mnt/floppy

TEST that floppy disk! Insert it in a drive and reboot!!!

You should save the floppy disk image to a file, for later use to make bootable El Torito CDROMs:

  • # dd if=/dev/fd0 of=/root/boot-floppy.img

Package List Automation

The simplest way to partially automate the installation, is to use a package list. You can then partition the disk manually, get the list of packages from a floppy disk, maybe add a few more and then do the installation in order to get a system with pretty much the same configuration as the reference machine. Mandrake keeps a copy of the installed packages in /root/drakx/auto_inst.cfg.pl

This file can be copied to a floppy disk and used to install the same set of packages to another machine. It is a text file with the names of all rpm files to install (minus the version numbers), so you can easily modify the list by hand. When you copy this file to a floppy, rename it to remove the .pl extension:

  • # cp /root/drakx/auto_inst.cfg.pl /mnt/floppy/auto_inst.cfg

The next time you need to do an installation, go through the motions, till you get to the package selection screen, then tick the little box at the bottom for individual package selection and at the next screen, you will then get the option to load the file list from a floppy disk.


Fully Automated Installation from CDROMs

If the new hardware is exactly the same as the old hardware, then duplicating the hard disk is the way to go. If the hardware is somewhat different, then you need the installation program to sort things out for you and automating the process helps to get things done quickly and easily

At the very end of the Mandrake installation procedure, just before you click the Reboot button, you can go to the Advanced menu. Here you have the option to make a disk with the package list discussed above, or a fully automated disk. The only problem is that the fully automated version doesn't actually fit on a floppy disk and the resulting disk doesn't actually work as is...

The workaround is to format a floppy disk at a larger size (use two more tracks than the standard 80). Format the floppy at 1.72 MB and create a good old DOS VFAT file system on it. Finally, you have to modify a few things to make it work.

If you zoomed past that last Advanced options button, you could run the wizard manually, to prepare an automatic install disk:

  • # drakautoinst

Except that it will fail to copy the file list and the syslinux.cfg is empty. So this wizard is just a wee little bit lacking...

Sooooooo, skip that wizard and create the floppy manually as follows:

  • # umount /mnt/floppy
  • # fdformat /dev/fd0u1722
  • # cd /root/drakx
  • # dd if=auto_install.img of=/dev/fd0
  • # mount /mnt/floppy
  • # cp /root/drakx/auto_inst.cfg.pl /mnt/floppy/auto_inst.cfg

Use your favourite text editor and modify file /mnt/floppy/auto_inst.cfg. Go to the bottom of the file and add a comma after the last stement which is probably 'interactiveSteps', then add the following two lines and remember to omit the comma after the last statement:

  • 'desktop' => 'KDE',
  • 'interactive' => 'gtk'

The 'desktop' statement is kind of self explanatory - you could also try 'ICEWM' or 'GNOME'. The 'interactive' statement will tell the system to prompt you for more CDROMs and is VERY IMPORTANT...

Finally, create the file syslinux.cfg, since the schtoopidttt thing is empty by default, which results in a cryptic 'Oops, no root partition at /usr/bin/perl-install/install_step.pm line 199' error, which of course doesn't help much to find the problem. Again, using your favourite editor, open file /mnt/floppy/syslinux.cfg and add the following lines:

  • default linux
  • prompt 1
  • timeout 10
  • label linux
  • kernel vmlinuz
  • append root=/dev/hda1 initrd=initrd.img quiet devfs=mount acpi=off

Label that floppy properly, since it is kindof dangerous to have any automated install disk lying around unlabeled.

To use this system, put the diskette in the floppy drive and boot from the #1 CDROM. This means that your BIOS boot order must be CDROM first. Press F1 to get to the advanced command line and type:

  • # linux auto_install=floppy

Hopefully, that will work for you and the install will proceed faily automatically - you do get an opportunity to change the partitioning - but no stupid questions and all you have to do is swap CDs.


I hope this helps!

Herman



Copyright © 2005-2008, Aerospace Software Ltd., GPL.