Get list of installed packages - from damaged partition
I'm running 13.04 on VMWare Fusion 6 on top of OS X, which has some serious stability problems, necessitating hard reboots (power cycling) at least once/day if not more.
Since VMWare is lame and doesn't always write disk data to disk, it is very easy for virtual machines to get damaged when someone restarts the machine without shutting down the VM.
At any rate, I've got a virtual disk from my old VM which can be mounted in a new install, but I don't know how to get a list of installed packages, since dpkg
is looking at its new database and doesn't care about the old one.
There are a lot of issues with the old partition, files corrupted and such, so I can't just dd
it to a new location. I figure the easiest way forward is to compile a list of packages I added post-install, then feed it to dpkg
and apt-get
as in this answer. My only problem is generating that list of packages. Can anyone help?
Solution 1:
If you can mount the virtual disk enough to see the /var/lib/dpkg/ directory, you can tell dpkg to look there with the "--admindir" option.
dpkg --admindir=/mountpoint/var/lib/dpkg --list
The only file that is really needed is /var/lib/dpkg/status (or one of its backups). So you could copy that single file to an empty directory and point dpkg at that directory.