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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I missed your first email, but we do this in our installs.  


The el7 anaconda uses tmux underneath, which can be exploited to display whatever you want or even interact with a user.  

The first thing we do, is change the provided rsyslog.conf to log to our central server, which serves most of our needs.  something like the following in a %pre script will get you most of the logs from the installer:

# wget https://your.server/rsyslog.conf -O /etc/rsyslog.conf 
# systemctl restart rsyslog 

This can be further used to display logs using some tmux commands. e.g:

# tmux new-window -a -n logging 'tail -F /path/to/log/file.log'

We take this a step further, and use tmux to run our %pre and %post scripts directly.  

# tmux new-window -a -n prescript 'python /tmp/pre.py'
# while [ ! -f /tmp/predone ]
# do
#	sleep 1
# done 
# tmux kill-window -t prescript

This sort of setup can also be used with xloadimage to launch a non-blocking script to paste an image to the screen while the text mode installer is running.

I hope this helps.  

Ross Smith <rjsm@xxxxxxxxx>
College of Engineering - CAEN - Linux Support

On Wed, Mar 2, 2016 at 4:45 AM, therbur <fxb7-ox9n@xxxxxxxxxxxxxxx> wrote:
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@xxxxxxxxxxxxxxx> 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


_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux