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 am working on Ubuntu 11.1. The symlink /bin/sh pointed to dash in my system. /bin/bash pointed to sh. I accidentally changed /bin/sh to point to /bin/bash. Now, I can't open the terminal. How can I recover from this mess?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

At the console:

  1. Press CTRL-ALT-1 to open a pseudo terminal
  2. Login as the root user (hopefully the root shell still works)
  3. Fix the symbolic link.
  4. You could either return to the console screen but it is dependent on the number of pseudo terminals you have configured, try CTRL-ALT-9 .... or you can simply reboot
share|improve this answer
    
I restarted my computer and now it won't start the OS (even in recovery mode) –  Bruce Jan 10 '13 at 6:51
    
Then what you should do is boot a Linux Recovery CD to the root shell, mount the root partition, and then change the symbolic link and then reboot to your hard disk. –  mdpc Jan 10 '13 at 6:52
1  
@Bruce try adding init=/bin/sh to the kernel command line. Then you'll have to mount the root filesystem to fix the link. –  Aluísio A. S. G. Jan 10 '13 at 6:57
    
@AluísioA.S.G.: How do I do get access the kernel command line? –  Bruce Jan 10 '13 at 7:02
    
@Bruce On the boot menu, select the Ubuntu entry and type e. On the screen that appears, there must be a line starting with linux. Just append init=/bin/sh to that line and then press F10. –  Aluísio A. S. G. Jan 10 '13 at 7:07
show 1 more 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.