View previous topic :: View next topic |
Author |
Message |
CloudBolt Apprentice
Joined: 04 Feb 2006 Posts: 192 Location: The Netherlands
|
Posted: Thu May 04, 2006 4:02 pm Post subject: accidental rm -rf /bin as root... |
|
|
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 |
|
|
anthrax Tux's lil' helper
Joined: 17 Apr 2005 Posts: 105
|
Posted: Thu May 04, 2006 4:08 pm Post subject: |
|
|
OOops
Possibly, what FileSystem are you using for your root partition? _________________ Trust is a weakness |
|
Back to top |
|
|
drwook Veteran
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Thu May 04, 2006 4:14 pm Post subject: |
|
|
or untar a stage 3 and emerge -e world... |
|
Back to top |
|
|
anthrax Tux's lil' helper
Joined: 17 Apr 2005 Posts: 105
|
Posted: Thu May 04, 2006 4:26 pm Post subject: |
|
|
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 |
|
|
CloudBolt Apprentice
Joined: 04 Feb 2006 Posts: 192 Location: The Netherlands
|
Posted: Thu May 04, 2006 4:32 pm Post subject: |
|
|
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 |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Fri May 05, 2006 5:56 am Post subject: |
|
|
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 |
|
|
|