LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-09-2007, 07:50 AM   #1
matrix13
Member
 
Registered: Nov 2006
Location: Kerala, India
Distribution: Arch Linux
Posts: 134

Rep: Reputation: 25
/etc deleted!!!


I am new to linux.

While I was trying to log in as root, i was trying to remove the .X0-lock file.

Accidently, i removed the /etc folder
Code:
rm -rf /etc/
Now my system shows the message(while booting up)
Quote:
Enter the runlevel
I tried 1, but didnt work.

--Is there any way to recover my machine (Debian Etch), without a reinstall?
--What about copying the /etc folder from another linux machine?

Thanx...
 
Old 07-09-2007, 07:56 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
Originally Posted by matrix13
I am new to linux.

While I was trying to log in as root, i was trying to remove the .X0-lock file.

Accidently, i removed the /etc folder
Code:
rm -rf /etc/
Now my system shows the message(while booting up)

I tried 1, but didnt work.

--Is there any way to recover my machine (Debian Etch), without a reinstall?
You can get a list of installed package in /var and from this, reinstall all packages, including configuration files. You will have the default /etc directory for the install packages. The remaining missing files in /etc have to be manually recreated probably. Not impossible.
Quote:
--What about copying the /etc folder from another linux machine?

Thanx...
Yes, depends on how you modified your system.. moving an etch from fedora core to debian is not a good thing tho' prefer from debian to debian
 
Old 07-09-2007, 08:01 AM   #3
matrix13
Member
 
Registered: Nov 2006
Location: Kerala, India
Distribution: Arch Linux
Posts: 134

Original Poster
Rep: Reputation: 25
I thought of copying a '/etc' from another system.
But, there is a problem.
How will I log into my machine. It asks for a 'runlevel'.
What should I enter here?

Thanx for the reply...
 
Old 07-09-2007, 08:26 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Booting witout /etc is waste of time.
You need to boot with a live cd, mount your harddisk partitions and do all your operation from the livecd.
 
Old 07-09-2007, 08:37 AM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Is it not true that the .trash-root folder in /root would hold the deleted files temporarily until it is emptied?

Never restore files from there yet but I know all my deleted files are there taking up the storage and I have to go in from time to time to clean it out. Think that is the same way the recycle bin work in the MS system.

If that is the case just boot up a Live CD to restore the partition.
 
Old 07-09-2007, 08:56 AM   #6
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Don't spend half your life trying to fix it. Accidentally removing critical system files is part of the learning curve for new Linux users. If you built your system with /home on a separate partition (you should have), just reinstall around it. (During the partitioning dialog, identify the same /home partition, and do not format it.)

I always recommend that my newbie friends reinstall a few times at first. There is much to be learned in that process.
 
Old 07-09-2007, 09:10 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
This will reinstall all packages and their configuration files (not tested):
Code:
dpkg -l | awk '{print $2}' | xargs | apt-get -o DPkg::Options::='--force-confmiss' --reinstall install
This will reconfigure all packages handled by debconf
Code:
dpkg-reconfigure --all
But as rickh said, you can also reinstall, it would be quicker..
 
Old 07-09-2007, 09:32 AM   #8
student04
Member
 
Registered: Jan 2004
Location: USA
Distribution: macOS, OpenBSD
Posts: 669

Rep: Reputation: 34
Quote:
Originally Posted by rickh
Don't spend half your life trying to fix it. Accidentally removing critical system files is part of the learning curve for new Linux users. If you built your system with /home on a separate partition (you should have), just reinstall around it. (During the partitioning dialog, identify the same /home partition, and do not format it.)

I always recommend that my newbie friends reinstall a few times at first. There is much to be learned in that process.
Agreed. Caution should always be used when toying around as root. Mistyped commands can mess up a lot, and there's no "Trash" with rm.

If you recently installed, the easiest but time consuming way would be to do it again (build around /home as rickh says in case you have files in there you do not want to have overwritten).
 
Old 07-09-2007, 10:31 AM   #9
UK MAdMaN
Member
 
Registered: Jul 2004
Location: Manchester, England
Distribution: Gentoo
Posts: 211

Rep: Reputation: 30
Quote:
Originally Posted by saikee
Is it not true that the .trash-root folder in /root would hold the deleted files temporarily until it is emptied?
Only if you delete files in the graphical interface. Using rm on the command line will completely remove the files.
 
  


Reply

Tags
etc



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
I deleted / HELP!!!! fobster Linux - General 10 08-18-2006 09:22 AM
Kmail crashes when deleted mail is deleted dufferin Slackware 0 03-21-2005 03:23 PM
deleted linux partition adn the boot loader was deleted also,now i have only gnu grub boris199 Linux - Laptop and Netbook 2 01-29-2005 04:53 PM
xp deleted grub cybrtrckr Linux - Newbie 8 10-01-2004 03:25 PM
pretend this is deleted. amphibious Linux - Newbie 2 12-02-2003 05:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:34 AM.

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