shutdown: Unable to shutdown system from root shell (init=/bin/bash). (ubuntu 14.04)

13,924

Solution 1

First you must activate the magic SysRq option:

echo 1 > /proc/sys/kernel/sysrq

When you are ready to reboot the machine simply run the following:

echo b > /proc/sysrq-trigger

Source.

Solution 2

Any resolutions??

Yes. Don't do that. Don't expect init=/bin/{bash,sh} to give a functional system that you can just use as normal. It doesn't. You have the burden of doing everything by hand that normally a proper system manager program would be doing for you.

Don't expect shutdown, and indeed quite a few other system utilities, to work in the case where you are running a shell as process #1. A shell doesn't do the necessary basic system management tasks required of process #1, and it doesn't speak the necessary protocols expected by commands such as shutdown. In this particular case, the upstart shutdown program (which is what it is) is trying to open a Desktop Bus connection to upstart, in order to tell upstart to shut down the system; but since you never ran upstart in the first place there's no system manager for shutdown to talk to.

You have the burden of doing everything by hand that a system manager would normally do for you in order to shut down the system, including flushing the filesystem cache, unmounting filesystems cleanly, and then enacting the raw final poweroff/halt/reboot action.

For the same reason, don't expect complex "desktop environments" — that depend from things like session inits; running Desktop Bus and "kit" servers; and basic system initialization steps like having all of the filesystems (including the "API" ones) properly mounted, all of the necessary loadable kernel modules loaded, and all of the sysctl/whatever settings set — to work in the case where you just ran a shell and didn't do any of the stuff that a system manager program and system initialization have to do.

Further reading

Share:
13,924

Related videos on Youtube

princethewinner
Author by

princethewinner

Updated on September 18, 2022

Comments

  • princethewinner
    princethewinner over 1 year

    I made some changes in the boot options in grub to directly login into the root shell viz.

    1. Press e at the GRUB2 boot menu.
    2. Change the line ro quite splash $vt_handoff with rw init=/bin/bash
    3. press F10 to boot.

    following above steps I was able to login into root shell successfully and changed the password of root.

    now when I am issuing reboot or poweroff command, I am getting below error:

    shutdown: unable to shutdown system
    

    If I am trying to run startx to go into the GUI the system is hanging every time.

    Any resolutions??

    PS: I didn't face any other issue before on this system in last 3 months since I upgraded to 14.04.

    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy almost 9 years
      Try holding SYSRQ button, and then press one by one r,e,i,s,u,o. Usually this sequence would be r,e,i,s,u,b, where b stands for reboot, but o stands for shutdown (since that's what you've requested). LEt me know if this helps, and i will post this as official answer
  • mvladk
    mvladk over 5 years
    apt-get install systemd-sysv
  • Reinier Post
    Reinier Post about 3 years
    This doesn't answer the question. It does answer a question, one that the user asking the original question already knew the answer to. Why did you write this??
  • Nickolay
    Nickolay over 2 years
    Note that this "Will immediately reboot the system without syncing or unmounting your disks.", i.e. not a proper equivalent to a reboot or shutdown.