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.
ACCEPTED]
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:
--root=dir Changing root changes instdir to «dir» and admindir to «dir/var/lib/dpkg».
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.
--rootoption to rundpkgcommands on the broken system directly ex.dpkg --root=/mnt/oldroot --get-selections- steeldriver