0

inside /init bash script executed by the kernel in initramfs.img i need to send a signal to drop me to a rescue shell, so i have

trap "exec /bin/bash" SIGINT

but ctrl+C isn't effective.

First why the trap isn't working in initramfs stage? Is there otherway to achieve the same objective, to drop the user inside resuce shell during execution?

  • /init is usually not bash but busybox and you can check the busybox faq on the ctrl-c issue (won't help here though... rescue shell has to be deliberate, I guess) – frostschutz Apr 6 at 1:08
  • no, it's bash i wrote it with my fingers. – Error Apr 6 at 1:10
  • The trap command won't fire while your shell is executing another command. It only fires between commands. – roaima Apr 6 at 7:49
  • You might be better just starting a shell on a different TTY regardless. Kill it as you leave the initram process so it doesn't Heng around forever. – roaima Apr 6 at 7:51
  • @roaima that is not true! – Error Apr 6 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.