From 64c34b53ab83058d270f95b94a1767e863eab2f2 Mon Sep 17 00:00:00 2001 From: Petr Stodulka Date: Fri, 5 Jan 2024 12:01:02 +0100 Subject: [PATCH] dracut modules: add breakpoints with more consistent names I've already realized I missed couple of breakpoints over time inside the initramfs and cannot remember expected cmdline params for each of them. So let's try to make it more consistent. Keeping the original cmdline arguments as some people are used to them already, but introducing new ones. New introduced breakpoints: * rd.upgrade.break=leapp-initram * breaks right after getting to leapp dracut modules * orig * rd.break=upgrade * rd.upgrade.break=upgrade * rd.upgrade.break=leapp-pre-upgrade * breaks just right before running leapp in initramfs * rd.upgrade.break=leapp-post-upgrade * running just right after leapp upgrade (dnf transaction done), before the start of post-upgrade phases * orig: * rd.break=leapp-upgrade * rd.upgrade.break=leapp-upgrade * rd.upgrade.break=leapp-finish * the last breakpoint, after logs are saved, before the upcoming reboot (leaving the upgrade environment) * orig: * rd.break=leapp-logs Note: we could possibly drop old ones already, but as this is going to be one of last changes for IPU 7 -> 8, I decided to leave such a decision for future. Also, it's possible that we will need to redesign this part of the upgrade process, so that's another reason why to just add something, but do not drop anything. --- .../dracut/85sys-upgrade-redhat/do-upgrade.sh | 18 +++++++++++++----- .../files/dracut/90sys-upgrade/upgrade.sh | 5 +++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh b/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh index 95be87b52e..4a6f7b62ea 100755 --- a/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh +++ b/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh @@ -227,6 +227,11 @@ do_upgrade() { getargbool 0 enforcing || echo 0 > /sys/fs/selinux/enforce fi + # NOTE: For debugging purposis. It's possible it will be changed in future. + getarg 'rd.upgrade.break=leapp-pre-upgrade' && { + emergency_shell -n upgrade "Break right before running leapp in initramfs" + } + # and off we go... # NOTE: in case we would need to run leapp before pivot, we would need to # specify where the root is, e.g. --root=/sysroot @@ -237,9 +242,10 @@ do_upgrade() { # NOTE: flush the cached content to disk to ensure everything is written sync - #FIXME: for debugging purposes; this will be removed or redefined in future - getarg 'rd.upgrade.break=leapp-upgrade' 'rd.break=leapp-upgrade' && \ - emergency_shell -n upgrade "Break after LEAPP upgrade stop" + # NOTE: For debugging purposes. It's possible it will be changed in future. + getarg 'rd.upgrade.break=leapp-post-upgrade' 'rd.upgrade.break=leapp-upgrade' 'rd.break=leapp-upgrade' && { + emergency_shell -n upgrade "Break right after LEAPP upgrade, before post-upgrade leapp run" + } if [ "$rv" -eq 0 ]; then # run leapp to proceed phases after the upgrade with Python3 @@ -370,8 +376,10 @@ result=$? ##### safe the data and remount $NEWROOT as it was previously mounted ##### save_journal -#FIXME: for debugging purposes; this will be removed or redefined in future -getarg 'rd.break=leapp-logs' && emergency_shell -n upgrade "Break after LEAPP save_journal" +# NOTE: For debugging purposis. It's possible it will be changed in future. +getarg 'rd.break=leapp-logs' 'rd.upgrade.break=leapp-finish' && { + emergency_shell -n upgrade "Break after LEAPP save_journal (upgrade initramfs end)" +} # NOTE: flush the cached content to disk to ensure everything is written sync diff --git a/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/90sys-upgrade/upgrade.sh b/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/90sys-upgrade/upgrade.sh index b88784ae73..7f5c892241 100755 --- a/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/90sys-upgrade/upgrade.sh +++ b/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/90sys-upgrade/upgrade.sh @@ -11,8 +11,9 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh source_conf /etc/conf.d -getarg 'rd.upgrade.break=upgrade' 'rd.break=upgrade' && \ - emergency_shell -n upgrade "Break before upgrade" +# NOTE: For debugging purposis. It's possible it will be changed in future. +getarg 'rd.upgrade.break=upgrade' 'rd.break=upgrade' 'rd.upgrade.break=leapp-initram' && \ + emergency_shell -n upgrade "Break right after getting to leapp dracut modules" setstate() { export UPGRADE_STATE="$*"