I am kickstarting several EL6 systems and I want to log the actions taken in my %pre section.
I know that I can log the %post section per the hints provided by centos.org: Tips and tricks for anaconda and kickstart using one of these two methods:
%post --log=/root/my-post-log
echo 'Hello, World!'
Or:
%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
However I can't get this to work with the %pre section. Here is what I'm using:
%pre --log=/var/log/my-pre-log
echo 'Hello, World!'
When I am finally allowed to use the Virtual Consoles, the logfile is not to be found anywhere on the system.
This works fine for the %post section because at the time %post is executed, Anaconda switches to the new disks using chroot-- /var/log/ actually exists on the new system, and thus the logfile will exist after a reboot.
The problem with doing this with the %pre section is that the only filesystems available at the time is the memory-only filesystem. If I write the file to /tmp/, /root/pre_install.log or /var/log the filesystem disappears as soon as I shut down the machine.
The debugging shell is not available until midway through the installation, which makes debugging difficult.