LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 11-24-2003, 05:14 PM   #1
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Rep: Reputation: 15
I just nuked /etc


OK, OK, I was doing something a little too quickly....

Do you ever get that feeling when the blood just drains out of your face? Yep. That one.

Here's what happened.

I'm working in a heterogeneous Windows/Linux networked environment. I've had a linux server with Samba loaded on it for quite a while, everything up and running fine, RH 8.0.

Today, I wanted to backup some critical directories onto one of the W2K boxes, the sysadmin gave me a spot, I got hooked up to the shares with smbmount,
setup on /mnt/halbackup.

I started working with cpio, to copy the major user directories over to the W2K box, which worked fine. Logged in as root, got everything over there OK.

Well, I figured I ought to copy /etc over there as well, issuing the following command:
Quote:
find /etc | cpio --pass-through --make-directories -dereference --no-preserve-owner /mnt/halbackup
OK, it worked. I had everything backed up on the W2K box. I was setting up a script to handle this automatically, so I could do it all at one shot (user directories, and /etc).

So, I switched directories over to /mnt/halbackup/etc (I made sure I was in the backup location on the W2K box), and did and rm, a big one. I figured I would clear it out, and then re-run the script, recopying /etc back to the W2K box, and all the backups run over there would have my /etc nice and cozy on their global backup.

And then it happened. I tried to cd to /etc, and there was no such directory. I tried to su, and there was no root user.

I think that little -dereference flag to the cpio command somehow got me back to nuking the original /etc directory on my linux box!



Can somebody help me? My machine is still alive, but I'm afraid to touch it, can't reboot it, can't login......help!!!!!
 
Old 11-24-2003, 05:30 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
Copy /etc from any other Linux machine you can find. The most important files are /etc/passwd and /etc/shadow.
 
Old 11-24-2003, 05:42 PM   #3
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Original Poster
Rep: Reputation: 15
Can I do this from the original system disks?

Thanks for your reply. I think I've got a bit of a chicken and egg problem. I don't have the permissions to copy into /etc (or create /etc), because there is no /etc/passwd.

Is it possible to boot from the system CD, recover a vanilla /etc, and setup a new root? I don't want to touch the rest of the disk, just get /etc back, with a root that will help me clean up the mess I've made.

Thanks.
 
Old 11-24-2003, 05:52 PM   #4
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Original Poster
Rep: Reputation: 15
I found a linux bootfloppy

Hi folks,

I found the boot floppy, and restarted linux
Quote:
Mounting /proc filesystem
Creating block devices
Creating root device
Mounting root filesystem
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
Freeing unused kernel memory: 212k freed
INIT: version 2.84 booting
INIT: No inittab file found
INIT: can't open (/etc/ioctl.save, O_WRONLY): No such file or director

Enter runlevel:
OK, what do I do?
 
Old 11-24-2003, 06:01 PM   #5
dr_van_nostrand
Member
 
Registered: Apr 2003
Location: Sweden
Distribution: Slackware 9.1
Posts: 77

Rep: Reputation: 15
Post

I think you need to boot with a system that can work on it's own eg Knoppix, or any other live distribution. There are some for floppys to. Check if they have support for your filesystems otherwise there's no much use of 'em
 
Old 11-24-2003, 06:02 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
I agree, Knoppix should be very good. One of the reasons is that it has its own /etc.
 
Old 11-24-2003, 06:05 PM   #7
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Original Poster
Rep: Reputation: 15
Thanks, dr_van_nostrand,

Unfortunately, I don't have access to Knoppix. I was hoping to be able to boot off the linux boot floppy, get in with root, and be able to create and populate /etc from the boot floppy.

The problem is, I think it's looking for /etc on the hard drive in order to boot completely. Chickens and eggs chasing one another around....

Anybody know how I can get this to boot from the floppy, and recover /etc?
(RH 8.0). If not, is it possible to do the same thing if I had the system CDs?

TIA,

Charlie

Last edited by cpeppler; 11-24-2003 at 06:07 PM.
 
Old 11-24-2003, 09:01 PM   #8
netboy_541
Member
 
Registered: Jul 2003
Location: Hamilton, OH
Distribution: Redhat 9, SuSE 10.1 & 10.2, Kubuntu
Posts: 173

Rep: Reputation: 30
welp, i don't know, but i think i'm takin a stab in the dark, but --

do you happen to have a linux cd that's bootable?
or the recovery floppy that you can make during install??


I actually have a recovery cd that i got somewhere that has helped me out before... but usually if i hose my installation, i just blow the thing away and start over.. then copy all my other junk on there.... lol

hmm.. the more i think about it tho, i think that both of those just "boot" the machine and then turn it over to the hard drive..

damn -- i'll check into that when i get to the house..
 
Old 11-24-2003, 09:20 PM   #9
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Original Poster
Rep: Reputation: 15
I'm home now too...

I would really appreciate any help. I brought the wounded machine home with me to my home network, where I have another working Linux machine (6.2), that I can hook it up to if that will help. I also have the boot CDs for 8.0 that the machine was originally built with.

I just don't know how I'm going to get at the drive when there's no passwd file to validate permissions, etc.

Any help would be greatly appreciated. I have a bunch of really important stuff on this drive, that at a minimum, I need to find some way to get off of there. If I have to rebuild the box after that, well, that's the price of blowing your foot off.

I need to get that other data off of there though.

Any help would be hugely appreciated.

Charlie
 
Old 11-24-2003, 10:01 PM   #10
netboy_541
Member
 
Registered: Jul 2003
Location: Hamilton, OH
Distribution: Redhat 9, SuSE 10.1 & 10.2, Kubuntu
Posts: 173

Rep: Reputation: 30
I'll check it out when i go home in about 3 hours.

Don't feel bad, i've shot my own foot off many a time!
I have learned..

SLOW DOWN AND READ IT 30 TIMES BEFORE YOU SMACK ENTER.
ESPECIALLY AS ROOT!!!!!!!!!!!

 
Old 11-24-2003, 10:03 PM   #11
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Original Poster
Rep: Reputation: 15
OK, I'm in with the rescue disk...

I booted into "linux rescue" mode from the RH 8.0 CD, and I'm in.

Of course, there's no /etc/fstab for the system to look at, so fsck complain that it's not there.

Soooo.....Is there some magic way of mounting the physical drive to a file system without /etc/fstab? The one where I need to create /etc?

Anybody have any ideas on what to do next?

Charlie
 
Old 11-24-2003, 10:05 PM   #12
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
AFAIK, when you log in as root from a recovery disk, you completely blow by Linux's security measures. You can do anything you want to the box. At least, I can mount my Debian partitions and do whatever the hell I want to them from Slack. And vice versa - I switched my entire /tmp and /var partitions around in Slack from Debian. Dealing with /etc or /home should be no more difficult.
 
Old 11-24-2003, 10:06 PM   #13
netboy_541
Member
 
Registered: Jul 2003
Location: Hamilton, OH
Distribution: Redhat 9, SuSE 10.1 & 10.2, Kubuntu
Posts: 173

Rep: Reputation: 30
well, at least you are one step closer... :P

I will have to check my notes, and i will post what I got here in about 3 hours...

I could have wrote a damn book by now with all my linux notes... :P
 
Old 11-24-2003, 10:58 PM   #14
cpeppler
LQ Newbie
 
Registered: Sep 2003
Location: S. Hamilton, MA USA
Distribution: RH 6.2, 8.0
Posts: 29

Original Poster
Rep: Reputation: 15
...I know, I'm a wimp, but it's been a long day, and I may be in bed in 3 hours (US EST).

But that doesn't mean I'm not interested! I will check in in the morning.

I realize this is time to tread very carefullly, and I'm not sure exactly which steps I should be taking. TIA for your help. I really appreciate it.

Charlie
 
Old 11-24-2003, 11:01 PM   #15
netboy_541
Member
 
Registered: Jul 2003
Location: Hamilton, OH
Distribution: Redhat 9, SuSE 10.1 & 10.2, Kubuntu
Posts: 173

Rep: Reputation: 30
yeah i get outta here @ 12 -- takes me bout 45 mins to get to the hizzouse... I'm in eastern tooo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nuked HDD - Can I get the files back? Nige Linux - General 2 09-11-2005 11:43 PM
Debian NUKED my Slackware partition UltimaGuy Debian 8 12-05-2004 01:59 PM
Upgrading to 2.6.6 seems to have nuked my machine HawkeyeCoug Mandriva 4 05-18-2004 02:46 PM
Accidentally nuked anything libgd* - where to begin the restoration? mrodrigo Linux - General 2 09-15-2003 01:30 PM
Ran netconfig and nuked my dial-up fatboysmith Linux - Networking 3 05-16-2003 04:23 PM


All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration