Which packages did I add?

From MEPIS Documentation Wiki

Jump to: navigation, search

Contents

Introduction

Sometimes you might want to know which packages you added manually using one of these methods. For example, you may plan to install new version of your operating system and this version is so different that you decide to keep just your /home partition and reinstall everything else from scratch. However, you remember that while using your old system, you added quite a few packages which provide you some important functionality. You would like to install them on your new system as well. For some of them, guessing the name is easy - once you notice that you favorite program is missing, you just search for it in Synaptic and install it. But some are tricky - for example you might have installed some superb fonts on your old system and now you are quite desperate trying to get them again on the new one.

Basic Methods

There is no perfect solution, but the following approaches might help a bit.

  • Use File/History in Synaptic. This will show nicely all changes made via Synaptic but will not show packages added e.g. via apt-get install.
  • List all packages installed on your system:
dpkg -l >LIST
less LIST

but this list is very long and it does not tell you which packages were in the basic install, which came later via security updates, which you added by hand and which were added automatically to satisfy dependencies. Keeping this type of list may help, but it is really useful only when you are re-creating nearly identical system, as described in Back up your data. It is still a good idea to save this list every time you install a new system and every time you are leaving an old one. If you have these lists for two states of the same system, you can compare them in one of these ways:

  • Use a GUI application such as Kompare (available through Synaptic)
  • Type on the command line:
diff OLDLIST NEWLIST
  • Install the command-line application docdiff for a nice color comparison and type:
docdiff --tty --digest OLDLIST NEWLIST

If you did not make such a list when your old MEPIS system was new, you can still boot the old Live CD and make the list (just remember to save it to some permanent location, not just to ramdisk).

Advanced methods

Method 1

When there are many differences in these lists, it might be better to recover chronological list of changes made to your old system:

ls -lt /var/lib/dpkg/info/*.list|less

Looking at dates, you can even guess what package you entered by hand and what are the dependencies. A little postprocessing can make it nearly perfect:

ls -lt /var/lib/dpkg/info/*.list|awk '$6!=x{print "";x=$6;print x}{printf " %s", substr($8,20,length($8)-24)}'|less

For example, on my old Debian Sarge, this reveals:

2007-05-28
 wavesurfer
2007-04-26
 cftp
2007-04-16
 nvu
2007-02-09
 subversion db4.2-util libsvn0
2007-02-07
 firefox mozilla-firefox
2006-12-28
 scli
2006-12-15
 rcalc libzvt2.0-0
2006-10-18
 tkgate
2006-07-23
 docdiff libruby1.8 ruby1.8
2006-07-09
 automake1.9 automake1.4 autoconf autotools-dev
...

and now I can remember for instance when docdiff was installed along with its dependencies. A small script could even be written for package dependency analysis.

And of course - if you are scared by the all the command line magic above - making notes whenever you install new packages works as well!

Method 2

dpkg logs the list changes made to the system in the /var/log/ directory in a file called dpkg.log. A system called log rotate renames the log files when they are too big, but all the while keeping the most current dpkg.log. Over time there will be files names dpkg.log.1, dpkg.log.2, etc. with 1 being the most recent file. The older files will also likely be compressed and have the .gz' extension.

The log files are very verbose:

 2010-01-23 06:25:42 startup packages remove
 2010-01-23 06:25:42 status installed amarok-engine-xine 1.4.10-2
 2010-01-23 06:25:42 remove amarok-engine-xine 1.4.10-2 1.4.10-2
 2010-01-23 06:25:42 status half-configured amarok-engine-xine 1.4.10-2
 2010-01-23 06:25:42 status half-installed amarok-engine-xine 1.4.10-2
 2010-01-23 06:25:42 status config-files amarok-engine-xine 1.4.10-2
 2010-01-23 06:25:42 status config-files amarok-engine-xine 1.4.10-2
 2010-01-23 06:25:42 status config-files amarok-engine-xine 1.4.10-2
 2010-01-23 06:25:42 status not-installed amarok-engine-xine <none>
 2010-01-23 06:25:43 startup archives unpack
 2010-01-23 06:25:43 install amarok 1.4.10-2 2.2.2-1

But with a bit of Linux magic this can be reduced to only the most pertinent bits. Run these on the command line (in Konsole) to give you list of the packages installed since Mepis was first installed:

 zcat /var/log/dpkg.log*.gz > tmp
 cat /var/log/dpkg.log /var/log/dpkg.log.1 >> tmp
 grep " install " tmp > installed_packages.txt
 rm tmp

installed_packages.txt will now have a chronological (from earliest to newest) list of installed packages.

Method 2 is a clean way to explore last 12 months with any package installing activity (this limit is set in /etc/logrotate.d/dpkg). If you need even more, use method 1.

Personal tools
In other languages