LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2010, 03:04 PM   #1
rbell54
LQ Newbie
 
Registered: Apr 2009
Location: Florida
Posts: 19

Rep: Reputation: 0
kickstart %post problem


I'm install RHEL5 from a kickstart file that seems to works but after the %post section nothing else works. How do I get the %post to start working? Is there a command I need to put before %post or a file I need or what? Not sure what is wrong and I need some help really bad because I am out of ideas:

Here's a copy of the script:

# Kickstart file automatically generated by anaconda.

install
cdrom
key --skip
lang en_US.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto static --ip xxx.xxx.xxx.xx --netmask xxx.xxx.xxx.x --gateway xxx.xx.xxx.xx --nameserver xxx.xx.xx.xx,xxx.xx.x.xx --hostname aaa1.xxx.xxx.com
network --device eth1 --onboot no --bootproto dhcp --hostname xxx.xxx.xxx.com
rootpw --iscrypted $xxxxxxxxxxxxxxxxxx
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc America/New_York
bootloader --location=mbr --driveorder=cciss/c0d0,cciss/c0d1 --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --initlabel
part /boot --fstype ext3 --size=100 --ondisk=cciss/c0d0
part pv.4 --size=139870 --grow --ondisk=cciss/c0d0
volgroup vg00 --pesize=32768 pv.4
logvol /tmp --fstype ext3 --name=lvol3 --vgname=vg00 --size=1000
logvol / --fstype ext3 --name=lvol1 --vgname=vg00 --size=10000
logvol /home --fstype ext3 --name=lvol2 --vgname=vg00 --size=10000
logvol /usr --fstype ext3 --name=lvol5 --vgname=vg00 --size=15000
logvol /opt --fstype ext3 --name=lvol4 --vgname=vg00 --size=5000
logvol /usr/local --fstype ext3 --name=lvol6 --vgname=vg00 --size=4000
logvol swap --fstype swap --name=swap --vgname=vg00 --size=10000
logvol /var --fstype ext3 --name=lvol7 --vgname=vg00 --size=6000
part pv.200000 --size=71000 --grow --ondisk=cciss/c0d1
volgroup vg01 --pesize=32768 pv.200000
logvol /system_backups --fstype ext3 --name=lvol20 --vgname=vg01 --size=49000


%packages
@admin-tools
@editors
@system-tools
@development-tools
@gnome-software-development
@text-internet
@x-software-development
@legacy-network-server
@gnome-desktop
@core
@base
@network-server
@legacy-software-development
@java
@java-development
@legacy-software-support
@base-x
@graphics
@web-server
@printing
@kde-software-development
@kde-desktop
@mail-server
@server-cfg
@development-libs
@news-server
@graphical-internet
system-config-kickstart
emacs
vim-X11
arpwatch
adjtimex
rdesktop
watchdog
wireshark-gnome
tsclient
x3270
am-utils
audit
amanda-client
sysstat
dejagnu
imake
expect
xorg-x11-xbitmaps
mesa-libGLU-devel
xorg-x11-server-sdk
gconf-editor
hal-gnome
aide
kexec-tools
nfs4-acl-tools
x86info
device-mapper-multipath
cpufreq-utils
amanda-server
vnc-server
krb5-server
gtk+
qt4
compat-openldap
compat-slang
xorg-x11-utils
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
libsane-hpaio
tomcat5-webapps
tomcat5
kdeadmin
perl-libxml-perl
perl-XML-SAX
perl-LDAP
perl-Convert-ASN1
perl-DateManip
perl-XML-Twig
perl-XML-Grove
perl-XML-Dumper
perl-Crypt-SSLeay
perl-Mozilla-LDAP
perl-TimeDate
perl-XML-NamespaceSupport
kdewebdev
mutt
-rwho
-rusers
-sysreport
-bluez-utils
-tux
-dovecot
compat-libstdc++-33

%post --nochroot
SudoersFile="/etc/sudoers"
SSHFile="/etc/ssh/sshd_config"
SysAuthFile="/etc/pam.d/system-auth"
HostsFile="/etc/hosts"
AliasesFile="/etc/aliases"
SendmailCf="/etc/mail/sendmail.cf"
YumFile="/etc/yum/yum-updatesd.conf"
RCLocalFile="/etc/rc.local"
NTPConfFile="/etc/ntp.conf"
SysctlFile="/etc/sysctl.conf"
Profile="/etc/profile"
TextFile="/mnt/sysimage/root/ks-install.txt

echo "Kickstart `date`" >$TextFile
echo 'echo "0" > /proc/sys/kernel/core_uses_pid' >> $RCLocalFile
sed -i -e 's/^ulimit -S -c 0.+/ulimit -c 5000000/g' $Profile


echo “Adding groups and users..."
/usr/sbin/groupadd -g 500 sudoers
/usr/sbin/useradd -p 'xxxxxxxxxx' -g users -s /bin/ksh -G wheel,sudoers -d /home/john -m -u 7000 john
/usr/sbin/useradd -p 'xxxxxxxxx.' -g users -s /bin/ksh -G wheel,sudoers -d /home/doe -m -u 7001 doe
/usr/sbin/useradd -p 'xxxxx' -g users -s /bin/ksh -d /home/ham -m -u 9033 ham
/usr/sbin/useradd -p 'xxxxx' -g users -s /bin/ksh -d /home/sam -m -u 9003 sam
echo "Adding some productivity enhancements for root..."
echo "export HISTSIZE=10000" >> /root/.bash_profile
echo "alias grep='grep --color'" >> /root/.bash_profile

echo "Updating sudoers..."
sed -i -r -e 's/^rh/\# rh/g' $SudoersFile
echo '
%wheel ALL=(ALL) ALL
%sudoers ALL=(ALL) ALL
tomcat2 ALL=(ALL) NOPASSWD:/usr/sbin/lsof' >> $SudoersFile

echo "Updating sshd config..."
sed -i -r -e 's/^\#PermitEmptyPasswords no/PermitEmptyPasswords no/g' -e 's/^GSSAPIAuthentication yes/GSSAPIAuthentication no/g' -e 's/^\#KerberosAuthentication no/KerberosAuthentication no/g' $SSHFile

echo "Updating system auth for account lockout policy..."
sed -i -r -e 's/auth.+required.+pam_env.so/auth required pam_env.so\
auth required pam_tally.so onerr=fail deny=5 even_deny_root_account\
account required pam_tally.so/g' $SysAuthFile

echo "Updating sendmail configuration (setting relay)..."
sed -i -r -e 's/^DS/DSxxx.xxx.com/g' $SendmailCf

echo "Setting kernel params..."
echo 'fs.file-max = 8192' >> $SysctlFile

echo "Updating hosts file..."
echo '
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

xxx.xx.xx.xxx abc.dcf.com abc
xxx.xx.xx.xxx ghi.jkl.com ghi

' > $HostsFile

echo "Setting up ntp for the local time server..."
sed -i -r -e 's/^server.+rhel.+/\#server/g' $NTPConfFile
echo 'server xxx.xx.xxx.xxx' >> $NTPConfFile
/sbin/chkconfig --levels 345 ntpd on

echo "Changing ownership of /home/cat "
chown -R root:root /cat
chmod -R 775 /home/cat

Last edited by rbell54; 02-08-2010 at 03:09 PM.
 
Old 02-08-2010, 03:56 PM   #2
rlhartmann
Member
 
Registered: Mar 2008
Posts: 73

Rep: Reputation: 16
--chroot option

Why do you have the --nochroot option on your %post line,
if you do not change into the new system's root directory,
all the file changes you are making are being made into
the RAM disk of the installation, not onto your new created
file systems.

My %post option only has --log=/root/kickstart.install.log
after it, and it runs fine. I recommend removing the
--nochange root, and add a logging option. You can add
some simple echo commands that will then appear in the log
to help with debugging any installation issues.
 
Old 02-09-2010, 08:47 AM   #3
rbell54
LQ Newbie
 
Registered: Apr 2009
Location: Florida
Posts: 19

Original Poster
Rep: Reputation: 0
I remove the "%post --nochroot" and change the location of the variable
TextFile="/mnt/sysimage/root/ks-install.txt" to be
TextFile="root/ks-install.txt" and nothing will not run in the post section. Am I missing some package that need to be installed first or so need line to say run the post section.
 
Old 02-10-2010, 03:13 PM   #4
rlhartmann
Member
 
Registered: Mar 2008
Posts: 73

Rep: Reputation: 16
Quote:
Originally Posted by rbell54 View Post
I remove the "%post --nochroot" and change the location of the variable
I don't think you should move the %post line, just remove the --nochroot option.

Alternatively, you can leave the --nochroot but add
/mnt/sysimage/ to the beginning of all your file paths,
for example:
Quote:
SudoersFile="/etc/sudoers"
SSHFile="/etc/ssh/sshd_config"
should become:
Quote:
SudoersFile="/mnt/sysimage/etc/sudoers"
SSHFile="/mnt/sysimage/etc/ssh/sshd_config"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kickstart post-installation abhi2778 Linux - Software 8 07-10-2012 10:30 AM
Red Hat Enterprise Linux 5 RHEL5 kickstart problem with post install tate1615 Red Hat 1 04-30-2010 04:38 AM
Post script in kickstart qiuzhihong Linux - Software 1 04-19-2008 04:52 AM
Kickstart %post ftp problem tuesday Linux - General 6 04-01-2008 02:04 AM
problem with kickstart post section Hairman Red Hat 2 05-14-2007 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration