Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

The hard drive on my server that contains /var crashed yesterday. I do not have backups for everything in /var/lib.

Regarding the list of packages installed, I have a backup file using the following command from the day of the crash:

dpkg-query - show - showformat = '$ {Package} \ n'

How to reset apt and dpkg settings to be able to re-install and update the system?

Any ideas would be appreciated.

share|improve this question

closed as too localized by RolandiXor, Alvar, Takkat, Ringtail, Thomas Ward Jan 4 '13 at 3:22

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

This question appears to be abandoned and unanswered, could you perhaps add more detail to your question? If this question no longer applies then you can either delete it or answer it yourself if you've solved the problem. Thanks! – RolandiXor Jan 3 '13 at 19:17

You can't.

The whole state of the package management is kept in there. If it's lost, there's no way to 'rebuild' this database in a reasonable way. It keeps track of more than just what packages are installed, e.g. configuration choices (debconf). Recovering this from (earlier) backups may lead to other issues too - as the system state may have changed and the backup is invalid in such a case. This will result in conflicts later.

Only restore /var/lib/dpkg from backup if you know nothing has been changed concerning the package management in the meantime.

share|improve this answer

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