RHEL7: how to strace the reboot phase of leapp
Environment
- Red Hat Enterprise Linux 7
- leapp
Issue
- I need to strace the reboot phase of leapp when upgrading from RHEL7 to RHEL8, because of some error showing up for which the log is not sufficient to find the root cause
Resolution
There are 3 files to modify to record an strace during the reboot phase.
-
Install the strace package
# yum install strace -
Add strace as a required package
Edit
/usr/share/leapp-repository/repositories/system_upgrade/common/actors/commonleappdracutmodules/libraries/modscan.py (new line)to add new line 42:42 'strace',Note above the trailing comma.
-
Add strace as a requisite in the upgrade initramfs
Edit
/usr/share/leapp-repository/repositories/system_upgrade/common/actors/initramfs/upgradeinitramfsgenerator/files/generate-initram.shto add new lines 87 and 88:87 DRACUT_INSTALL="$DRACUT_INSTALL strace" 88 -
Update the
leapp upgradecommand to execute under straceEdit
/usr/share/leapp-repository/repositories/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.shto modify line 239:239 /usr/bin/systemd-nspawn $NSPAWN_OPTS -D "$NEWROOT" /usr/bin/bash -c "mount -a; /usr/bin/strace -fttTvyy -s 256 -o /var/lib/leapp/leapp_reboot.strace -- $LEAPPBIN upgrade --resume $args"Important note: the strace output is stored as
/var/lib/leapp/leapp_reboot.straceas in the example above. You may change this path, just make sure there is several Gigabytes of free space on the chosen mount point, because the strace output may be extremely large, depending on when the leapp reboot phase fails. -
Re-execute
leapp upgradeto regenerate the upgrade initramfs# leapp upgrade [...] -
Confirm that strace is now embedded in the upgrade initramfs
# lsinitrd /boot/initramfs-upgrade.x86_64.img | grep strace Arguments: -v -v -v -v --force --conf '/dev/null' --confdir '/var/empty' --install 'systemd-nspawn strace' --add 'sys-upgrade-redhat' --add 'sys-upgrade' --add 'sys-upgrade-redhat' --add 'sys-upgrade' --nomdadmconf --nolvmconf --no-hostonly --kver '4.18.0-553.53.1.el8_10.x86_64' --kernel-image 'vmlinuz-upgrade.x86_64' -rwxr-xr-x 1 root root 2066344 Jan 15 2024 usr/bin/strace
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.