possible bug in kickstart with RHEL4 and %pre scripts using LVM

Bjorn Oglefjorn sys.mailing at gmail.com
Mon Aug 20 19:48:30 UTC 2007


Here you go:
--- partinfo    2007-08-20 15:47:18.000000000 -0400
+++ partinfo.new        2007-08-20 15:47:44.000000000 -0400
@@ -10,7 +10,7 @@
 S2=$4 # This is the size of disk 2, etc.

 # This would be a partition scheme for two or more drives
-if [ $numd -ge 2 ]; then cat << EOF >> /tmp/partinfo
+if [ $numd -ge 2 ]; then cat << EOF > /tmp/partinfo
 part /boot --fstype ext3 --size=100 --ondisk=$d1 --asprimary
 part /boot2 --fstype ext3 --size=100 --ondisk=$d2 --asprimary
 part swap --size=512 --ondisk=$d1 --asprimary
@@ -25,7 +25,7 @@

 else

-cat << EOF >> /tmp/partinfo
+cat << EOF > /tmp/partinfo
 part /boot --fstype ext3 --size=100 --ondisk=$d1 --asprimary
 part swap --size=1024 --ondisk=$d1 --asprimary
 part pv.01 --fstype "physical volume (LVM)" --size=1 --grow --ondisk=$d1

--BO

On 8/17/07, Harry Hoffman <hhoffman at ip-solutions.net> wrote:
>
> Hi All,
>
> Ran into what I believe is a bug. It looks to be in the %pre section.
>
> Background:
>
> Running CentOS release 5 with cobbler 0.5.2. I have a kickstart file for
> installing RHEL 4.5 (see below).
>
> I have a %pre section in the kickstart file that defines partitions:
>
>
> # Magically figure out how to partition this thing
> %include /tmp/partinfo
>
> %pre
> # Determine how many drives we have
> set $(list-harddrives)
> let numd=$#/2
> d1=$1 # This is the device of disk 1
> d2=$3 # This is the device of disk 2, etc.
> S1=$2 # This is the size of disk 1
> S2=$4 # This is the size of disk 2, etc.
>
> # This would be a partition scheme for two or more drives
> if [ $numd -ge 2 ]; then cat << EOF >> /tmp/partinfo
> part /boot --fstype ext3 --size=100 --ondisk=$d1 --asprimary
> part /boot2 --fstype ext3 --size=100 --ondisk=$d2 --asprimary
> part swap --size=512 --ondisk=$d1 --asprimary
> part swap --size=512 --ondisk=$d2 --asprimary
> part raid.01 --size=1 --grow --ondisk=$d1
> part raid.02 --size=1 --grow --ondisk=$d2
> raid pv.01 --fstype "physical volume (LVM)" --level=RAID1 --device=md0
> raid.01 raid.02
> volgroup internal_hd pv.01
> logvol / --fstype ext3 --name=slash --vgname=internal_hd --size=1 --grow
> EOF
>
> else
>
> cat << EOF >> /tmp/partinfo
> part /boot --fstype ext3 --size=100 --ondisk=$d1 --asprimary
> part swap --size=1024 --ondisk=$d1 --asprimary
> part pv.01 --fstype "physical volume (LVM)" --size=1 --grow --ondisk=$d1
> volgroup internal_hd pv.01
> logvol / --fstype ext3 --name=slash --vgname=internal_hd --size=1 --grow
> #part / --fstype ext3 --size=1 --grow --ondisk=$d1
> EOF
>
> fi
>
>
> This pre script shows the following errors on vt3:
> * Running kickstart %pre script(s)
> let: arith: syntax error: "numd=2/2"
>
> let: arith: syntax error: "numd=2/2"
>
> [: 2: unexpected operator
>
> * All kickstart %pre script(s) have been run
> * Exception parsing ks.cfg: Defined PV partition pv.01 multiple times
>
>
> In this particular case I have only one (logical HW RAID) drive and the
> /tmp/partinfo is created with the lines contained in the else clause
> from above.
>
> The error about partition pv.01 causes kickstart to fail and die :-(
>
> Please see the full kickstart file below.
>
> I should note that if I place the part info from the else clause outside
> of the %pre section (i.e. just create a static partition declaration in
> the kickstart file) then everything works as expected.
>
> Any ideas? I'm stumped.
>
> Cheers,
> Harry
>
>
> # Kickstart file to automate the installation of Oracle 10 on RHEL4
> # Harry Hoffman <hhoffman at fqdn.com>
> # Oracle 10g Kickstart file for CentOS 4.x
> #platform=x86, AMD64, or Intel EM64T
> # System authorization information
> auth  --useshadow  --enablemd5
> # System bootloader configuration
> bootloader --location=mbr --md5pass=blah
> # Partition clearing information
> clearpart --all --initlabel
> # Use text mode install
> text
> # Firewall configuration
> firewall --enabled --port=22:tcp
> # Run the Setup Agent on first boot
> firstboot --disable
> # System keyboard
> keyboard us
> # System language
> lang en_US.UTF-8
> langsupport --default=en_US.UTF-8 en_US.UTF-8
> # Use network installation
> url --url=http://192.168.1.3/cblr/links/RHEL-4.5-i386
> # Network information
> network --bootproto=static --ip=192.168.1.10 --netmask=255.255.240.0
> --gateway=192.168.1.249 --nameserver=192.168.1.3
> --hostname=db1.prod.fqdn.com --device=eth0 --onboot=on
> # Reboot after installation
> reboot
>
> #Root password
> rootpw --iscrypted blah
> # SELinux configuration
> selinux --enforcing
> # Do not configure the X Window System
> skipx
> # System timezone
> timezone  America/New_York
> # Install OS instead of upgrade
> install
> # Clear the Master Boot Record
> zerombr
>
>
>
>
> # Magically figure out how to partition this thing
> %include /tmp/partinfo
>
> %pre
> # Determine how many drives we have
> set $(list-harddrives)
> let numd=$#/2
> d1=$1 # This is the device of disk 1
> d2=$3 # This is the device of disk 2, etc.
> S1=$2 # This is the size of disk 1
> S2=$4 # This is the size of disk 2, etc.
>
> # This would be a partition scheme for two or more drives
> if [ $numd -ge 2 ]; then cat << EOF >> /tmp/partinfo
> part /boot --fstype ext3 --size=100 --ondisk=$d1 --asprimary
> part /boot2 --fstype ext3 --size=100 --ondisk=$d2 --asprimary
> part swap --size=512 --ondisk=$d1 --asprimary
> part swap --size=512 --ondisk=$d2 --asprimary
> part raid.01 --size=1 --grow --ondisk=$d1
> part raid.02 --size=1 --grow --ondisk=$d2
> raid pv.01 --fstype "physical volume (LVM)" --level=RAID1 --device=md0
> raid.01 raid.02
> volgroup internal_hd pv.01
> logvol / --fstype ext3 --name=slash --vgname=internal_hd --size=1 --grow
> EOF
>
> else
>
> cat << EOF >> /tmp/partinfo
> part /boot --fstype ext3 --size=100 --ondisk=$d1 --asprimary
> part swap --size=1024 --ondisk=$d1 --asprimary
> part pv.01 --fstype "physical volume (LVM)" --size=1 --grow --ondisk=$d1
> volgroup internal_hd pv.01
> logvol / --fstype ext3 --name=slash --vgname=internal_hd --size=1 --grow
> #part / --fstype ext3 --size=1 --grow --ondisk=$d1
> EOF
>
> fi
>
>
> %packages
> automake
> bison
> cpp
> flex
> gcc
> gcc-c++
> glibc-devel
> glibc-headers
> glibc-kernheaders
> libungif
> Xaw3d
> xorg-x11-xauth
> libcap
> ntp
> sudo
> vlock
> screen
> sysstat
> -sendmail
> postfix
> vim-enhanced
> # Oracle 10 stuff
> compat-db
> openmotif
> setarch
> libaio
> libaio-devel
> compat-gcc-32
> compat-gcc-32-c++
> compat-libstdc++-33
>
> %post
> chvt 3
>
>
> #Turn off/on services
> chkconfig --level 2345 isdn off
> chkconfig --level 2345 portmap off
> chkconfig --level 2345 nfslock off
> chkconfig --level 345 ntpd on
> chkconfig --level 345 cups off
>
> #Setup root mail forwarding
> echo -e "root:\troot at fqdn.com" >> /etc/aliases
> postalias /etc/aliases
>
>
> # Setup Oracle
> groupadd -r oinstall;
> groupadd -r dba;
> useradd -r -c "Oracle DB User" -g oinstall -G dba -m -p 'blah' oracle
>
> echo "# " >> /etc/sysctl.conf
> echo "# Required for Oracle 10g " >> /etc/sysctl.conf
> echo "# " >> /etc/sysctl.conf
> echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
> echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
> echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
> echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
> echo "fs.file-max = 65536" >> /etc/sysctl.conf
> echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
> echo "net.core.rmem_default=262144" >> /etc/sysctl.conf
> echo "net.core.rmem_max=262144" >> /etc/sysctl.conf
> echo "net.core.wmem_default=262144" >> /etc/sysctl.conf
> echo "net.core.wmem_max=262144" >> /etc/sysctl.conf
> /sbin/sysctl -p
>
>
> echo "oracle              soft    nproc   2047" >>
> /etc/security/limits.conf
> echo "oracle              hard    nproc   16384" >>
> /etc/security/limits.conf
> echo "oracle              soft    nofile  1024" >>
> /etc/security/limits.conf
> echo "oracle              hard    nofile  65536" >>
> /etc/security/limits.conf
>
> # setting /etc/profile
> echo "if [ \$USER = \"oracle\" ]; then" >> /etc/profile
> echo "        if [ \$SHELL = \"/bin/ksh\" ]; then" >> /etc/profile
> echo "              ulimit -p 16384" >> /etc/profile
> echo "              ulimit -n 65536" >> /etc/profile
> echo "        else" >> /etc/profile
> echo "              ulimit -u 16384 -n 65536" >> /etc/profile
> echo "        fi" >> /etc/profile
> echo "fi"  >> /etc/profile
>
> # Change pam to respect the new limits
> echo "session    required     /lib/security/pam_limits.so" >>
> /etc/pam.d/login
>
> # Make oracle directories
> mkdir -p /opt/oracle/product/10.2.0.1/db_1
> chown -R oracle:oinstall /opt/oracle/
> chmod -R 775 /opt/oracle/
>
> # Set ORACLE_HOME in oracle's .bashrc
> echo "ORACLE_HOME=/opt/oracle/product/10.2.0.1/db_1" >>
> /home/oracle/.bashrc
> echo "PATH=\$PATH:\$ORACLE_HOME/bin" >> /home/oracle/.bashrc
> echo "export \$PATH" >> /home/oracle/.bashrc
>
> touch /etc/oratab
> chown oracle:oinstall /etc/oratab
>
>
> wget -O /home/oracle/10201_database_linux32.zip
> http://192.168.1.3/cblr/localmirror/10201_database_linux32.zip
> wget -O /home/oracle/10gR2.rsp
> http://192.168.1.3/cblr/localmirror/10gR2.rsp
>
> chown oracle:oinstall /home/oracle/10201_database_linux32.zip
>
> cd /home/oracle && su oracle -c "unzip 10201_database_linux32.zip"
>
> wget -O /etc/rc3.d/S99oracle_install
> http://192.168.1.3/cblr/localmirror/S99oracle_install
> chmod 755 /etc/rc3.d/S99oracle_install
>
>
> # Update the system
> # Update the system
> /usr/sbin/rhnreg_ks --profilename "db1.prod.fqdn.com" --username
> "rhuser" --password "blah" --email "root at fqdn.com"
> up2date -fu up2date
> up2date -fu
>
>
> wget http://192.168.1.3/cblr/watcher.py?system_done=RHEL-4-Oracle -b
>
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list at redhat.com
> https://www.redhat.com/mailman/listinfo/kickstart-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kickstart-list/attachments/20070820/710539fe/attachment.htm>


More information about the Kickstart-list mailing list