Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 05-31-2010, 10:29 AM   #1
LQ Newbie
Registered: Apr 2007
Distribution: Debian
Posts: 15

Rep: Reputation: 0
Getting list of installed packages from a dead system

I have a dead system that was running Debian Linux (lenny). I can boot into emergency mode, but nothing else.

I will likely have to reinstall Debian. I've read lots of things online about how to get a list of currently installed packages. Which is fine and dandy if the system is working and I can log into it. I'm kicking myself in the rear for not doing that on a regular basis.

In my situation, I'm basically wanting to extract such a list from a hard drive containing an installation I can't log into normally. I can access the filesystem just fine, and nothing related to aptitude has been damaged.

Does anyone know where I should look, or where I could look for further information?

Thanks for taking the time to read this and your help.
Old 05-31-2010, 10:43 AM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Boot into single user mode, and run
dpkg --get-selections > /tmp/packages.txt
. Later, feed the text file to dpkg --set-selections.

Failing that, grab a copy of /var/lib/dpkg and do some magic. I'd just have to Google the magic, so you can too.
Old 05-31-2010, 11:30 AM   #3
Senior Member
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid
Posts: 4,734
Blog Entries: 12

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
!debian clone

< dpkg> One method of cloning debian installs is to take a current debian machine that is setup with the packages you want.

Run the command

dpkg --get-selections > ~/selectionfile

Then, after the base install on other machines use that file and do:

dpkg --set-selections < ./selectionfile && apt-get dselect-upgrade
Old 05-31-2010, 11:59 AM   #4
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2018 CentOS6.10 CentOS7.5 + 50+ other Linux OS, for test only.
Posts: 17,074

Rep: Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475
This will work .. and will save an alphabetic package list :

ls /media/disk/var/lib/dpkg/info/ | grep list > list.txt

You will of course have to use the actual path.
Old 01-14-2016, 12:52 PM   #5
LQ Newbie
Registered: Aug 2003
Location: Amsterdam
Distribution: debian
Posts: 13

Rep: Reputation: 0
The real answer

dpkg --admindir /opt/verylarge/backintime_backup/backintime/sean/root/1/20160109-060001-718/backup/var/lib/dpkg -l

is what you wanted to know. Adding this here for others who were looking for the same thing.
(aka, pass the old /var/lib/dpkg path to dpkg using --admindir).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to save a list of installed packages and install these packages later mandavi Ubuntu 5 09-07-2009 11:36 AM
Is there a list of all installed packages? AgentD Slackware 6 05-28-2008 01:36 AM
How to list all installed packages? bp12345 Debian 2 08-15-2005 08:06 AM
list of installed packages jeff1500 Slackware 3 03-22-2004 04:52 PM
How do I get a current list of RPM packages installed on my system? needamiracle Linux - General 1 12-06-2002 05:38 PM > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration