I know I can do

dpkg --get-selections

to see a list of installed packages. However I have a hard drive that doesn't boot but most files appear to be intact. Is there a way I can get the list of packages that were installed off this broken hard drive without figuring out how to boot a system from it? Where does dpkg store this information?

The old system was Ubuntu 18.04 LTS.

Thanks in advance.

  • If you have mounted the old drive, it may be possible to use the --root option to run dpkg commands on the broken system directly ex. dpkg --root=/mnt/oldroot --get-selections Commented Apr 15, 2020 at 1:55
  • @steeldriver please make this an answer so I can mark it as the solution. Thanks! Commented Apr 15, 2020 at 2:07

1 Answer 1


The answer to your question is that it is stored in the file /var/lib/dpkg/status (at least by default).

However, if you have mounted the old system, then it may be possible to run dpkg --get-selections on it directly, using the --root switch. From man dpkg:

          Changing  root  changes  instdir  to  «dir»  and   admindir   to

So for example

dpkg --root=/mnt/oldroot --get-selections

If your old system had a separate /var or /var/lib partition, these will also need to be appropriately mounted as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .