1

I am facing a problem with my terminal (Ubuntu 12.04 LTS) . I was making some changes in the /bin/bash , but I have kept a backup of bash.rc in case of something went wrong. Anyway today I have tried to open my Terminal and the following message appeared:

There was an error creating the child process for this terminal Failed to execute child process "/bin/bash" (Too many levels of symbolic links)

I noticed that my /bin/bash file is a script that I copied by mistake.

So... my edited question is : How can I restore my /bin/bash file?

2
  • My guess is you'll have to re-install bash, but what is the output of ls -l /bin/bash*? Also this is probably better asked over at Unix&Linux StackExchange.
    – sbtkd85
    May 6, 2014 at 19:36
  • 3
    Whatever you were doing when you clobbered /bin/bash, you shouldn't have been doing it -- and you certainly shouldn't have been doing it with root privileges. May 6, 2014 at 22:03

4 Answers 4

1

This question has already been answered at ask ubuntu. Here are the steps he took to answer:

  1. Booted to the 10.10 live cd
  2. mounted hard drive's linux partition in /mnt/disk
  3. did a chroot to /mnt/disk
  4. From there, use apt-get install bash and then install

Or, if you are able to get into the system using another shell, you could also just try using:

apt-get install bash
3
  • I think that every shell needs the bash file
    – Ane
    May 6, 2014 at 19:49
  • @Ane There are other shells such as zsh, though probably you would have to install them. "Shell" and "terminal" do not mean the same thing (the terminal is just for input and display; the shell is what actually runs the commands), and typically you can use different shells with the same terminal.
    – duplode
    May 6, 2014 at 20:08
  • I tried to boot from my Hiren's usb and to copy a bash file from a friend that does not use ubuntu... :-/ Now the terminal opens and closes instantly :-/
    – Ane
    May 6, 2014 at 20:15
0

Several possible solutions:

  • restore from backup.

  • aptitude reinstall bash. If this fails because some pre o post install script requires bash itself, you can try to wget the deb package and extract the binary directly.

  • if neither of these works, you can still download the package in another machine, regardless the OS, and extract it there, then transfer it.

  • copy a bash binary from another ubuntu host.

1
  • Thank you. Now I am trying to boot from a usb my ubuntu in order to fix it.
    – Ane
    May 6, 2014 at 19:48
0

If you can't get to a shell, mabey you will have better luck with the software-center. You might want to just search for bash in the software-center, remove it, then install it.

-1

Choose try Ubuntu using live USB. Then mount the partition in which Linux is installed. Chroot into it. Copy the whatever files you want to from the live USB to the partition.

I did this thing, and got my root back again.

1
  • This doesn't really add anything to the first two answers — the OP mentions booting from a USB (in a comment), nic mentions mounting the OS partition and chroot'ing to it, and dawud mentions restoring from a backup and/or copying from another Ubuntu system.  Furthermore, chroot is not appropriate in your scenario; if you chroot to the hard disk, you lose access to the USB and can't copy files from it.  Just cd, or simply cp /bin/bash /mnt/disk/bin/bash (from the USB to the HDD). Oct 29, 2015 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .