Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is /bin/bash important? [ solved ;) ]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 4:15 am    Post subject: Is /bin/bash important? [ solved ;) ] Reply with quote

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
Back to top
View user's profile Send private message
hanj
Veteran
Veteran


Joined: 19 Aug 2003
Posts: 1418

PostPosted: Thu Apr 07, 2005 4:25 am    Post subject: Reply with quote

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..

Code:
cp /bin/bash /tmp/myfw


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

Then:
Code:
emerge -v bash


This will get your bash back.
HTH
hanji
Back to top
View user's profile Send private message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 4:30 am    Post subject: thanks Reply with quote

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?
Back to top
View user's profile Send private message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 4:32 am    Post subject: Reply with quote

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

Thanks for you help man.
Back to top
View user's profile Send private message
hanj
Veteran
Veteran


Joined: 19 Aug 2003
Posts: 1418

PostPosted: Thu Apr 07, 2005 4:41 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 4:46 am    Post subject: hm Reply with quote

is there any temporary bash file that I can copy to re-emerge bash?
Back to top
View user's profile Send private message
steve_d555
Guru
Guru


Joined: 07 Nov 2004
Posts: 458
Location: Belmont, Massachusetts

PostPosted: Thu Apr 07, 2005 4:46 am    Post subject: Reply with quote

Are there any other shells on your comp i.e. zsh, csh, or something else? Cause you can use those to re-emerge bash.
_________________
rubyforums | blog | boxwhore
Back to top
View user's profile Send private message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 4:49 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
steve_d555
Guru
Guru


Joined: 07 Nov 2004
Posts: 458
Location: Belmont, Massachusetts

PostPosted: Thu Apr 07, 2005 5:11 am    Post subject: Reply with quote

You can try downloading a stage tarball and copying over the bash binary from it, use wget.
_________________
rubyforums | blog | boxwhore
Back to top
View user's profile Send private message
Zepp
Veteran
Veteran


Joined: 15 Mar 2004
Posts: 1246
Location: Ontario, Canada

PostPosted: Thu Apr 07, 2005 5:30 am    Post subject: Reply with quote

What about /bin/sh? Can you not use that....
Back to top
View user's profile Send private message
steve_d555
Guru
Guru


Joined: 07 Nov 2004
Posts: 458
Location: Belmont, Massachusetts

PostPosted: Thu Apr 07, 2005 5:37 am    Post subject: Reply with quote

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
_________________
rubyforums | blog | boxwhore
Back to top
View user's profile Send private message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 5:57 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
steve_d555
Guru
Guru


Joined: 07 Nov 2004
Posts: 458
Location: Belmont, Massachusetts

PostPosted: Thu Apr 07, 2005 6:04 am    Post subject: Reply with quote

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.
_________________
rubyforums | blog | boxwhore
Back to top
View user's profile Send private message
Given M. Sur
l33t
l33t


Joined: 03 Feb 2004
Posts: 648
Location: No such file or directory

PostPosted: Thu Apr 07, 2005 6:27 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
odioworks_com
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2005
Posts: 82
Location: Charlottesville, Virginia

PostPosted: Thu Apr 07, 2005 10:38 am    Post subject: great! Reply with quote

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!
Back to top
View user's profile Send private message
steve_d555
Guru
Guru


Joined: 07 Nov 2004
Posts: 458
Location: Belmont, Massachusetts

PostPosted: Thu Apr 07, 2005 11:38 am    Post subject: Reply with quote

No Problem, Glad you got it.
_________________
rubyforums | blog | boxwhore
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum