4

I've finished writing my kickstart file but one thing bugs me the whole day. I've searched all over the net, found numerous posts with different solutions and none of them helped me.

I did a fresh install from my kickstart-ed ISO which contains several files. I would like to copy those files to the newly installed system and start one of those files as a service (it is a service).

This is my %post right now:

%post --log=/root/ks-post.log
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6
clear
cp /mnt/source/JOTC/src/mongod.conf /etc/
cp -r /mnt/source/JOTC/src/jotc/ /opt/
cp /mnt/source/JOTC/src/service /etc/init.d/jotc

Errors are fairly reasonable; /mnt/source/JOTC/src/mongod.conf: no such file or directory.

However, if I switch to virtual terminal 2 manually and do a quick ls /mnt/source/JOTC/src/ there IS that mongod.conf file.

What am I doing wrong?

  • Is mongod.conf a broken symlink? – jordanm Dec 5 '13 at 21:51
  • I don't believe it is. That file, along with the others is on the installation ISO that I prepared. – ivica Dec 5 '13 at 22:03
  • Seems to be chrooted environment. Wouldn't %post --nochroot help? – Robert Važan Apr 7 '15 at 2:26
4

I have solved it...

%post --log=/root/ks-post.log
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6
#mount the cd (ISO in my case) to copy files from it
#since this is chrooted environment
mount /dev/cdrom /mnt
cp -rf /mnt/JOTC/src/jotc/ /opt/
cp -f /mnt/JOTC/src/service /etc/init.d/jotc
#starting a service is dead simple
chkconfig iptables on
service iptables start
#opening a port is a little trickier
#this line adds a rule right before the word 'COMMIT' in iptables config
sed -i "/COMMIT/ { N; s/COMMIT\n/-A INPUT -p tcp -m tcp --dport 8888 -j ACCEPT\n&/ }" /etc/sysconfig/iptables
iptables-save > /etc/sysconfig/iptables
service iptables restart

I hope someone will benefit from this. Took me 3 days to figure it all out :) (my kickstart file has ~50 more lines).

  • +1 but have you managed to find out why VT2 that you manually used didn't have a chrooted environment? – Joseph R. Dec 7 '13 at 0:49
  • @ivica but i am getting error "mount: special device /dev/sdc1 does not exist" – ImranRazaKhan Apr 17 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.