Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help!! ... Accidentally deleted /bin
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64
View previous topic :: View next topic  
Author Message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 65

PostPosted: Thu Sep 23, 2010 5:34 am    Post subject: Help!! ... Accidentally deleted /bin Reply with quote

Dear Gentoo users,

My apologies if this is a wrong forum for this general question - I could not find a more appropriate one (and my system is amd64).

I accidentally deleted my /bin directory (was removing my old fedora core 7 partitions and mistyped "rm -r /bin" instead of "rm -r bin" (while in /fc7). I know, incredibly stupid and careless...

Now I am without the basic commands such as ls, mv, mkdir and the like and not sure how to go about restoring them. Emerge, of course, would not work without bash (and probably a handful of other basic commands).

Does anyone have any idea how to go about restoring my /bin? Needless to say, I am in a bind and would appreciate any help in bringing my system back!

The system is fairly up-to-date, with "emerge --deep --update" world having been run only about a week ago. I know my partition layout, of course (I use LVM2 if it matters, but not for the / directory).

Is my only resort to boot from a live gentoo CD (I have LiveCD 2007.0 but could burn an up-to-date copy)? And then what?

Thank you,
Aleksey
Back to top
View user's profile Send private message
Exil
Apprentice
Apprentice


Joined: 10 Oct 2005
Posts: 251
Location: Nibylandia

PostPosted: Thu Sep 23, 2010 7:25 am    Post subject: Reply with quote

Download latest stage3, unpack it to temp directory. Copy bin to /bin
emerge -e world

done
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 65

PostPosted: Fri Sep 24, 2010 5:13 am    Post subject: Reply with quote

Exil,

Thank you, it worked -- I managed to copy everything from the latest stage3 bin/ into my /bin. Had to boot from Gentoo LiveDVD to do that, since commands like "cp", "mv" were gone once my original /bin was deleted.

I am back in my system logged as myself, using KDE as usual. One problem: I cannot change to the superuser account anymore with the usual "su -" in the terminal - I get authentication failure. Was my root password reset somehow? How can I get back into my root account?

Thank you
Aleksey

Exil wrote:
Download latest stage3, unpack it to temp directory. Copy bin to /bin
emerge -e world

done
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Fri Sep 24, 2010 11:59 am    Post subject: Reply with quote

you probably didn't copy the files correctly

try again with cp -a

oh, also if you're extracting this from a tarball, you also need to extract it correctly with p

(see the gentoo handbook how the stage is to be extracted)

Otherwise your files will lose special properties like suid bit, ownership etc.

Alternatively, emerge -e system and/or emerge -e world should fix this as well.
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 65

PostPosted: Fri Sep 24, 2010 2:58 pm    Post subject: Reply with quote

Oh, thank you, I did leave out -p with tar and did not use -a with cp. I'll try it again with the correct flags.

In case this does not work, how would I go about running emerge -e system? Would this be the correct sequence of steps (I am looking at the gentoo installation handbook, Ch. 6 (Installing the Gentoo Base System), trying to factor out only the steps I'd need):


  • Boot into LiveDVD
  • Mount my system partitions (I have separate /, /usr, /var, /tmp) at respective mount points in /mnt/gentoo
  • Would I need to mount proc and dev (code listing 1.4)?
  • chroot into /mnt/gentoo (my existing system)
  • end-update
  • source /etc/profile
  • emerge -e system (or emerge -e world)


Is this correct?

Thank you!
Back to top
View user's profile Send private message
lesha_n
n00b
n00b


Joined: 15 Nov 2007
Posts: 65

PostPosted: Tue Oct 05, 2010 11:19 pm    Post subject: [solved] Reply with quote

Thank you all for your help,

In the end I booted up from LiveDVD and used cp - to copy /bin files from the latest stage3 tar - it worked. Thank you!

Aleksey
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Tue Oct 05, 2010 11:39 pm    Post subject: Reply with quote

I would also suggest to re-emerge all packages that were in /bin to ensure that you don't have version mismatches, as well as to recover those that may not be in the stage tarball.

You can do it like this:
Code:
# emerge -av $( equery b /bin | sed s/^/=/ )
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64 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