3

While anaconda kickstart installer runs the "Performing post-installation setup tasks" tasks are not visible on console and their outcome is only saved to ks-post.log file.

I do want to also display it on the console as these steps could take a long time and there is a clear need to see what happens in real time.

How can I do this?

3 Answers 3

4

I have used a method similar to what is shown below.

Logging %pre and %post

When using a %pre or %post script you can simply log the output to a file by using --log=/path/to/file

%post --log=/root/my-post-log
echo 'Hello, World!'
enter code here

Another way of logging and displaying the results on the screen would be the following:

%post
exec < /dev/tty3 > /dev/tty3
chvt 3
echo
echo "################################"
echo "# Running Post Configuration   #"
echo "################################"
(
echo 'Hello, World!'
) 2>&1 | /usr/bin/tee /var/log/post_install.log
chvt 1

From: https://wiki.centos.org/TipsAndTricks/KickStart

3
  • Clearly you answer and link look quite valid but the real life testing was not so good, the "Performing post-installation setup tasks" was still silent even after implementing that change. I should mention that I am using a serial console deployment and I suspect this may have somethign to do with it. github.com/ssbarnea/harem/blob/master/roles/dsm/defaults/…
    – sorin
    Dec 5, 2018 at 19:07
  • 1
    Yes, that detail is important since there are no VTY when using serial and thus chvt wouldn't work. Sorry.. I don't know of a way to do it via serial. Dec 5, 2018 at 21:28
  • You could try to write the log to /proc/self/fd/1. Depending on the startup procedure for the post script, it eventually could work. Otherwise checking for the pid of the process using the serial device (e.g. lsof) could get the right pid to write output into /proc/<pid>/fd/1.
    – hargut
    Jun 3, 2019 at 18:56
3

I don't see any obvious way in the docs to log the %post script to console, but if you really need to see the script output while it's still running during installation, then you might try switching to another virtual console and running tail -f /mnt/sysimage/root/ks-post.log.

3
  • This used to work with RHEL 6, but no longer with 7.
    – miken32
    Jun 3, 2019 at 18:19
  • @miken32 Really? It worked at the time I posted this. Jun 3, 2019 at 18:57
  • I take it back. It absolutely did not work a few years back in the early 7.x releases, which prompted my question on U&L
    – miken32
    Jun 5, 2019 at 17:00
0

Not sure how it will work with a serial console, but this is how I show progress on TTY3:

%post --interpreter /bin/bash

printf "\r\nChanging output to TTY 3; press Alt-F3 to view\r\n" > /dev/tty1

{
## do stuff
} 2>&1 | tee /root/postinstall.log > /dev/tty3
%end

See https://unix.stackexchange.com/questions/350415/cant-monitor-kickstart-post-install-log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .