1

For reasons that I won't bore you with, I would like to back up /var/lib/apt/lists to back up all of the downloaded manifests and then restore them back to that state should an apt-get upgrade fail for some reason.

So ok I tar the files up but when I restore them the system still uses the updated version of the manifests. I'm assuming after they have been downloaded these manifests are ingested into an internal database for ease of access. So how do I kick off that ingest process without doing an apt-get update?

  • 3
    Does this answer your question? [How do I replicate installed package selections from one Debian system to another? (Debian Wheezy)](https://unix.stackexchange.com/questions/191662/how-do-i-replicate-installed-package-selections-from-one-debian-system-to-anothe) – jordanm Jun 07 '21 at 14:42
  • Interesting but no, I'm trying to reset the state of the package management system, not replicate a server. But thanks anyway :-). – Tony Cooper Jun 07 '21 at 15:54
  • While the question is about replicating, the method in the answer can also be used as a way to backup and restore. – jordanm Jun 07 '21 at 16:38

1 Answers1

1

The package lists are indeed “ingested”, into caches stored by default in /var/cache/apt: pkgcache.bin and srcpkgcache.bin.

To force apt to only look at the indexes you’ve restored, the simplest option is to delete those caches: sudo rm /var/cache/apt/*pkgcache.bin. apt will then re-create them, using the local information, the next time it’s run with appropriate permissions; you can force that with

sudo apt-cache gencaches
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164