Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use Ubuntu 10.10. I abused sudo and accidentally overwrote my /bin/bash file via a typo, so I booted to the LiveCD and restored my copy with a "good" one from the Ubuntu 10.10 LiveOS. This did not fix the problem. Explanation: bash no longer works in gnome-terminal.

  • no longer shows username@computername in prompt, just shows $ sign
  • keyboard shortcuts no longer work- tab, arrow keys, etc. all insert codes now.
  • aliases, also a function of bash, do not work.

Any help on this? Where do I start? I'd rather learn how to fix this instead of just reinstalling the OS. Thanks!

I tried to reinstall bash via Terminal with sudo apt-get -f install bash but I can't even get it to install with the -f (force) parameter. I get this error:

Errors were encountered while processing:
 /var/cache/apt/archives/bash_4.1-2ubuntu4_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1) 

P.S. Once I get aliases working again, I'm aliasing "cp" to "cp -i" and "mv" to "mv -i".

share|improve this question
2  
Open your terminal and type echo $SHELL what it says??Also could you post the output of ls -l ~/.bash* –  karthick87 Dec 12 '10 at 9:30
add comment

5 Answers

Thank you for the tips. I have already fixed it! I'm kinda new here, so I posted this fact as a comment above instead of as a new answer. Sorry!

Here is how I fixed it!:D

  • Booted to the 10.10 live cd
  • mounted my hard drive's linux partition in /mnt/disk
  • did a chroot to /mnt/disk
  • From there, I was able to use apt-get install bash to successfully install it!

:D Thanks. I will check out the commands that you have posted here. Thanks so much again. I hope this post helps people who carelessly delete/overwrite bash like I did. -Slink

P.S. "chroot" is a really cool command. ^_^

share|improve this answer
    
I guess what it really turned out to be is that I couldn't find a "bash" executable that was appropriate for my installation of Ubuntu. shrugs at least I solved it ^_^ –  Slink Dec 14 '10 at 7:15
    
Please note: I could NOT uninstall or install bash from within the running OS in which I was trying to install it. This is either not possible or disallowed beyond the capabilities of root admin. I had to install it from within another running Ubuntu OS (used live cd, not another installation in this case, but it's the same concept.) It seems bash cannot be un/installed unless you do so from another instance of Ubuntu. Must use chroot as described above. –  Slink Dec 14 '10 at 7:23
1  
The command to use is apt-get install --reinstall bash, which re-downloads the archive (if not in the cache) and re-creates all the files installed from the package. –  loevborg Dec 14 '10 at 14:16
    
I tried that. The error posted in the OP occurred. –  Slink Dec 14 '10 at 14:49
    
UPDATE: gnome-terminal and it's dependents uninstall/reinstall just fine after I got bash working. Now I broke Terminal. LoL, always tinkering, I am... –  Slink Dec 17 '10 at 6:15
add comment

I had the same problem, what I found the easiest was to load the ubuntu live cd in " try" mode then open a terminal and gksudo nautilus then copy the bin file from the live cd to my bash dir.

Then reboot and then sudo apt-get install bash to update to the latest version.

share|improve this answer
    
Thanks! Your way is quite simpler than mine, IF it works fine. ;) I learned the hard way to be really careful with that sudo command. –  Slink Feb 15 '11 at 14:15
add comment
  • Type reset in your terminal and press Enter.It's a way to reset the tty driver.

  • If that didn't help you, delete the bash and then re-install it.

Installing BASH:

  • First delete the /bin/bash
  • Install bash Install bash
share|improve this answer
    
That did not work, unfortunately. I just kept getting "bash is already installed" and I cannot uninstall it, as stated above. –  Slink Dec 12 '10 at 10:05
1  
Anyway, I DID IT! :D Booted to the live cd, mounted my linux partition in /mnt/disk, and did a "chroot" to /mnt/disk. From there, I was able to use "apt-get install bash" to successfully install it! :D Thanks. –  Slink Dec 12 '10 at 10:05
    
@Slink Please make your last comment a seperate answer and mark it as the correct one. –  Jorge Castro Dec 12 '10 at 17:29
    
Yeah Slink. I told you this is THE place! –  Habitual Dec 13 '10 at 1:40
add comment

I used Synaptic package manager, set a filter to bash, and set everything that was already installed to re-install. It seems to have solved the problem for me.

share|improve this answer
add comment

If you still have access to a working terminal chsh to /bin/sh or /bin/dash by:

chsh -s /bin/sh

or

chsh -s /bin/dash

then

sudo apt-get install bash

If you do have a working terminal invoking an alternate shell such as dash by just typing in dash may also work

share|improve this answer
add comment

Your Answer

 
discard

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