I have a kickstart file that I use to install CentOS 7. I run some scripts in the %post section of the kickstart file. In the script, there is a checking for the compatibility of the machine, and if the checking fails, I need to reboot/shutdown that particular machine, without completing the installation. But when I install the OS, If the compatibility checking fails, the computer is not rebooting, instead it is showing a message "running in chroot, ignoring requst".

How can i do this? I want to reboot my machine if the compatibility check fails, I am running the scripts in the %post section of the kickstart file.

  • You know that in %post, the system is already installed! – Michael Hampton May 17 '16 at 10:21
  • I have some packages that will be installed after the OS installation. I want to stop the installation of the software if the system doesn't meet the requirements. – Vishnu May 17 '16 at 10:47

Have a look at %pre -- maybe you can run your tests prior to the installation. Otherwise you can have multiple %post sections. And there's also a %post --nochroot which does exactly what you think it does.

I would do the following if I had to do it with %post and needed the chroot for the test:

/path/to/test || touch /test-failed

%post --nochroot
test -e /mnt/sysimage/test-failed && reboot

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.