My ssd had a partition problem and I've been unable to repair grub. I can still access the partition with my files on it though so what I want to do is backup the installed packages and reinstall ubuntu.

Normally if I wanted to backup my packages I'd run dpkg --get-selections , but that will just return the packages from the liveusb that I'm booting from. Is there any way to specify which ubuntu installation I want to get selections for?

Or if anyone can think of a better way of backing everything up that would be very helpful too!