LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is there a file that lists all installed packages in Ubuntu (http://www.linuxquestions.org/questions/linux-software-2/is-there-a-file-that-lists-all-installed-packages-in-ubuntu-596412/)

Gethyn 11-01-2007 03:42 PM

Is there a file that lists all installed packages in Ubuntu
 
Hi there,

The other day I had a hard drive failure. I'm trying to rescue what information I can off the failed drive using another computer before reinstalling (on a new drive, of course). I can't boot into the installation on the failed drive, otherwise I would use dpkg --list, so I am wondering if there is a log file anywhere in Ubuntu that tells me which packages were installed. Under Slackware, if I remember rightly, there is a complete list of installed packages under /var/log/packages, I'm looking for something similar to that.

This isn't too important, if I can't get a list of the packages I had installed it's not the end of the world, no doubt I'll notice if there's one missing after reinstallation that I realise I want to use! I'm just curious about this, and I wasn't able to find the answer by doing a web search.

By the way, before anyone says it, I did keep backups, there shouldn't be any data loss, it's just going to be annoying reinstalling and reconfiguring everything (even if it is mostly just a case of copying in the old conf files).

Thanks for any assistance!

waylandbill 11-01-2007 04:33 PM

Use dpkg
 
dpkg --get-selections > ~/installed_packages

would do the trick.

wit_273 11-01-2007 04:44 PM

The status of packages are in /var/lib/dpkg/status This will tell you what is installed marked to be installed/uninstalled and other package status.

Gethyn 11-01-2007 05:10 PM

Thanks wit_273! waylandbill, thanks for the tip but as I said I can't actually boot into the install on the failed drive, so I couldn't use dpkg.

phantom_cyph 11-01-2007 05:44 PM

Or, open synaptic package manager (enter root password) and click on "installed packages".

complich8 11-01-2007 05:47 PM

just fyi, even if you can't boot the disk, it may be possible to mount it and chroot into it from a working disk (either livecd or the working disk)...

but yeah, what wit said :)

jiml8 11-02-2007 10:47 AM

Since you say it isn't important, you probably don't want to do this, but if you were to run SpinRite on the failed drive, you probably would get it back to a usable state for at least a short time. This would give you time to get your data off, or maybe even enough time to image the drive.

Gethyn 11-02-2007 07:38 PM

It's not important enough to me to justify spending the license fee for SpinRite, but thanks for the suggestion. The wikipedia page on SpinRite also mentioned ddrescue, which I hadn't heard of before and is free, so that might be worth looking into if necessary. I think I've managed to get all the important data off the drive now though, apart from configuration data nearly all of it was in the last backup I took before the drive failed.

Thanks again to everyone.

jiml8 11-03-2007 10:58 AM

I don't think that ddrescue does the same thing as spinrite in one critical area. Ddrescue doesn't abort on I/O errors, but it also doesn't do much of a job of trying to read the block that has the error. IF it can't read it, it'll just fill it in with something in the output file.

Spinrite will read the damaged block over and over, and perform a statistical analysis of the data it reads in, attempting to reconstruct the real data that is in the block. More often than not, this works - although it can take a long time. If it recovers the data, it remaps the drive to remove the bad block and puts the data into one of the drive's spare blocks.

Sometimes after recovering the data, it then can rewrite that block, and test it, and find it to be OK. In this case it will then restore that block to the "active" list.

Presuming the heads move and the platter spins, it has been my experience that usually spinrite will return the drive to a serviceable state. If the drive is failing, the drive won't remain serviceable for long but it usually will last long enough to get the data off (perhaps with ddrescue). If the drive, for instance, experienced a soft head crash (like when one of your kids is playing, slips and falls, and knocks over the computer) then spinrite will save your bacon, recovering the drive with no data loss. If such an event didn't do hardware damage to the HD, you can just keep on going.

I do not know of any other product that can do this, and I have to say that it has been an invaluable tool for me.


All times are GMT -5. The time now is 09:31 PM.