Hi
After a kickstart install how do you get a yum update to run as the final stage of the install?
a 'yum update' in the %post does not seem to do anything at all - no errors just nothing?
thanks
Tom Brown wrote:
Hi
After a kickstart install how do you get a yum update to run as the final stage of the install?
a 'yum update' in the %post does not seem to do anything at all - no errors just nothing?
Try this in your kickstart file:
%post --interpreter /bin/bash yes | yum update
Without the '--interpreter /bin/bash' the code will (I think) be interpreted as python. Also, when you run 'yum update' you are prompted to confirm that you want to go ahead and update the listed packages, and so you need to pipe 'yes' through it.
Hope this helps,
Joe
Try this in your kickstart file:
%post --interpreter /bin/bash yes | yum update
Without the '--interpreter /bin/bash' the code will (I think) be interpreted as python. Also, when you run 'yum update' you are prompted to confirm that you want to go ahead and update the listed packages, and so you need to pipe 'yes' through it.
thanks for the response - with regard piping yes through to yum it seems you can just specify yum -y update and this will anser yes for you.
the interpreter bit is now causing the end of the kickstart to bomb out with the error of '/usr/local/bin/bash can not be run' as this is where bash is it seems. This is the %post bit of the kickstart
%post --nochroot --interpreter /usr/local/bin/bash /usr/bin/yum -y update
any ideas??
Tom Brown wrote:
Try this in your kickstart file:
%post --interpreter /bin/bash yes | yum update
Without the '--interpreter /bin/bash' the code will (I think) be interpreted as python. Also, when you run 'yum update' you are prompted to confirm that you want to go ahead and update the listed packages, and so you need to pipe 'yes' through it.
thanks for the response - with regard piping yes through to yum it seems you can just specify yum -y update and this will anser yes for you.
the interpreter bit is now causing the end of the kickstart to bomb out with the error of '/usr/local/bin/bash can not be run' as this is where bash is it seems. This is the %post bit of the kickstart
%post --nochroot --interpreter /usr/local/bin/bash /usr/bin/yum -y update
Firstly, try it without the --nochroot as this switch makes the code run in the install system environment rather than chrooting into the newly installed system. Even if the commands worked, packages would be installed into the temporary file system in memory rather than onto disk. Secondly, it shouldn't be /usr/local/bin/bash unless you have installed a custom bash package. However, you should be able to use '--interpreter /bin/sh' to use the Borne shell instead of bash.
Does the -y switch also answer yes to importing the GPG key? If not, you will need to import the key prior to running yum.
On Fri, Jun 02, 2006 at 03:31:47PM +0100, Joseph Haig enlightened us:
Does the -y switch also answer yes to importing the GPG key? If not, you will need to import the key prior to running yum.
Yes, it does, given that the appropriate gpgkey option is set in the .repo file.
Matt
Tom Brown wrote:
Try this in your kickstart file:
%post --interpreter /bin/bash yes | yum update
the interpreter bit is now causing the end of the kickstart to bomb out with the error of '/usr/local/bin/bash can not be run' as this is where bash is it seems. This is the %post bit of the kickstart
%post --nochroot --interpreter /usr/local/bin/bash /usr/bin/yum -y update
you need to run this without the --nochroot option, there is no yum included in the installer system, and the only yum you will get working is the one inside the chroot.
also, what made you install bash in /usr/local/bin ????
- KB
you need to run this without the --nochroot option, there is no yum included in the installer system, and the only yum you will get working is the one inside the chroot.
OK thanks makes sense - however is there anyway to make some things run with --nochroot and others with it? Just that there is other things allready going on that need the --nochroot
also, what made you install bash in /usr/local/bin ????
i didn't - taken over systems and when i check a system that is allready kickstarted it says that bash is in /usr/local/bin
thanks
On Fri, Jun 02, 2006 at 03:44:01PM +0100, Tom Brown enlightened us:
you need to run this without the --nochroot option, there is no yum included in the installer system, and the only yum you will get working is the one inside the chroot.
OK thanks makes sense - however is there anyway to make some things run with --nochroot and others with it? Just that there is other things allready going on that need the --nochroot
First thing that comes to mind is:
%post --nochroot # Some non-chroot stuff
chroot /mnt/sysimage
# All the chrooted stuff here
yum -y update
also, what made you install bash in /usr/local/bin ????
i didn't - taken over systems and when i check a system that is allready kickstarted it says that bash is in /usr/local/bin
I would investigate that. It seems, well, less than intelligent in an RPM-based system.
Matt
First thing that comes to mind is:
%post --nochroot # Some non-chroot stuff
chroot /mnt/sysimage
# All the chrooted stuff here
yum -y update
ah ha! - yes - thats go it thanks
also, what made you install bash in /usr/local/bin ????
i didn't - taken over systems and when i check a system that is allready kickstarted it says that bash is in /usr/local/bin
I would investigate that. It seems, well, less than intelligent in an RPM-based system.
trust me - that is the least of my worries....
Tom Brown wrote:
you need to run this without the --nochroot option, there is no yum included in the installer system, and the only yum you will get working is the one inside the chroot.
OK thanks makes sense - however is there anyway to make some things run with --nochroot and others with it? Just that there is other things allready going on that need the --nochroot
You can have both:
%post --nochroot <Some stuff>
%post --interpreter /bin/sh <More stuff>
This is what the end of my kickstart file looks like:
%post --nochroot --interpreter /bin/sh cp /tmp/hostname /mnt/sysimage/root/.
%post --interpreter /bin/bash mount 192.168.100.1:/exports/centos /mnt cd /mnt ./scripts/post_install.sh
On Friday 02 June 2006 09:13, Tom Brown wrote:
After a kickstart install how do you get a yum update to run as the final stage of the install?
Hijack the firstboot mechanism.
a 'yum update' in the %post does not seem to do anything at all - no errors just nothing?
You shouldn't try to do anything near that complicated in a %post inside Anaconda during install.
While you may get it to work, the firstboot mechanism is design for this; I seem to remember a beta one time that asked to do an update during firstboot, but I don't remember which version; it was pre-yum (up2date was used) and it has been several years.
On Friday 02 June 2006 17:13, Tom Brown wrote:
Hijack the firstboot mechanism.
how would one do that??
See /etc/init.d/firstboot and /usr/sbin/firstboot. Modify them in your %post to do what you want. Make an update module, or something similar.
Since you're doing kickstart, you could drop in your own custom firstboot RPM that could do whatever it is you want on firstboot after installation.
I do our installs via PXE / HTTP, I go and get a post install script and run it. This way I don't have to muck around with the php scripts that generate the kickstart files for the installs.
%post mkdir -p /root/bin; cd /root/bin wget -q http://centos-4-repo1.XXX.XXX/yam/centos4-i386/install/post-install.sh sh /root/bin/post-install.sh 2>&1 | tee >> /root/post-install.log
Script on the kickstart server - post-install.sh
rm -rf /etc/yum/repos.d/*
cat >> /etc/yum.conf << "EOF" [base] name=CentOS-$releasever - Base baseurl=http://centos-4-repo1.XXX.XXX/yam/centos4-i386/RPMS.os http://centos-4-repo2.XXX.XXX/yam/centos4-i386/RPMS.os gpgcheck=0
[update] name=CentOS-$releasever - Updates baseurl=http://centos-4-repo1.XXX.XXX/yam/centos4-i386/RPMS.updates http://centos-4-repo2.XXX.XXX/yam/centos4-i386/RPMS.updates gpgcheck=0 EOF
yum -y update
J.J.