Kickstart-list Digest, Vol 68, Issue 11

Rodney Mercer rmercer at harris.com
Thu Oct 29 12:27:48 UTC 2009


On Wed, 2009-10-28 at 18:33 -0400, Peter Scheie wrote:
> 
>                                  From: 
>         Peter Scheie
>         <peter.scheie at visionshareinc.com>
>                              Reply-to: 
>         Discussion list about Kickstart
>         <kickstart-list at redhat.com>
>                                    To: 
>         Discussion list about Kickstart
>         <kickstart-list at redhat.com>
>                               Subject: 
>         Re: putting ks.cfg into
>         initrd.img
>                                  Date: 
>         Wed, 28 Oct 2009 16:04:49 -0500
>         (17:04 EDT)
>         
>         
>         Thanks, Chip.  I have a copy of your presentation in my desk
>         and refer to it 
>         regularly.  But I'm at home today (sick kid) and since it was
>         out of sight, it 
>         was out of mind.
>         
>         I fixed my kickstart-in-initrd.img file problem (was editing
>         wrong initrd file), 
>         but I'm having some other difficulties and there some aspects
>         to 
>         kickstart/anaconda that I don't quite understand, and it
>         occurs to me that I 
>         should probably describe what I'm trying to do to make sure
>         it's even possible.
>         
>         Currently, we distribute a stripped down Centos to customers.
>         We do this by 
>         creating an ISO that is just a syslinux system with a ks.cfg
>         loaded via http 
>         (ks=http://blah.blah.com/).  Within the ks.cfg, the
>         installation method 
>         specified is http as well, so basically everything is pulled
>         from the web 
>         server.  To carry it one step further, we have our customers
>         download a 
>         customized Unetbootin which pulls down this installer ISO file
>         and installs it 
>         onto a USB flash drive.  The customer then boots their server
>         from the flash 
>         drive, the kernel and initrd.img file are loaded, the
>         kickstart is retrieved 
>         from the http server, as is minstg2.img, and the installation
>         goes on its merry 
>         way.  It works wonderfully--IF the customer's server can get
>         an IP address from 
>         a DHCP server.  But often it cannot, because, for example, it
>         is in a DMZ; 
>         besides, ultimately, we require them to enter a static address
>         for the server, 
>         althought that doesn't happen until after installation.  The
>         solution at the 
>         moment is to have the customer edit the boot command of the
>         installer and append 
>         an IP, netmask, gw and dns address.  No big deal if one is
>         used to Linux, but 
>         Sales & Marketing is telling me our customer's can't handle
>         this.  So, my 
>         thought is to prompt the customer for the network info at the
>         very beginning of 
>         the boot process, and then somehow pass that to anaconda so it
>         can connect to 
>         our web server.  Interestingly, right now when the installer
>         does not get an 
>         address from a dhcp server, it does pop up the network
>         configuration dialog. 
>         Unfortunately, this info does not get passed to minstg2.img
>         because while 
>         minstg2.img does get downloaded, it then gives errors that the
>         kickstart file 
>         could not be downloaded; tcpdump showed new dhcp requests
>         coming from the 
>         installer at this stage.  My first thought was to put the
>         kickstart into the 
>         initrd.img in the ISO and use the ks=file: parameter in the
>         boot command, and in 
>         %pre put some shell commands that would prompt the user for
>         networking info. 
>         But it's still trying to pull minstg2.img from the web server.
>         At 37MB, 
>         minstg2.img is more than four times the entire installer ISO,
>         but if it gives me 
>         an environment for prompting the user for network info, I'll
>         put it into the ISO.
>         
>         So, my questions are:
>         
>         1. How do I tell anaconda that minstg2.img is on the same
>         medium as initrd.img 
>         and ks.cfg and so on?
>         
>         2. When DHCP fails and the dialog for network info pops up, is
>         there a way that 
>         info can be passed to minstg2.img, such that ks.cfg could be
>         pulled from the web 
>         server and not have to be in initrd.img?
>         
>         3. One would think that the asknetwork parameter would answer
>         #2 above, but it 
>         doesn't seem to.  Should it?  Am I just doing something
>         incorrectly?
>         
>         Thanks.
>         
>         Peter 
>         
Peter,

I not sure if this helps, but quite a while back, I created a customized
cdrom install for some customers where the install asks for the specific
IP, subnet mask, gateway and nameserver at the beginning of the install.

I used this guide to get it working:
http://lingxiang.tang.googlepages.com/createalesssizecentos5

Here are the relevant portions of the ks file, watch out for email text
wraps.

---
install
text
lang en_US.UTF-8
keyboard us
%include /tmp/buildnet
xconfig --resolution 1280x1024 --depth 24 --defaultdesktop=GNOME
--startxonboot
rootpw --iscrypted $1$YgYDO$VBMrl0IkjTjv3Xu817AZa/
authconfig --enableshadow --enablemd5
firewall --disabled
selinux --disabled
timezone America/New_York
reboot --eject
zerombr
bootloader --location=mbr

clearpart --all
part /boot --fstype ext3 --size=150 --asprimary
part / --fstype ext3 --size=5000 --asprimary
part swap --recommended
part pv.00 --size=1 --grow

volgroup vg00 pv.00
logvol /var --name=var --vgname=vg00 --fstype ext3 --size=2000
logvol /usr1 --name=usr1 --vgname=vg00 --fstype ext3 --size=1 --grow

services --enabled rsh,rlogin,telnet,nfs,vsftpd
services --disabled
auditd,bluetooth,ip6tables,ntpd,sendmail,iptables,smartd,pcs
cd,avahi-daemon,restorecond,mdmonitor,irqbalance,hidd

%pre
# setup the network interface to use static ip
chvt 3
exec < /dev/tty3 > /dev/tty3
echo "--Static Network Configuration--"
echo "Please enter hostname for this machine, IE: myhost"
read HOSTNAME
echo "Please enter ip address for this machine, IE: 192.168.0.100"
read IPADDR
echo "Please enter subnet mask for this machine, IE: 255.255.255.0"
read NETMASK
echo "Please enter gateway address for this machine, IE: 192.168.0.1"
read GATEWAY
echo "Please enter nameserver address for this machine, IE: 192.168.0.1"
read NAMESERVER
chvt 1
exec < /dev/tty1 > /dev/tty1

cat << EOF > /tmp/buildnet
network --device eth0 --bootproto static --ip=$IPADDR --netmask=$NETMASK
--gateway=$GATEWAY --hostname=$HOSTNAME --nameserver=$NAMESERVER
--noipv6
EOF

cat << EOF > /tmp/installnet
ip=$IPADDR 
netmask=$NETMASK 
gateway=$GATEWAY 
host=$HOSTNAME
EOF

%packages --nobase
@admin-tools
@authoring-and-publishing
@base
@base-x
@core
@development-tools
@engineering-and-scientific
@gnome-desktop
@gnome-software-development
@graphical-internet
@graphics
@java
@legacy-network-server
@office
@printing
@ruby
@sound-and-video
@system-tools
@x-software-development
acroread
acroread-plugin
arts
bsh
compat-libstdc++-33
cyrus-sasl
dbus-devel
ddd
desktop-printing
dkms
elinks
emacs
flash-plugin
glibc-devel
httpd
im-chooser
jre-1.6.0-fcs
libxml2-devel
ncurses-devel
openmotif
openmotif-devel
openmotif22
python-devel
samba-client
sendmail
system-config-securitylevel
system-config-services
vim-enhanced
vsftpd
wmctrl
zlib-devel
-ckermit
-elilo
-elsa
-gnopernicus
-iprutils
-java-1.4.2-gcj-compat-plugin
-libungif-devel
-linuxwacom
-logwatch
-longrun
-mcelog
-mlocate
-notify-daemon
-open
-openldap-clients
-pidgin
-pirut
-ppc64-utils
-prctl
-pup

# optional packages to install
elfutils-libelf-devel-static
elfutils-libelf-devel
elfutils-devel-static
elfutils-devel
xorg-x11-xbitmaps

%post --nochroot
chvt 3
exec < /dev/tty3 > /dev/tty3
mkdir -p /mnt/source
mount -t iso9660 /tmp/cdrom /mnt/source
echo "sleeping 3 minutes"

cp /tmp/installnet /mnt/sysimage/tmp/installnet
df -h >> /mnt/sysimage/tmp/mounted.txt

# Copy demo files into place.
cp /mnt/source/files/desktop-setup.sh /mnt/sysimage/tmp/


umount /mnt/source
exec < /dev/tty1 > /dev/tty1

%post
#
source /tmp/installnet


# Allow X11 Forwarding
/usr/bin/perl -pi -e 's/#.*ForwardX11 no/ForwardX11
yes/' /etc/ssh/ssh_config 


# Create /usr1/home and nfs export it.
mkdir /usr1/home
echo "/usr1/home      *(rw,root_squash,sync)" > /etc/exports


for NUM in `seq 1 20`
do
echo "user${NUM}   ${host}:/usr1/home/user${NUM}" >> /etc/auto.home
/usr/sbin/useradd -g users -c "User${NUM}" -d /usr1/home/user${NUM}
-s /bin/csh user${NUM}
/bin/chmod g+rx /usr1/home/user${NUM}
/usr/sbin/usermod -d /home/user${NUM} user${NUM}
echo "user${NUM}:user${NUM}" >> /tmp/users.txt
done

cat /tmp/users.txt |/usr/sbin/chpasswd

wait


echo "end of post-install" 

exit 0







More information about the Kickstart-list mailing list