Ask Your Question

How to modify /etc contents using %pre script in kickstart?

asked 2017-05-10 12:05:37 -0500

buvaneshkumar gravatar image

I have been trying to add some custom configuration file while installing the operating system using kickstart. I have used following %pre configuration in my kickstart configuration, but it is not working. I am using Fedora 25 Netinstall ISO for my kickstart installation. Note: I don't want to do it in %post configuration. I need to create these files under /etc only using %pre configuration.

%pre --log=/mnt/sysimage/root/ks-pre.log

mkdir -p /mnt/sysimage/etc/skel/.config/hexchat

echo "v=2.12.4 N=Developers E=UTF-8 (Unicode) F=19 D=0 J=#developers N=freenode L=6 E=UTF-8 (Unicode) F=23 D=0" > /mnt/sysimage/etc/skel/.config/hexchat/servlist.conf


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-10 12:57:47 -0500

ssieb gravatar image

The root filesystem is not mounted at the time of the %pre script. I have a kickstart that saves files off the root filesystem before reinstalling and I have to mount and unmount it myself. Why can't that be done in %post? Or even better, create a simple package to install that for you automatically.

edit flag offensive delete link more


The main purpose of my pre %script is, It will create a custom configuration for hexchat application, I have stored the custom configuration in /etc/skel directory. So when user creation happens, It will automatically copy the custom configuration to user's home directory.

But the problem is, %post only runs after the OS installation, what if the user can be created during the OS installation, So it won't copy the custom configuration file to user's home directory.

I hope you understand that why I didn't prefer %post :) and also let me know if you have any idea. Thanks.

buvaneshkumar gravatar imagebuvaneshkumar ( 2017-05-10 13:09:46 -0500 )edit

Ok, I suspected that was the reason. My last suggestion is possibly the easiest. Make your own rpm package containing that file and add it to the install list.

ssieb gravatar imagessieb ( 2017-05-10 15:14:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2017-05-10 12:05:37 -0500

Seen: 338 times

Last updated: May 10 '17