diff --git a/factory/usr/lib/systemd/system-generators/journald-console b/factory/usr/lib/systemd/system-generators/journald-console index 9602f549..a055cba1 100755 --- a/factory/usr/lib/systemd/system-generators/journald-console +++ b/factory/usr/lib/systemd/system-generators/journald-console @@ -1,6 +1,10 @@ #!/bin/sh -if ! grep -q 'snapd_recovery_mode=install' /proc/cmdline -then + +mode="$(/usr/libexec/core/get-mode mode)" || mode="$(/usr/libexec/core/get-arg snapd_recovery_mode)" || mode="run" + +if [ "${mode}" = "run" ]; then + # remove any previous overrides + rm -rf /run/systemd/journald.conf.d/core-override.conf exit 0 fi diff --git a/factory/usr/lib/the-modeenv b/factory/usr/lib/the-modeenv index 84bdbc8d..19c878ef 100755 --- a/factory/usr/lib/the-modeenv +++ b/factory/usr/lib/the-modeenv @@ -19,6 +19,13 @@ if [ "${mode}" = "run" ]; then elif [ -f /run/mnt/ubuntu-boot/uboot/ubuntu/boot.sel ]; then echo '/run/mnt/ubuntu-boot/uboot/ubuntu /boot/uboot none bind 0 0' >> /run/image.fstab fi + # if there is override for journald.conf, remove it, it has ForwardToConsole=true + # also modify generator, as current mode is now new run mode + if [ -f /run/systemd/journald.conf.d/core-override.conf ]; then + rm /run/systemd/journald.conf.d/core-override.conf + cmdline_mode="$(/usr/libexec/core/get-arg snapd_recovery_mode) + sed -i 's/snapd_recovery_mode=run/snapd_recovery_mode='"${cmdline_mode}"'/g' /usr/lib/systemd/system-generators/journald-console + fi fi mount -o bind /run/image.fstab /sysroot/etc/fstab umount -lf /sysroot/run