Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
accidental rm -rf /bin as root...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
CloudBolt
Apprentice
Apprentice


Joined: 04 Feb 2006
Posts: 192
Location: The Netherlands

PostPosted: Thu May 04, 2006 4:02 pm    Post subject: accidental rm -rf /bin as root... Reply with quote

well, actually I pressed enter accidentally while typing rm -rf /tmp, which left rm -rf /, which of course isn't good... I was able to stop the process by pressing ctrl-c though, but now my entire /bin directory is gone...I suppose there isn't any way to recover it, is there?
_________________
GNU/Linux is an operating system.
IBM OS/2 is half an operating system.
Windows is a shell.
DOS is a boot partition virus.
Back to top
View user's profile Send private message
anthrax
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2005
Posts: 105

PostPosted: Thu May 04, 2006 4:08 pm    Post subject: Reply with quote

OOops :)

Possibly, what FileSystem are you using for your root partition?
_________________
Trust is a weakness
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Thu May 04, 2006 4:14 pm    Post subject: Reply with quote

or untar a stage 3 and emerge -e world... :twisted:
Back to top
View user's profile Send private message
anthrax
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2005
Posts: 105

PostPosted: Thu May 04, 2006 4:26 pm    Post subject: Reply with quote

If that strategy he would do best to live cd it, mount root and the extract the stage 3 to say /mnt/gentoo/EXTRACT and then "mv /mnt/gentoo/EXTRACT/bin/ /mnt/gentoo/ && rm -rf /mnt/gentoo/EXTRACT" then we just exit and reboot and gentoo should feel well again :) although I would at least recommend an "emerge -e system" just to make sure everything is alright.
_________________
Trust is a weakness
Back to top
View user's profile Send private message
CloudBolt
Apprentice
Apprentice


Joined: 04 Feb 2006
Posts: 192
Location: The Netherlands

PostPosted: Thu May 04, 2006 4:32 pm    Post subject: Reply with quote

anthrax wrote:
OOops :)

Possibly, what FileSystem are you using for your root partition?


using ReiserFS 3
_________________
GNU/Linux is an operating system.
IBM OS/2 is half an operating system.
Windows is a shell.
DOS is a boot partition virus.
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Fri May 05, 2006 5:56 am    Post subject: Reply with quote

Here is a little Perl program that will tell you which packages you need to re-emerge. It finds every package that has at least one file in /bin/.
Code:
#!/usr/bin/perl -w

use strict;

my $TARGET = "/bin";
my $DB_DIR = "/var/db/pkg";
my (%VALID, %PACKAGES);

for my $dir (<$DB_DIR/*>) {
    for my $package (<$dir/*>) {
        open(CONTENTS, "$package/CONTENTS") or next;
        while (<CONTENTS>) {
            m/^(?:obj|dir|sym) ($TARGET\S*)/o or next;
            my $file = $1;
            $package =~ s{^$DB_DIR/}{};
            $package =~ s/-\d(?:[\d.r-]|_p)*$//;
            $VALID{$file} = $package;
            $PACKAGES{$package}++;
        }
        close CONTENTS;
    }
}

for my $package (sort keys %PACKAGES) {
    print "$package\n";
}
__END__


Here is the output from my system:
Code:
app-arch/bzip2
app-arch/cpio
app-arch/gzip
app-arch/tar
app-editors/nano
app-shells/bash
app-shells/zsh
net-mail/checkpassword
net-mail/cmd5checkpw
net-misc/iputils
sys-apps/baselayout
sys-apps/busybox
sys-apps/coreutils
sys-apps/debianutils
sys-apps/ed
sys-apps/gawk
sys-apps/grep
sys-apps/kbd
sys-apps/module-init-tools
sys-apps/net-tools
sys-apps/pam-login
sys-apps/sed
sys-apps/shadow
sys-apps/sysvinit
sys-apps/util-linux
sys-boot/grub
sys-fs/cryptsetup-luks
sys-fs/e2fsprogs
sys-process/procps
sys-process/psmisc

You will still need to bootstrap from a stage3 tarball but maybe this will save you a couple of days of re-emerging after you've done the bootstrap. I modified a program I had previously written for finding cruft under /etc/.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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