Technically speaking, yes it is possible. All installed packages have a *.list
file associated with them; these files are lists of all the files that were created upon installation of a package (but that's beside the point, we only need to know the names of the packages themselves to know what's been installed).
So what you can do is connect the drive (could be SATA to USB connector or live CD/USB ) mount your broken drive's partition (with udisksctl mount -b /dev/sdb1
, note to replace sdb1
with actual disk), navigate to the mount point where partition was mounted, and run
find ./var/lib/dpkg/info/ -name "*.list" -type f -printf "%P\n" | awk -F'.' '{print $1}'
For instance, I've another partition on my drive where I've got 15.10 Ubuntu. Here's what I'd do:
DIR:/xieerqi
skolodya@ubuntu:$ udisksctl mount -b /dev/sdb5
Mounted /dev/sdb5 at /media/xieerqi/0ca7543a-5463-4a07-8bbe-233a7b0bd6251.
DIR:/xieerqi
skolodya@ubuntu:$ cd /media/xieerqi/0ca7543a-5463-4a07-8bbe-233a7b0bd6251
DIR:/0ca7543a-5463-4a07-8bbe-233a7b0bd6251
skolodya@ubuntu:$ find /var/lib/dpkg/info/ -name "*.list" -type f -printf "%P\n" | awk -F'.' '{print $1}' | head
libbuzztard0
linux-headers-3
indicator-bluetooth
python-twisted-mail
netpbm
mtp-tools
javahelp2
firefox-locale-zh-hant
gir1
libqapt2
Side note
This approach produces the list that shows packages of all installed packages as of the last boot of the system. Example from my running system
DIR:/xieerqi
skolodya@ubuntu:$ find /var/lib/dpkg/info/ -name "*.list" -type f -printf "%P\n" | awk 'END{print NR}'
2837
DIR:/xieerqi
skolodya@ubuntu:$ dpkg --get-selections | awk 'END{print NR}'
2837
find
has to search path, meaning if I'm in/media/$USER/my-drive
,find
command has to search thevar
directory that is there, not/var
which refers to root of the running filesystem – Sergiy Kolodyazhnyy Jan 24 '16 at 06:31