3

I don't know if "single user mode" is the correct term for that but here I go:

On the GRUB menu, I pressed E to edit the run configurations. To the line that starts with linux, I have appended the following:

rw init=/bin/bash

and pressed F10. The computer boots up to a root shell without asking any password.

The problem is, signals are not working. For example, when I run a command, I cannot exit from that command by pressing Ctrl + C.

Is this expected? If yes, what is the reason for this and how can I fix this? Is it related to the terminal emulator in single user mode?

1

Single user mode has not been the right term for quite some time. In the 1990s, what used to be single user mode split into emergency mode and rescue mode. You are not in fact using either one.

What you are actually doing is a poor idea, because it involves running a program as process #1 that is not designed to do the jobs that process #1 actually needs to do. You would be better off using emergency or rescue modes, the latter of which is invoked by the accepted answer that the answer that you point to, itself points to.

Yes, signals will act oddly. Process #1 has special semantics for signals, for starters, which is one of the several reasons that init=/bin/bash is a poor idea. Furthermore, job control shells cannot do job control when /dev/console is their standard I/O but nothing has set up a proper session with a controlling terminal, as the Bourne Again shell actually told you as soon as it started up.

It is possible with some simple chain-loading tools to set up a proper session with a controlling terminal, and thence enable job control and signal delivery to a foreground process group, but that does not fix all of the other things that will go wrong with /bin/bash as the process #1 program because you have to carefully do them explicitly, by hand.

Just use rescue mode or emergency mode.

Further reading

  • The first link says that both modes provide a secure login. What if I have forgotten the password? In that case, my only option is init=/bin/bash, right? – Utku Dec 12 '17 at 23:22
  • Wrong. You then have the option of Recovery Mode, which is mentioned as another answer beside the one that you point to. – JdeBP Dec 13 '17 at 10:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.