Dear Anthony,
Am Donnerstag, 31. Dezember 2020 schrieb Antony Stone:
> Hi.
>
> I know I can get a list of the packages installed on a
> currently-running system using commands such as:
>
> dpkg-query -l
> apt list --installed
> aptitude search ~i
>
> However, if there any way I can do the same thing, but when I simply
> have a copy (backup) of the machine, and it's not currently running?
> The backup is on another Debian / Devuan system (which may or may not
> be the same release version).
>
> I have _all_ files from the machine I want to investigate, and I'm
> hoping that there's something in /var/cache/apt or /var/lib/dpkg
> which would allow me to get the same sort of list as the above
> commands produce.
>
> Does anyone have any ideas?
You need the contents of the directory "/var/lib/dpkg", then easy-peasy
go with this:
dpkg --admindir=/dir/to/backup/of/var/lib/dpkg --get-selections "*<pattern>*"
HTH
Kind regards,
Stefan