Aerospace



Home

Company Information

Information Request

Linux How-to Guides

ADSP 21xx
Digital Signal Processing
Tutorials

SW Utilities

On-line Order Form

Linux Support

Windows 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.


Custom Search

FTP Based Auto-Installation

The Mandrake Auto-install System is based on Redhat Kickstart. It is a collection of Perl scripts and is quite powerful, but also somewhat buggy. It is therefore quite useful to know what works and what doesn't.

You should also read the CDROM based auto-install howto guide, to get the full story: http://www.aerospacesoftware.com/autoinstall-howto.html

You can find detailed information here: http://members.shaw.ca/mandrake/drakx/HTML/, but if you read only that guide, then you will suffer from information overload. This guide shows a practical example, which should help you get going.

All the files you need to get (kick)started, are in the /image directory on the first Mandrake CDROM. Some things are in the form of floppy disk images. To get at the contents, write a floppy disk using 'dd' or do a loopback mount.


FTP Server

To do a FTP install, you actually need two floppy disks. You also need an FTP server of course. Configure a machine with Proftpd and create an anonymous FTP area. Create a subdirectory for your installation repository and copy all CDROMs to it. Copy them all 'on top of each other'. We used the directory /home/ftp/mdk10.0/data.

You can copy the CDs like this:

# cd /mnt/cdrom
# cp -a * /home/ftp/mdk10.0/data

Rinse and repeat for all six CDROMs. If this is a server with no removable media drives, then you can FTP the CDROMs from another machine. Try lftp, it can traverse subdirectories - ordinary ftp can't - see 'man lftp'. Otherwise, you may have to make huge tarbals of the CDROMs and FTP that over to the server.

Here is an example config file /etc/proftpd.conf, which leaves everything wide open. First get things to work, then tighten up the security a bit. If this machine is only accessible from your LAN, then it is OK like this.

# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName                      "Welcome to FTP"
ServerType                      standalone
DefaultServer                   on

# Allow FTP resuming.
# Remember to set to off if you have an incoming ftp for upload.
AllowStoreRestart               on

# Port 21 is the standard FTP port.
Port                            21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                           022

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances                    50

# Set the user and group under which the server will run.
User                            nobody
Group                           nogroup

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.

  AllowOverwrite                on


# Needed for NIS.

PersistentPasswd              off

# Default root can be used to put users in a chroot environment.
# As an example if you have a user foo and you want to put foo in /home/foo
# chroot environment you would do this:
#
# DefaultRoot /home/foo foo

# Anonymous ftp section.  Users can login as "anonymous" or "guest".

  User                          ftp
  Group                         ftp
  UserAlias                     guest ftp
  UserAlias                     anonymous ftp

  # Messages
  DisplayLogin                  welcome

  # Maximum clients with message
  MaxClients                    10 "Sorry, max %m users -- try again later"

  # Allow all others.
  
    AllowAll
  

  # We want all uploaded files to be owned by 'ftp' group and
  # group writable.
  GroupOwner                    ftp
  Umask                         755


Auto-Install Data

Add your auto_inst.cfg file to the root of the repository. When you boot a PC using the FTP install floppy disk, it will look for the rpm files listed in auto_inst.cfg in this location, which in this case is /home/ftp/mdk10.0/data. This directory is specified in the file syslinux.cfg, which is shown later.

Here is an example of the auto_inst.cfg file. Note the postconfiguration section at the end. That section contains commands that will be executed after the main system has been installed. Note that during the install, the executive is Busybox, not Bash. Therefore, scripts that you call, should not start with #! /bin/bash - just delete that line and put nothing at the top of the script files - Busybox knows how to find itself...

The auto_inst.cfg file lists every RPM that must be installed - just the base name, minus the version numbers. This file is fairly self explanatory when you can see a full fledged example:

#!/usr/bin/perl -cw
#
# You should check the syntax of this file before using it in an auto-install.
# You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file
# (note the '#!/usr/bin/perl -cw' on the first line).
$o = {
       'printer' => {
                      'BROWSEPOLLADDR' => undef,
                      'configured' => {},
                      'MANUALCUPSCONFIG' => undef,
                      'BROWSEPOLLPORT' => undef,
                      'DEFAULT' => undef,
                      'SPOOLER' => undef
                    },
       'libsafe' => 0,
       'security_user' => 'root',
       'netc' => {
                   'NETWORKING' => 'yes',
                   'DHCP' => 1,
                   'GATEWAY' => undef,
                   'GATEWAYDEV' => undef,
                   'HOSTNAME' => 'gc2.globalsuite.net',
                   'autodetect' => {
                                     'lan' => {
                                                'eth0' => 'eepro100'
                                              }
                                   },
                   'internet_cnx' => {},
                   'dnsServer3' => undef,
                   'dhcp_client' => 'dhcp-client',
                   'DOMAINNAME' => 'globalsuite.net',
                   'dnsServer' => undef,
                   'NET_DEVICE' => undef,
                   'ZEROCONF_HOSTNAME' => '',
                   'dnsServer2' => undef
                 },
       'default_packages' => [
                               'locales',
                               'locales-en',
                               'msec',
                               'perl',
                               'kernel-smp-2.6.3.7mdk',
                               'vim-enhanced',
                               'grub',
                               'eject',
                               'gnupg',
                               'hotplug',
                               'urw-fonts',
                               'urpmi',
                               'drakxtools-newt',
                               'mpage',
                               'bootsplash',
                               'foomatic-filters',
                               'foomatic-db-engine',
                               'mandrake_desk',
                               'XFree86',
                               'drakxtools',
                               'gurpmi',
                               'libpcap0',
                               'lynx',
                               'sane-backends',
                               'apache-conf',
                               'binutils',
                               'mandrake-mime',
                               'python',
                               'perl-Digest-SHA1',
                               'perl-libwww-perl',
                               'libtool',
                               'mtools',
                               'perl-Digest-HMAC',
                               'procmail',
                               'libstdc++5-devel',
                               'ImageMagick',
                               'apache2',
                               'gcc',
                               'mailx',
                               'openssh-clients',
                               'qiv',
                               'XFree86-server',
                               'drakfirsttime',
                               'harddrake-ui',
                               'iptables',
                               'm4',
                               'menudrake',
                               'perl-Net_SSLeay',
                               'tightvnc',
                               'userdrake',
                               'OpenIPMI',
                               'XFree86-75dpi-fonts',
                               'at',
                               'autoconf',
                               'coreutils-doc',
                               'cvs',
                               'devfsd',
                               'dhcp-client',
                               'dmidecode',
                               'drakconf',
                               'drakwizard',
                               'ftp-client-krb5',
                               'galaxy-gnome',
                               'harddrake',
                               'hdparm',
                               'hexedit',
                               'jfsprogs',
                               'ldetect',
                               'lshw',
                               'mdkonline',
                               'ndiswrapper',
                               'ntp',
                               'numlock',
                               'openssh-server',
                               'postgresql',
                               'reiserfsprogs',
                               'rpmdrake',
                               'rxvt',
                               'strace',
                               'sudo',
                               'telnet-client-krb5',
                               'tmpwatch',
                               'xterm',
                               'fonts-ttf-vera',
                               'man',
                               'libncurses5-devel',
                               'apache2-mod_cache',
                               'links',
                               'apache2-mod_disk_cache',
                               'apache2-mod_proxy',
                               'automake',
                               'bind-utils',
                               'gcc-c++',
                               'icewm-light',
                               'patch',
                               'bind',
                               'perl-DB_File',
                               'perl-IO-stringy',
                               'perl-Mail-SpamAssassin',
                               'proftpd',
                               'rpm-build',
                               'WindowMaker',
                               'bison',
                               'dhcp-server',
                               'flex',
                               'fonts-ttf-decoratives',
                               'fonts-ttf-west_european',
                               'gettext-devel',
                               'gftp',
                               'gtk-engines',
                               'icewm',
                               'info',
                               'ltrace',
                               'man-pages',
                               'mountloop',
                               'perl-MIME-tools',
                               'perl-Term-Readline-Gnu',
                               'perl-devel',
                               'postgresql-server',
                               'rcs',
                               'routed',
                               'spamassassin',
                               'squid',
                               'tcpdump',
                               'traceroute',
                               'net-snmp-mibs',
                               'net-snmp-utils',
                               'pcre',
                               'perl-Net-DNS',
                               'joe',
                               'kernel-source',
                               'mutt',
                               'snort',
                               'squidGuard',
                               'j2re',
                               'net-snmp',
                               'perl-Compress-Zlib',
                               'perl-Digest-Nilsimsa',
                               'bridge-utils',
                               'perl-Razor-Agent',
                               'clamav',
                               'clamav-db',
                               'mozilla-firefox',
                               'perl-Archive-Tar',
                               'perl-Archive-Zip',
                               'perl-Convert-TNEF',
                               'perl-Convert-UUlib',
                               'libstdc++6-devel',
                               'lha',
                               'ncompress',
                               'nomarch',
                               'perl-IO-Multiplex',
                               'perl-IO-Socket-SSL',
                               'perl-Unix-Syslog',
                               'lzop',
                               'perl-Net-Server',
                               'amavis-postfix',
                               'amavisd-new'
                             ],
       'useSupermount' => 'magicdev',
       'users' => [
                    {
                      'icon' => 'ic-tux3',
                      'pw' => '$1$.dZCJ2bU$HIGPd4LKXbfsgZgfE4VvG.',
                      'uid' => 501,
                      'name' => 'tux',
                      'realname' => 'Tux',
                      'groups' => [],
                      'shell' => '/bin/bash',
                      'home' => '/home/tux',
                      'gid' => 501
                    }
                  ],
       'locale' => {
                     'country' => 'CA',
                     'lang' => 'en_US',
                     'langs' => {
                                  'en_US' => 1
                                },
                     'utf8' => ''
                   },
       'authentication' => {
                             'shadow' => 1,
                             'local' => '',
                             'md5' => 1
                           },
       'partitions' => [
                         {
                           'mntpoint' => '/boot',
                           'type' => 387,
                           'size' => 2057265
                         },
                         {
                           'mntpoint' => '/',
                           'type' => 387,
                           'size' => 12775329
                         },
                         {
                           'mntpoint' => 'swap',
                           'type' => 130,
                           'size' => 2160081
                         }
                       ],
       'netcnx' => {
                     'NET_DEVICE' => undef,
                     'type' => 'lan',
                     'lan' => {},
                     'NET_INTERFACE' => undef,
                     'PROFILE' => 'default'
                   },
       'superuser' => {
                        'pw' => '$1$JYY.5Ehp$IfHD0qwxWhh403kuEh5GN0',
                        'realname' => 'root',
                        'uid' => '0',
                        'shell' => '/bin/bash',
                        'home' => '/root',
                        'gid' => '0'
                      },
       'mouse' => {
                    'XMOUSETYPE' => 'ExplorerPS/2',
                    'name' => 'Any PS/2 & USB mice',
                    'EMULATEWHEEL' => undef,
                    'device' => 'input/mice',
                    'type' => 'Universal',
                    'nbuttons' => 7,
                    'MOUSETYPE' => 'ps/2',
                    'wacom' => []
                  },
       'autoExitInstall' => '0',
       'keyboard' => {
                       'GRP_TOGGLE' => '',
                       'KBCHARSET' => 'C',
                       'KEYBOARD' => 'us',
                       'unsafe' => 1
                     },
       'manualFstab' => [],
       'timezone' => {
                       'ntp' => 'pool.ntp.org',
                       'timezone' => 'Canada/Mountain',
                       'UTC' => '1'
                     },
       'services' => [
                       'alsa',
                       'amavisd',
                       'atd',
                       'crond',
                       'devfsd',
                       'dhcpd',
                       'dm',
                       'harddrake',
                       'iptables',
                       'keytable',
                       'kheader',
                       'named',
                       'netfs',
                       'network',
                       'ntpd',
                       'numlock',
                       'partmon',
                       'postfix',
                       'proftpd',
                       'random',
                       'rawdevices',
                       'snmpd',
                       'snortd',
                       'sound',
                       'spamassassin',
                       'squid',
                       'sshd',
                       'syslog',
                       'xfs'
                     ],
       'X' => {
                'bios_vga_mode' => undef,
                'resolution_wanted' => 1024,
                'monitor' => {
                               'HorizSync' => '31.5-57.0',
                               'VideoRam_probed' => '8192',
                               'size' => '',
                               'ModelName' => '1024x768 @ 70 Hz',
                               'VendorName' => 'Generic',
                               'manually_chosen' => 1,
                               'Identifier' => 'monitor1',
                               'VertRefresh' => '50-70',
                               'EISA_ID' => '0',
                               'dpms' => undef
                             },
                'default_depth' => 24
              },
       'intf' => {
                   'eth0' => {
                               'DHCP_HOSTNAME' => '',
                               'BOOTPROTO' => 'dhcp',
                               'DEVICE' => 'eth0',
                               'NEEDHOSTNAME' => 'no',
                               'NETMASK' => '255.255.255.0',
                               'BROADCAST' => '',
                               'NETWORK' => '',
                               'WIRELESS_ENC_KEY' => '',
                               'MII_NOT_SUPPORTED' => 'no',
                               'ONBOOT' => 'yes'
                             }
                 },
       'partitioning' => {
                           'auto_allocate' => '',
                           'clearall' => 0,
                           'eraseBadPartitions' => 0
                         },
       'security' => 2,
       'interactiveSteps' => [
                               'doPartitionDisks',
                               'formatPartitions'
                             ],
       'interactive' => 'newt',
       'desktop' => 'ICEWM',
       'postInstall' => '
# Notes:
# Busybox commands must be against left margin.
# Dont put any apostrophes or quotes inside comments!
# The environment is chroot the target machine hard disk.
# Dont try to access the CDROM. It is still mounted in
# the original root.  If you touch the CDROM, the file system
# will blow up.
echo Post-Configuration
read -p "Press Enter to Continue"
pwd
ls
echo Get post-configuration files from 10.1.111.115
# Launch a scripted FTP session
Server="10.1.111.115"
Password="dummy"
User="anonymous"
ftp -n $Server <<End-Of-Session
user "$User" "$Password"
binary
prompt off
cd mdk10.0-postconfig
mget *
bye
End-Of-Session
# List copied files
ls
# Make the post configuration scripts executable
chmod 754 conf*
echo Execute post-configuration script
read -p "Press Enter to Continue"
./configure
echo Post-Configuration Done!
read -p "Press Enter to Continue"
'
     };

Note that the Post-install system only works when you use some kind of network based installation method. It doesn't work when using a CDROM based install. The reason is a bug in the Kickstart system. At the end of the configuration script, it does a chroot to the target machine hard disk, but it neglects to first unmount the CDROM. The CDROM is mounted in /tmp/image while a chroot to /mnt is performed and the CDROM then becomes inaccessible. If you touch the CDROM during the Post-install, the file system blows up, so don't do that...

Also note that any quotes in comments cause syntax errors in the script execution. If you comment out a line while debugging something, ensure that the commented line doesn't contain single or double quotes.

Finally, the shell commands must be against the left margin. Bear in mind, that you are not running Bash at this point in time. You are running a limited kernel with the Busybox shell. Scripts that you want to run during the post-install must *not* start with a shebang line.


FTP Boot Floppy

The FTP boot floppy must contain the following files:

advanced.msg
help.msg
network.rdz
syslinux.cfg
boot.msg
ldlinux.sys
vmlinuz

The syslinux.cfg file should look something like this:

default linux
prompt 1
timeout 10
display boot.msg
F1 help.msg
F2 advanced.msg
F3 boot.msg
label linux
kernel vmlinuz
append root=/dev/hda1 initrd=network.rdz devfs=mount acpi=off
auto_install=auto_inst.cfg
automatic=method:ftp,ser:10.1.111.115,dir:/mdk10.0/data,user:anonymous,pass:dumm
y,netw:static,ip:10.1.111.116,netm:255.0.0.0,gateway:10.1.111.115,dom:example.co
m,hostname:xmpl,interface:eth0

Starting with 'append' it is all one long line. This file assigns a static IP address to the test machine, you can also use dhcp, in which case the ip, netm and gateway options can be deleted.

Here is a script that can be used to create the boot floppy disk - modify to suit:

#! /bin/bash

# Prompt user
echo "Make a Bootable Autoinstall Floppy Disk:"
echo "You got to be root - press ^C to quit if you are not."
read -p "Please insert a floppy disk - press [Enter]"

# Unmount
umount /mnt/floppy
# Format the floppy at 1.44 MB
fdformat /dev/fd0u1440
# Create a file system
mkfs -t vfat /dev/fd0u1440
# Make it a bootable Linux system disk
syslinux -s /dev/fd0u1440
# Mount the floppy
mount /mnt/floppy
# Copy the files
cp files/vmlinuz /mnt/floppy
cp files/network.rdz /mnt/floppy
cp files/*.cfg /mnt/floppy
cp files/*.msg /mnt/floppy
ls /mnt/floppy
# Unmount
ls /mnt/floppy
umount /mnt/floppy

echo Done!  Bootable Autoinstall floppy written OK.

When you boot up, the system will ask for the 'Additional Drivers' floppy disk. Make it from the file network.img from the /image directory of the first CDROM. You can use 'dd' to copy the image to a floppy disk:

# cd /mnt/cdrom/image
# dd if=network.img of=/dev/fd0

Debug

If you get FTP error -6, then the system cannot find the FTP server. Check the IP adresses and cables. Boot the machine under test with Knoppix and try to ping the FTP server. Obviously nothing will work if the machine can't talk to the FTP server.

If you get weird Perl error messages like 'something not found in line 199', then you probably have a quote mark inside a comment. This doesn't make any sense and is a baaaaaaad bug to run into.

If a script gives you a 'file not found' error, then go and delete the shebang line at the top of the script - this is Busybox, not Bash - Busybox knows how to find itself!




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