From 51242c2dfda12c1f7633178432636e98cf337de0 Mon Sep 17 00:00:00 2001 From: Yuriy Kohut Date: Fri, 28 Aug 2026 19:21:50 +0300 Subject: [PATCH] Update AlmaLinux ELevate and Vendors patch: Drop inherited rd.lvm.lv args from the upgrade boot entry With rd.lvm.lv=/ inherited via `grubby --copy-default`, dracut's lvm_scan activates only the listed LVs (root/swap) in the upgrade initramfs, so LVs backing /var, /home, etc. stay inactive and the upgrade drops into the emergency shell. Remove the args from the ELevate-Upgrade-Initramfs entry (fork commit 32df2fe2). The package version 0.24.0-1.elevate.5 --- SOURCES/leapp-repository-0.24.0-elevate.patch | 74 ++++++++++++++++++- SPECS/leapp-repository.spec | 5 +- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/SOURCES/leapp-repository-0.24.0-elevate.patch b/SOURCES/leapp-repository-0.24.0-elevate.patch index be13f7a..0e34c79 100644 --- a/SOURCES/leapp-repository-0.24.0-elevate.patch +++ b/SOURCES/leapp-repository-0.24.0-elevate.patch @@ -3500,10 +3500,31 @@ index 00000000..c6694a8e +### Useful for packages that have identical version strings but contain binary changes between major OS versions +### Packages that aren't installed will be skipped diff --git a/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py b/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py -index b28ec57c..6882488a 100644 +index b28ec57c..9fac0c3f 100644 --- a/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py +++ b/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py -@@ -91,7 +91,7 @@ def figure_out_commands_needed_to_add_entry(kernel_path, initramfs_path, args_to +@@ -48,7 +48,19 @@ def collect_undesired_args(livemode_enabled): + args = {} + if livemode_enabled: + args = dict(zip(('ro', 'rhgb', 'quiet'), itertools.repeat(None))) +- args['rd.lvm.lv'] = _get_rdlvm_arg_values() ++ ++ # ELevate: rd.lvm.lv=/ args inherited from the default entry via ++ # `grubby --copy-default` make dracut's lvm_scan activate *only* the listed ++ # LVs (typically root and swap) and skip the `vgchange -ay` of whole VGs. ++ # On a regular boot the remaining LVs are activated later by the real root ++ # system, but the upgrade initramfs never switches root - it mounts all ++ # fstab entries under /sysroot inside the initramfs. LVs backing e.g. /var, ++ # /home or /srv thus stay inactive, sysroot-*.mount units time out and the ++ # system drops into the emergency shell. Drop the args so that lvm_scan ++ # activates all volume groups (upstream does the same for the live mode). ++ rd_lvm_values = _get_rdlvm_arg_values(required=livemode_enabled) ++ if rd_lvm_values: ++ args['rd.lvm.lv'] = rd_lvm_values + + return set(args.items()) + +@@ -91,7 +103,7 @@ def figure_out_commands_needed_to_add_entry(kernel_path, initramfs_path, args_to '/usr/sbin/grubby', '--add-kernel', '{0}'.format(kernel_path), '--initrd', '{0}'.format(initramfs_path), @@ -3512,8 +3533,33 @@ index b28ec57c..6882488a 100644 '--copy-default', '--make-default', '--args', args_to_add_str +@@ -296,16 +308,20 @@ def _get_device_uuid(path): + return None + + +-def _get_rdlvm_arg_values(): ++def _get_rdlvm_arg_values(required=True): + # should we not check args returned by grubby instead? + cmdline_msg = next(api.consume(KernelCmdline), None) + + if not cmdline_msg: +- raise StopActorExecutionError('Did not receive any KernelCmdline arguments.') ++ if required: ++ raise StopActorExecutionError('Did not receive any KernelCmdline arguments.') ++ api.current_logger().debug('No KernelCmdline message received; no rd.lvm.lv args to drop.') ++ return tuple() + + rd_lvm_values = sorted(arg.value for arg in cmdline_msg.parameters if arg.key == 'rd.lvm.lv') +- api.current_logger().debug('Collected the following rd.lvm.lv args that are undesired for the squashfs: %s', +- rd_lvm_values) ++ api.current_logger().debug( ++ 'Collected the following rd.lvm.lv args that are undesired for the upgrade boot entry: %s', rd_lvm_values ++ ) + + return tuple(rd_lvm_values) + diff --git a/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py b/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py -index 7341602b..b2ced8ae 100644 +index 7341602b..cb6b2775 100644 --- a/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py +++ b/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py @@ -53,7 +53,7 @@ run_args_add = [ @@ -3525,6 +3571,28 @@ index 7341602b..b2ced8ae 100644 '--copy-default', '--make-default', '--args', +@@ -387,3 +387,21 @@ def test_modify_grubenv_to_have_separate_blsdir(monkeypatch, has_separate_boot): + monkeypatch.setattr(addupgradebootentry, 'run', run_mocked) + + addupgradebootentry.modify_our_grubenv_to_have_separate_blsdir(efi_info) ++ ++ ++def test_collect_undesired_args_drops_rd_lvm_lv(monkeypatch): ++ """rd.lvm.lv args from the booted cmdline are removed from the upgrade entry even outside live mode.""" ++ msgs = [ ++ KernelCmdline(parameters=[ ++ KernelCmdlineArg(key='rd.lvm.lv', value='vg00/lv_root'), ++ KernelCmdlineArg(key='rd.md.uuid', value='aaaa:bbbb'), ++ KernelCmdlineArg(key='rd.lvm.lv', value='vg00/lv_swap'), ++ ]), ++ ] ++ monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(msgs=msgs)) ++ ++ undesired = addupgradebootentry.collect_undesired_args(livemode_enabled=False) ++ ++ assert undesired == {('rd.lvm.lv', ('vg00/lv_root', 'vg00/lv_swap'))} ++ assert 'rd.lvm.lv=vg00/lv_root rd.lvm.lv=vg00/lv_swap' == \ ++ addupgradebootentry.format_grubby_args_from_args_set(undesired) diff --git a/repos/system_upgrade/common/actors/checkenabledvendorrepos/actor.py b/repos/system_upgrade/common/actors/checkenabledvendorrepos/actor.py new file mode 100644 index 00000000..52f5af9d diff --git a/SPECS/leapp-repository.spec b/SPECS/leapp-repository.spec index 9f29094..4d3f199 100644 --- a/SPECS/leapp-repository.spec +++ b/SPECS/leapp-repository.spec @@ -53,7 +53,7 @@ py2_byte_compile "%1" "%2"} Epoch: 1 Name: leapp-repository Version: 0.24.0 -Release: 1%{?dist}.elevate.4 +Release: 1%{?dist}.elevate.5 Summary: Repositories for leapp License: ASL 2.0 @@ -350,6 +350,9 @@ fi %changelog +* Fri Aug 28 2026 Yuriy Kohut - 0.24.0-1.elevate.5 +- Drop inherited rd.lvm.lv args from the upgrade boot entry so that all LVs get activated in the upgrade initramfs + * Tue Mar 10 2026 Yuriy Kohut - 0.24.0-1.elevate.4 - ELevate vendors support for upstream 0.24.0-1 version (34aeae1e023e61345a1bb020b42231a79a0be4a8) - Update upgrade path for almalinux: 9.8 -> 10.2