View previous topic :: View next topic |
Author |
Message |
lesha_n n00b
Joined: 15 Nov 2007 Posts: 65
|
Posted: Thu Sep 23, 2010 5:34 am Post subject: Help!! ... Accidentally deleted /bin |
|
|
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 |
|
|
Exil Apprentice
Joined: 10 Oct 2005 Posts: 251 Location: Nibylandia
|
Posted: Thu Sep 23, 2010 7:25 am Post subject: |
|
|
Download latest stage3, unpack it to temp directory. Copy bin to /bin
emerge -e world
done |
|
Back to top |
|
|
lesha_n n00b
Joined: 15 Nov 2007 Posts: 65
|
Posted: Fri Sep 24, 2010 5:13 am Post subject: |
|
|
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 |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Fri Sep 24, 2010 11:59 am Post subject: |
|
|
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 |
|
|
lesha_n n00b
Joined: 15 Nov 2007 Posts: 65
|
Posted: Fri Sep 24, 2010 2:58 pm Post subject: |
|
|
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 |
|
|
lesha_n n00b
Joined: 15 Nov 2007 Posts: 65
|
Posted: Tue Oct 05, 2010 11:19 pm Post subject: [solved] |
|
|
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 |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1931
|
Posted: Tue Oct 05, 2010 11:39 pm Post subject: |
|
|
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 |
|
|
|