Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used sudo rm -r /etc/apt and my apt folder in file system got deleted because of which i am not able even to use Internet in terminal also.can any body suggest me how to back up my apt folder in file system

share|improve this question

Little late to run backups now. Generally you should be backing up your important data before you destroy it.

I would suggest, in the following order:

  • reinstall
  • copy /etc/apt from an identically-configured machine
  • debootstrap a debian install into a directory somewhere, install the necessary packages (check your package manager log for clues), then copy back /etc/apt
share|improve this answer

I am a bit confused as to why you would be unable to use the Internet in your terminal - /etc/apt/ (essentially) only governs how you retrieve new Debian packages. Can you still do a 'ping' from the command line? If that does not work, you have issues that go beyond a lost /etc/apt/

You should be able to recreate a working /etc/apt relatively easily - the only thing that you can't live without is /etc/apt/sources.list. There are also two directories that apt requires, but they can be empty.

Try the following:

mkdir -p /etc/apt/apt.conf.d/
mkdir -p /etc/apt/sources.list.d/
echo 'deb stable main' > /etc/apt/sources.list

In the last line, change 'stable' to whatever you are using, and add 'non-free' and/or 'contrib' at the end of the line, if needed.

Then do an apt-get update, and you should be back in business.

You'll still have to add any extra repositories you had in your sources.list, and and deb-src line corresponding to the deb line, but the basics should be covered.

Good luck!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.