LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-07-2007, 12:38 AM   #1
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Rep: Reputation: 15
Am i done for? Deleted /etc by mistake


Yeah... i know.

I was untaring some app to my /root/stuff directory and it created an /etc dir in there. I couldn't get the thing installed so i wanted to delete that /etc directory. I was in my /root/stuff directory and, like a total idiot, i typed "rm -rf /etc/" instead of "rm -rf /root/stuff/etc".

Now etc is gone obviously.

Is there something i can do to restore it or and i done for and must install slack again from scratch?
 
Old 07-07-2007, 01:16 AM   #2
e5150
Member
 
Registered: Oct 2005
Location: Sweden
Distribution: Slackware and Alpine
Posts: 132

Rep: Reputation: 100Reputation: 100
If you have access to a slackware mirror or the CDs/DVD you could always just grep through /var/log/packages/* for files that belongs to /etc and do some hard work with explodepkg to get your hands on the default files for /etc, and thus avoiding a complete reinstall.

And once you've got it fixed you should tell crond to take a daily backup of /etc ;-)
 
Old 07-07-2007, 01:37 AM   #3
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Original Poster
Rep: Reputation: 15
I'm searching for an ext3 data recovery software. Recovered a 200gb NTFS partition witch broke today using a ntfs recovery tool so it shouldn't be that hard to recover the /etc deleted dir...

Last edited by AriciU; 07-07-2007 at 01:39 AM.
 
Old 07-07-2007, 01:53 AM   #4
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
As e5150 stated, definitely start making a regular backup of /etc (and probably /home and /var, and perhaps others, depending on the usage pattern of the box).

That being said, yeah, you're probably hosed. Among other things, the /etc directory contains the startup scripts, the password database, and various other things that are required for proper system function. You *might* be able to recover the original files, but unless it's information that you simply cannot recreate given a bit of time in a new installation, it's probably not worth the time/effort required. e5150's suggestion to explode the packages containing /etc content is a decent one, though, as most of the files aren't modified much from the default in typical usage (that of course depends on how "typical" is defined and what *your* specific usage is). If you elect to go that route, you'll at a minimum have to recreate any user accounts and custom groups, as well as reset the password for root.

If it helps any (and it probably won't) :-) you're not alone on this journey - I've walked that road not once, but twice, in my days on linux...
 
Old 07-07-2007, 02:06 AM   #5
rvdboom
Member
 
Registered: Jul 2007
Distribution: Slackware
Posts: 235

Rep: Reputation: 30
Instead of exploding the package, you can just run a "upgradepkg --reinstall" with the "etc" package, I'm not sure upgradepkg needs /etc at all.
Then, as explained above, you will need to recreate users, groups, password, but that's less work than a full reinstall.
If you already shut down your system, you still can boot on the Slack CD, copy the "etc" package on your disk, then chroot and run the "upgradepkg" command.
 
Old 07-07-2007, 02:21 AM   #6
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Original Poster
Rep: Reputation: 15
Meh, i'm fux0red

Quote:
Q: How can I recover (undelete) deleted files from my ext3 partition?
Actually, you can't! This is what one of the developers, Andreas Dilger, said about it:

In order to ensure that ext3 can safely resume an unlink after a crash, it actually zeros out the block pointers in the inode, whereas
ext2 just marks these blocks as unused in the block bitmaps and marks the inode as "deleted" and leaves the block pointers alone.
Should've just set the damn partition to ext2 in the first place... would've recovered everything like a charm.

Anyway, slack was only installed a few hours ago. All i had on it was ntfs-3g, conky and some other smaller stuff.

Any of these linked to /etc ?

I'll copy the /etc dir from the slack dvd and see what happens...

EDIT: where can i find the etc package on the slack dvd?

Last edited by AriciU; 07-07-2007 at 02:24 AM.
 
Old 07-07-2007, 02:25 AM   #7
rvdboom
Member
 
Registered: Jul 2007
Distribution: Slackware
Posts: 235

Rep: Reputation: 30
I think reinstalling the "etc" package" is better than copying the /etc from the CD. There are probably a lot of things missing in the Cd's /etc.
In any case, I think there are many other packages you'll need to reinstall, as some set their own /etc conf files.
 
Old 07-07-2007, 02:39 AM   #8
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Original Poster
Rep: Reputation: 15
I can't copy it anyway. I can't mount the slack partition used by booting the DVD because i can't edit /etc/fstab to set it's mount point and stuff like that.

How would i go about reinstalling /etc ?

Would it just be better to reinstall the whole damn thing (slack 12) all together and forget about it?
 
Old 07-07-2007, 04:35 AM   #9
AriciU
Member
 
Registered: Jul 2007
Location: Bucharest, Romania
Distribution: Ubuntu 7.04, Slackware 12
Posts: 87

Original Poster
Rep: Reputation: 15
Reinstalled everything and running normal again. Next is a "rm -rf *" to make it perfect
 
Old 07-07-2007, 05:04 AM   #10
rvdboom
Member
 
Registered: Jul 2007
Distribution: Slackware
Posts: 235

Rep: Reputation: 30
For the record, you don't need fstab to mount a partition : just run "mount -t <fs_type> <device> <mount point>" works.
Anyway, reinstalling everything is often faster when you don't have too personnalized a system.
 
Old 07-07-2007, 06:07 AM   #11
Eternal_Newbie
Member
 
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware
Posts: 573

Rep: Reputation: 59
Oops, answered wrong question.

Last edited by Eternal_Newbie; 07-07-2007 at 06:08 AM. Reason: Answered wrong post, irrelevent here
 
  


Reply



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
Deleted rc.local by mistake Fredstar *BSD 4 06-18-2007 08:44 AM
Deleted Trash Icon By Mistake, What Now? zhuangshi SUSE / openSUSE 4 03-26-2005 08:58 AM
help pls! deleted something by mistake marlor Slackware 2 02-05-2005 08:06 AM
emergency, deleted linux partition by mistake snakeo2 Linux - Newbie 11 03-26-2004 06:40 AM
DOH! Noob mistake.. Deleted Kerberos tfdml37 Linux - Software 1 03-19-2004 04:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:03 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
Open Source Consulting | Domain Registration