I remain fuzzy on what appear to be limitations to Kickstart's execution of a post-install script.

My initial understanding was that the %post area of the kickstart file was to execute commands on the system after the installation was said and done. What I might be misunderstanding is the context of this execution, despite the fact that I instruct the Kickstart file to use Bash as the interpreter. I have a Bash script that configures a CentOS system as a kiosk for our network. Alone the script works fine, but it's normally executed well after an installation is finished and one has logged into a GNOME session. I wanted to take that script and, with some modifications, have Kickstart run it in an effort to get as close to unattended as possible. A mere copy-and-paste of the script has some dramatically undesirable effects. First, the post script takes hours to complete. If run inside GNOME manually, it takes no more than a minute to execute in the worst cases. Second, when it finishes, several aspects appear to have not worked at all. For example, the section where firewalld is configured seems to have not been run as my custom zone and services are entirely absent. Another version of this script attempts to chmod a trigger file to conditionally execute another script, and while the trigger file is created, the chmod on that file doesn't appear to work. Further, what I understand to be the log files for anaconda: /tmp/program.log and /tmp/install.log, show nothing out of the ordinary as anything having failed.

I have a lightly modified copy of the Bash script which has some sensitive elements removed (noted when it does this) here: https://pastebin.com/uSkcdynf. The Kickstart file is pretty standard, only having this script pasted between the %post and %end for that section.

  • 1
    I'm not familiar enough with Kickstart to offer a definitive solution, but the docs mention that the post-installation script is executed in a chroot environment. That could be the cause of your problems. See the link for more details and example configurations.
    – Haxiel
    Apr 5 '19 at 17:21

@Haxiel You hit the nail on the head. My understanding of chroot is better than what it was when I started this adventure, but still not quite where I feel it needs to be. Breaking out of chroot granted me the ability to render changes more permanent, not to mention the speed increase was noticable.

Another caveat I'd like to throw out there for others is that if you have scripts that rely on the use of programs that are installed via Anaconda, you'd need to do some testing to see if those programs still work once the chroot is broken. For example, I was unable to use git because the program couldn't find the default templates directory. Even after I specified this through global configs, there were still all other kinds of flaky issues that didn't have an obvious fix. Whittling the workflows of my scripts down to basics really went a long way in making this work.

  • Hey, I'm glad to see you've found a solution. The '@username' notifications don't work from answers, so I saw this by accident today. Anyway, thanks for writing this up. Please do consider adding the updated sections of your Kickstart file here as well, for reference.
    – Haxiel
    Apr 9 '19 at 16:37

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.