Kickstart: How log and view %post? Method works in CentOS 5 but not CentOS 7

therbur fxb7-ox9n at dea.spamcon.org
Wed Mar 2 09:45:30 UTC 2016


Since nobody responded, I spent days looking around on this and
experimenting.

It makes no sense to me that the ability to both log and display
output is not intrinsic to kickstart.

Note that the %pre --log parameter does not work, it always
results in a 0-length log file.

Also, the example of that option in:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html#sect-kickstart-preinstall

is completely wrong anyway because it's logging %pre output to
the non-existent built image.


Summary of the solution that works for me for CentOS 7 kickstart:


%pre --erroronfail

exec < /dev/tty3 > /dev/tty3
chvt 3

(

echo ...

) 2>&1 | /usr/bin/tee /tmp/pre.log

%end



%post --nochroot --erroronfail

cp /tmp/pre.log /mnt/sysimage/root/

%end



%post --erroronfail

exec < /dev/tty3 > /dev/tty3
chvt 3

(

echo ...

) 2>&1 | /usr/bin/tee /root/ks-post.log



therbur <fxb7-ox9n at dea.spamcon.org> wrote:

>The following method has worked for years with CentOS 5, to allow
>live viewing of %post output and also logging it.  It doesn't
>work in CentOS 7.  What is the recommended method now?
>
># from kickstart text mode install
>
>%post --erroronfail
>
>chvt 3
>exec < /dev/tty3 > /dev/tty3 2> /dev/tty3
>
>tail -F /root/ks-post.log &
>(
>
>echo "Starting post-kickstart ..."
>
># ... various commands
>
>echo "Done."
>echo
>echo "Do Alt-F1 and press Enter to reboot"
>
>) >> /root/ks-post.log 2>&1
>
>%end





More information about the Kickstart-list mailing list