# Is /bin/bash important? [ solved ;) ]

## odioworks_com

Ok, so I'm not sure where to post this.  My apologies if this is the wrong area.

I've been messing around with this article trying to get myself a firewall:

https://forums.gentoo.org/viewtopic.php?t=159133&highlight=iptables+howto

And I excuted this command (as root...):

# mv myfw /bin/bash

HMM. Seems whatever was in bash (assumed it was a directory, now I have learned it is a file) no longer is there.

So my question is...

Is this bad?Last edited by odioworks_com on Thu Apr 07, 2005 10:39 am; edited 1 time in total

----------

## hanj

Hello

Bummer

I would say that is 'bad'. This is a shell. Do you still have your current shell running? If so...you should make a backup of your firewall.. since it's bash now..

```
cp /bin/bash /tmp/myfw
```

This will mov /bin/bash to /tmp and rename it back to myfw

Then:

```
emerge -v bash
```

This will get your bash back.

HTH

hanji

----------

## odioworks_com

when I try to re-emerge bash by:

emerge -v bash

seems to exit in error. Last line in output:

[Errno 8] Exec format error:

/bin/bash [bash-2.05b-r9] bash -c /usr/lib/portage/bin/ebuild.sh clean

Not sure if my bash is back... any ideas?

----------

## odioworks_com

when I do vim /bin/bash I still get the firewall script... ouf

Thanks for you help man.

----------

## hanj

The problem.. is that 'bash' is needed to emerge 'bash'. Your emerge failed. 

I'm not sure of an easy way to fix this. Do you have another gentoo box that can access this box? If so.. you might want to try scp'ing bash's binary to this server.. and move it into /bin. Another option is to boot into the LiveCD and replace it from there.

HTH

hanji

----------

## odioworks_com

is there any temporary bash file that I can copy to re-emerge bash?

----------

## steve_d555

Are there any other shells on your comp i.e. zsh, csh, or something else? Cause you can use those to re-emerge bash.

----------

## odioworks_com

not that I know of... I guess I could use knoppix but I'm afraid to close this shell and I have no idea how to emerge something from knoppix...

any ideas?

----------

## steve_d555

You can try downloading a stage tarball and copying over the bash binary from it, use wget.

----------

## Zepp

What about /bin/sh? Can you not use that....

----------

## steve_d555

Ya, Im pretty sure you can use it, I'm not in Gentoo, so I cant be sure, but you can try running it from your open shell then emerging bash. Secondly, the console is bash right, like if you exit Xorg, is that bash too?

EDIT: Try /bin/sh exec emerge bash

----------

## odioworks_com

funny.. I guess when I overwrote my bash file w/ the firewall script it also overwrote the /bin/sh file - since when I vim /bin/sh I get the same firewall script...

Does anyone want to email me their bash file? would that work? you can send it to my email address:

 s a m A-T o d i o w o r k s D-O-T c o m.

----------

## steve_d555

Ya, I think sh might be a symlink. Not sure. Can't really email you the binary, which arch? Probably x86 right? Can you still compile, like could you go into your /usr/portage/distfiles untar the bash file and try to manually install it? Commands are:

./configure

make

make install

This will get you the binary then you can re-emerge bash.

----------

## Given M. Sur

sh is a symlink.

And you won't be able to chroot into your environment without a shell, so your best bet is to boot the livecd or knoppix, mount your / partition, and "cp /bin/bash /your-mounted-root-partition/bin"

Then reboot without the cd and emerge bash.

----------

## odioworks_com

great - I was able to download a stage3 package using wget, untar it & copy over the bash file - and then run emerge -v bash.

Thanks everyone for their help!

----------

## steve_d555

No Problem, Glad you got it.

----------

