Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have searched a lot,only to found that many people came across this problem. By adding rw init=/bin/bash to the end of the vmlinuz line,I can enter the single-user mode of UBUNTU 10.04 LTS but,when I type shutdown or reboot,it just said it can't do that. Then I run "/sbin/init 0" and it said it can't connect to sock of upstart.

My guess is ,because we replace /sbin/init with /bin/bash and there is no init(nor upstart) thus shutdown can't be done.

I notice that some guy said by enter exit and I should go into next phase of normal boot.I tried that, and the ubuntu system in my VMWare became stuck,and behave weird,at least in the sense of the CAPLOCK light which kept flashing..(CPU occupation scored too)

Any intruction is appreciated,thanks all in advance~

====UPDATED===== I tried single instead of init=/usr/bash but it went straight into multi-user mode.

share|improve this question

migrated from stackoverflow.com Dec 27 '11 at 21:33

This question came from our site for professional and enthusiast programmers.

    
Exiting from the init process is a kernel panic, hence the flashing lights. –  Kerrek SB Dec 27 '11 at 15:03
add comment

1 Answer 1

When you have no init or other processes beside your shell, there is almost nothing to shutdown. In fact, the only important thing is the filesystem – sync it, then unmount all on-disk filesystems or remount as read-only (if they cannot be unmounted, for example, the rootfs):

sync
umount /home
mount -o remount,ro /

After this, you might as well pull the plug.


Another thing you could try (but I haven't) is to start the original init. Make sure no processes aside from your pid1 shell are running, then change to root directory and exec init:

cd /
sync
exec /sbin/init

exec replaces the current process with the one given, so started this way /sbin/init will take the special pid 1 from your shell.

However, if pid 1 ever exits, the kernel will immediately panic – so make sure you at least sync the filesystems before doing this.

When the kernel panics, it prints out a message, starts flashing the keyboard LEDs, and stops everything else – it stops even the loop that normally tells the CPU to remain idle; this probably is what causes the Caps Lock madness and the high CPU use by your virtual machine.

Your "some guy" was right – in real single-user mode, typing exit will usually switch to multi-user or at least clean-reboot. However, init=/bin/bash does not start this mode; it does not start anything at all, besides the kernel and the bash shell. To reach the real single-user mode, you would need to add single to the kernel command line. (Sometimes 1 or s works, but not all distributions use runlevels.) In Ubuntu, this used to be called "Recovery mode".

share|improve this answer
    
yeah!you script of exec /sbin/init did work! I run these command on a physical machine.It switched to multi-user mode as you said.But strangely, when I ran "reboot" or "halt" in the real physical machine,it did not complaint about upstart thing. The real physical machine is a ubuntu10.04LTS AMD64 box. And here I should make a correction that,the machine I mention in the question above is not UBUNTU10.04LTS is a Ubuntu11.04. –  allan ruin Dec 28 '11 at 16:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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