David A. Harding on 19 Feb 2008 19:17:55 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Date a Debian package was installed


On Mon, Feb 18, 2008 at 05:47:00PM -0500, Darian Anthony Patrick wrote:
> Is there a command to inquire as to the date a package (or list of
> packages) was installed on a Debian/*buntu box?

The Debian Package System (dpkg) does not store the date a package was
installed, but if you haven't messed with the time stamps on your system
(for example, by restoring from a backup), you can find the install
date for every package installed on your system with the following
command line:

	ls /var/lib/dpkg/info/*.list -lh

Here's an example of the output:

        -rw-r--r-- 1 root root 2.9K 2006-09-30 14:26 /var/lib/dpkg/info/aalib1-dev.list
        -rw-r--r-- 1 root root  263 2007-04-08 12:42 /var/lib/dpkg/info/aalib1.list
        -rw-r--r-- 1 root root  687 2007-06-03 11:54 /var/lib/dpkg/info/abcde.list

Three notes before you depend on this information:

        1. The date displayed is the mtime of the .list file. mtime
           means modification time, so the date corresponds to the last
           time the package was updated.  Because of how dpkg installs
	   these files (overwriting them on each upgrade), there is no
           way to use any normal command to get the original
           installation date from the .list files.

        2. You may have .list files from packages you've removed. These
           files are only usually removed if you explicitly ask dpkg to
           purge a package during removal.

        3. GNU ls supports a maximum of 23,587 arguments[1]. I've never
           seen a Debian style system with more than about 2,500
           packages installed, but recent versions of Debian and
           Ubuntu include more than 24,000 packages, and it's possible
           (but unlikely) one system could have more than 23,587 dpkg
           .list files.

		[1] harda@callisto:~$ ls {1..23587} 2>&1 | head -n3
		    ls: 1: No such file or directory
		    ls: 2: No such file or directory
		    ls: 3: No such file or directory

		    harda@callisto:~$ ls {1..23588}                
		    bash: /bin/ls: Argument list too long
          
I hope that helps,

-Dave
-- 
David A. Harding            Website:  http://dtrt.org/
1 (609) 997-0765              Email:  dave@dtrt.org
                        Jabber/XMPP:  dharding@jabber.org
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug