From ffe825113e23ecff57e872973faa9f12a5cc2fb9 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Wed, 8 Apr 2015 12:54:32 -0500 Subject: [PATCH] Make troubleshoot work with dracut ramdisks Currently, calling the troubleshoot function in a ramdisk script doesn't work as expected on dracut ramdisks. This adds an alternate troubleshoot implementation that will behave as intended. I did not make it conditional on a kernel param as was done in the original because dracut can behave strangely if you allow it to continue after an error. Always dropping to a shell immediately should be less confusing. Change-Id: I98000f4ac6d7890b1f44fe4d10394ac0ea332fcb --- .../extra-data.d/scripts/module/deploy-cmdline.sh | 2 -- elements/dracut-ramdisk/init.d/00-override-troubleshoot | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 elements/dracut-ramdisk/init.d/00-override-troubleshoot diff --git a/elements/dracut-ramdisk/extra-data.d/scripts/module/deploy-cmdline.sh b/elements/dracut-ramdisk/extra-data.d/scripts/module/deploy-cmdline.sh index fe3f9c4a2..6582fe169 100755 --- a/elements/dracut-ramdisk/extra-data.d/scripts/module/deploy-cmdline.sh +++ b/elements/dracut-ramdisk/extra-data.d/scripts/module/deploy-cmdline.sh @@ -11,8 +11,6 @@ rootok=1 # Dracut doesn't correctly parse the ip argument passed to us. # Override /proc/cmdline to rewrite it in a way dracut can grok. sed 's/\(ip=\S\+\)/\1:::off/' /proc/cmdline > /run/cmdline -# Map the existing "troubleshoot" kernel param to the Dracut equivalent. -sed -i 's/troubleshoot=/rd.shell=/' /run/cmdline mount -n --bind -o ro /run/cmdline /proc/cmdline # Force Dracut to re-read the cmdline args CMDLINE= diff --git a/elements/dracut-ramdisk/init.d/00-override-troubleshoot b/elements/dracut-ramdisk/init.d/00-override-troubleshoot new file mode 100644 index 000000000..5a8c5a95f --- /dev/null +++ b/elements/dracut-ramdisk/init.d/00-override-troubleshoot @@ -0,0 +1,7 @@ +# NOTE(bnemec): Dracut provides its own emergency shell, and it doesn't +# seem to allow directly starting bash as the existing troubleshoot function +# does. +function troubleshoot() { + echo "Starting troubleshooting shell." + emergency_shell +}