I managed to wipe out my host /dev/ directory

Mike McCarty Mike.McCarty at sbcglobal.net
Tue Mar 24 00:07:01 PDT 2009


Dan Tran wrote:
> Hello,
> 
> I am a first time user of LFS, and was away from linux related wor for
> quite some time.
> 
> I am now at chroot phase where I managed to  wipe out my $LFS/dev
> directory which was still bound to the actual /dev

Well, great minds get stuck in the same ruts :-)

I did the same thing, when I decided I needed to restart the
build from the beginning, and rm'd the build environment.
I had exited the chroot, but forgotten to unmount the bound
mount. So, there ya go. I realized what I had done the moment
I lifted my hand from the keyboard. Sinking feeling in the
pit of my stomache.

> My  system is still functional, i just can not login ::(

Also, don't shut down. Find out what RPM supplies /dev on
your system. First, find the version. I'll show you the output
for my machine, and that may help. Be sure to substitute the
appropriate versions and file names when you run yours, as they
are very ulikely to be the same.

$ rpm -qf /dev
dev-3.3.13-1

That tells you the name of the RPM which supplies /dev. In my case
it's dev-3.3.13-1.i386.rpm

Next, you need to find a copy of that RPM.

$ locate dev-3.3.13-1
/home/jmccarty/packages/rpm/dev-3.3.13-1.i386.rpm

I'll suppose that you don't have a copy of that on your machine,
as I didn't. I found mine on rpm.pbone.net and got it from

ftp://ftp.muug.mb.ca/mirror/fedoralegacy/fedora/2/os/i386/dev-3.3.13-1.i386.rpm

You'll need to find yours and download it, then install.

# rpm -i --force dev-3.3.13-1.i386.rpm

Note carefully the "#". That must be done as root.

At this point, if all is well, your system is in a reasonable state,
but it hasn't built the entries. You can try to do MKNODs yourself,
or you can take a (very) deep breath and reboot. I'd make sure I
had some sort of rescue disc, and another machine I could boot
to continue to get help, or at least be able to get help when
booted from the rescue disc before I did anything to the machine
other than download the RPM.

I had already rebooted and discovered that the system was,
indeed, hosed, and completely unable to boot. I used KNOPPIX
and simply copied the (working) /dev to my machine to get
it to a mostly bootable state, but unable to mount USB
devices, the printer was gone, etc. I used that hobbled
state to download and install.

System recovery is always scary. I hope you have a good backup.
If you can, you might want to make one now, before doing anything
else.

Good luck.

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I speak only for myself, and I am unanimous in that!



More information about the lfs-support mailing list