kickstart - asking for configuration in the %pre section
Hi guys!
First post here, be nice... :newbie: I am preparing a kickstart for CentOS 5.3 in my company, and we want to be able to install the product the same way in several servers, but some parameters will vary between different customers we'll ship the product to - for example the root password, or some inner product-related parameters. One way to solve this is to just burn a new CD with a new configuration file in it for each customer installing our product, but this is a little pain if we're going to ship CDs to 5 different customers every day. It would be much better if in the pre-installation i could ask some questions and process the answers later in the post installation. I tried to do something like that: Code:
%pre Code:
. /tmp/answers.txt Anyhow, this doesn't really work - the 'chvt 2' changes to tty2, but doesn't write or gets input from user, and the pre install script just goes on. Looking at the /tmp/anaconda.log during installation shows the message: ERROR : Error code 1 encountered running a kickstart %pre/%post script Anybody has an idea how to fix this? Thank you very much! |
Hi johnymta,
I think anaconda has already allocated tty2 for use and its not interactive, you need to choose an unused one like tty6 eg. %pick_a_section_here exec < /dev/tty6 > /dev/tty6 chvt 6 # prompt user for info here #finished chvt 1 cheers, kbp |
I tried something like this a while ago and remember something where the input and output weren't on the terminals you expected, so I wond up having to redirect them with >>. I don't think I still have that code, but if I find it, I'll post what I did.
I actually dropped this approach and instead set everything in the kickstart file for generic value and then wrote scripts that ran on firstboot to configure the server. The benefit of this was I could configure everything at once and then still had the scripts available in case someone fat-fingered something. I've seen where other people pregenerate kickstart files on another server, then select that file for the build. This of course requires you to configure the network, easiest way is with dhcp. |
Thanks for the answers, However - It actually didn't help... I tried severals ttys, and tried to switch between graphical and text mode - doesn't help...
I think the key issue here might be the error in the log: ERROR : Error code 1 encountered running a kickstart %pre/%post script What does error code 1 means? I think after the chvt command there's an error and the rest of the %pre script doesn't actually work... This is very frustrating... The firstboot solution will probably work fine - but then the installation of the system couldn't be really unattended enough (in the case configuration is done at the %pre stage you can go have lunch after that and come back with a fully configured system...) |
I found what I had. And as I said, I didn't wind up using this in the end, but you should be able to add something like this to %pre:
Code:
clear >/dev/tty1 If you find you need more flexibility than standard shell scripts allow, you might try using python, which should already be in the build environment or miniperl, which you can compile and then dump in a separate directory on the disk. |
Thanks a lot! This helps a little... I'm close to finding what really was my problem (I have a theory).
BTW, if you don't know - if you want to configure only hostname and IP you can do it by using 'bootproto=query' in the 'network' configuration in the kickstart file... |
As I thought...
'2>/mnt/sysimage/root/ks-preinstall-errors.log' was the problem... maybe this is because system is readonly at the %pre section or something... Or maybe it was the 'clear' command that helped? I wish anaconda will give a more detailed log in the case of such errors... simply doing 'exec </dev/tty8 >/dev/tty8' instead of what i wrote at the beginning solved the problem... Thanks for your help guys! :) |
Glad you got it working.
I think '2>/mnt/sysimage/root/ks-preinstall-errors.log' failed because sysimage wouldn't be mounted at this point. If you want to log errors, you'll have to save it somewhere else, such as /tmp/ which sits in RAM and then copy it over during %post. |
All times are GMT -5. The time now is 02:09 PM. |