From 6b0914275ed1d55cf7be8ec58d52e13996d3b047 Mon Sep 17 00:00:00 2001 From: eriknordmark Date: Mon, 11 Dec 2023 16:19:44 -0800 Subject: [PATCH] init-initrd: fix LOGFILE Signed-off-by: eriknordmark --- pkg/xen-tools/initrd/init-initrd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/xen-tools/initrd/init-initrd b/pkg/xen-tools/initrd/init-initrd index f0bc69fff2..a2f25b2c74 100755 --- a/pkg/xen-tools/initrd/init-initrd +++ b/pkg/xen-tools/initrd/init-initrd @@ -20,7 +20,8 @@ else HYPER_BUS=virtio fi -LOGFILE=/mnt/log +# XXX hack - but where else can we write logs +LOGFILE=/mnt/rootfs/tmp/initrd.log logmsg() { @@ -226,6 +227,8 @@ for oci in $(seq 1 "$MAX_OCI"); do ( fi logmsg "Started $cmd on $MNT in background" ) & + # XXX remove? + sleep 1 done # Start chrony daemon for clock synchronization through PTP_KVM device @@ -267,6 +270,8 @@ run_agetty_loop() logmsg "Executing agetty" run_agetty_loop & +# XXX wait for agetty +sleep 5 cmd=$(cat "$MNT"/cmdline) ug="0 0" @@ -281,10 +286,12 @@ logmsg "Starting on $MNT in foreground" pid_file="/mnt/entrypoint-pid" if grep -q "console=tty0" /proc/cmdline; then + logmsg "Have console=tty0" #shellcheck disable=SC2086 #we have tty0 console primary, so will add output to hvc0 for logging eval /chroot2 "$MNT"/rootfs "${WORKDIR:-/}" $ug $pid_file $cmd 2>&1 | tee -i /dev/hvc0 else + logmsg "Using /dev/console" #shellcheck disable=SC2086 eval /chroot2 "$MNT"/rootfs "${WORKDIR:-/}" $ug $pid_file $cmd <> /dev/console 2>&1 fi