Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: List manually installed packages?

  1. #1
    Join Date
    Jun 2006
    Beans
    156
    Distro
    Kubuntu 8.10 Intrepid Ibex

    List manually installed packages?

    So I'm planning on doing a clean install for 8.10 when it comes out. Only I want to know what all I've installed on my current system. I know dpkg --get-selections will list packages, but a lot of those are automatically installed dependencies. Apt keeps track of which packages were manually installed, because it tells me when there are cruft packages and I should run "apt-get autoremove". I've found two different ways of doing this but I'm not sure if either is right...

    Using APT:
    Code:
    cat /var/lib/apt/extended_states | grep -B 1 "Auto-Installed: 0" | grep "Package" | sed "s/Package: //"|sort > apt_manually-installed_packages.txt
    Using aptitude:
    Code:
    aptitude -F "%p" search \!~M~i~T > aptitude_manually-installed_packages.txt
    Unfortunately, both methods return completely different lists of packages which don't overlap. The aptitude list seems to include lots of libraries that I certainly didn't install manually, while the apt list seems far too short, only including KDE4 stuff. Is there a tool that can analyze the dependencies, and find all the packages that are not depended on by any other package, and thus probably manually installed? Or seriously, what is the best way to do this? Does apt-get have a way to list packages that were automatically installed?

  2. #2
    Join Date
    Jun 2006
    Location
    Gwangju, Korea
    Beans
    3,479

    Re: List manually installed packages?

    This is an issue that I've worked on off and on. To my knowledge, there are no tools to do this, and I've made several starts at writing a program to make such a list. So far, I don't have any working code.

    Here's the algorithm I propose:

    1. Parse /var/lib/dpkg/status. Store the name (e.g., in an array) of every package where line 2 is "Status: install ok installed"
    2. Parse /var/lib/apt/extended_states, and discard from the array every package that has an "Auto-Installed: 1" entry.
    3. What remains is the list you need.

    I'm asking this thread to be moved to the Programming Talk forum since you'll probably get better help there--given that there isn't already a program that does what you need.

  3. #3
    Join Date
    Jun 2008
    Beans
    6

    Re: List manually installed packages?

    This is something I always wanted. With your info provided, I managed to set up working code that implements your algorithm:

    Code:
    comm -23 <(cat /var/lib/dpkg/status | sed -n "/Package/N;s/Package: \(.*\)\n.*install ok installed/\1/p" | sort) <(cat /var/lib/apt/extended_states | sed -n "/Package/N;s/Package: \(.*\)\nAuto-Installed: 1/\1/p" | sort)
    The output is promising, but still the list includes many packages I know I haven’t installed manually. I have checked that those do not appear in extended_states, so they seem to have been installed automatically, but not by apt, my guess is during dist-upgrade.

  4. #4
    Join Date
    Jun 2008
    Beans
    6

    Re: List manually installed packages?

    Just noticed, the output is identical to the output of

    Code:
    aptitude -F "%p" search \!~M~i~T
    except that the latter includes those packages marked with "Essential: yes" in line 2 in dpkg/status (which on my system is only 24).

  5. #5
    Join Date
    Sep 2007
    Location
    Vienna
    Beans
    234

    Re: List manually installed packages?

    has there been any progress on this topic? this would be soo useful.

    obviously there is still some information missing between var/lib/dpkg/status and var/lib/apt/extended_states that is elsewhere, otherwise apt-get autoremove wouldn't work, right?
    As you can see from my history, i was once an enthusiastic ubuntu user. I would hereby like to assert that i no longer recommend using ubuntu to anyone. I recommend using one of the many distributions that do not include ad-/spyware by default.

  6. #6
    Join Date
    May 2008
    Location
    Netherlands
    Beans
    505
    Distro
    Xubuntu 9.04 Jaunty Jackalope

    Re: List manually installed packages?

    If you've got a list with installed packages you can easily use apt-get or aptitude to install them all. If they're already installed it won't matter, since they will be ignored then.
    Think for yourself. Don't let others do the thinking for you.
    guide to switch to ossv4 - same guide on this forum - comprehensive multimedia guide - optimizing firefox

  7. #7
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: List manually installed packages?

    Have a look at post #2 I made here:
    http://ubuntuforums.org/showthread.php?t=1194291

    You'll only want to use the installedpackages.sh script, not the apt-get purge and apt-get autoremove commands
    Cheesemill

  8. #8
    Join Date
    Sep 2007
    Location
    Vienna
    Beans
    234

    Re: List manually installed packages?

    Quote Originally Posted by Cheesemill View Post
    Have a look at post #2 I made here:
    http://ubuntuforums.org/showthread.php?t=1194291

    You'll only want to use the installedpackages.sh script, not the apt-get purge and apt-get autoremove commands
    thanks, that one is close, but still:

    packages i remember to have installed that are not listed:

    compizconfig-settings-manager
    exfalso
    firefox-3.5
    grsync
    network-manager-pptp
    rox-filer
    sauerbraten
    sylpheed
    ubuntu-restricted-extras

    packages i am quite sure i didn't manually install that are listed:

    gstreamer0.10-ffmpeg
    gstreamer0.10-pitfdll
    gstreamer0.10-plugins-bad
    gstreamer0.10-plugins-bad-multiverse
    gstreamer0.10-plugins-ugly
    gstreamer0.10-plugins-ugly-multiverse
    linux-headers-2.6.28-13
    linux-headers-2.6.28-13-generic
    linux-headers-2.6.28-14
    linux-headers-2.6.28-14-generic
    linux-image-2.6.28-13-generic
    linux-image-2.6.28-14-generic
    ttf-mscorefonts-installer
    unrar

    apart from the linux packages these are dependancies of (well, not really, they are recommended by) ubuntu-restricted-extras
    As you can see from my history, i was once an enthusiastic ubuntu user. I would hereby like to assert that i no longer recommend using ubuntu to anyone. I recommend using one of the many distributions that do not include ad-/spyware by default.

  9. #9
    Join Date
    Sep 2010
    Beans
    2

    Re: List manually installed packages?

    hi, with all your help i came to this (and solved my problem):

    Code:
    detect all packages installed since a specified date::
    
        fgrep ' status installed ' /var/log/dpkg.log | sort | awk '{if (substr($0, 1, 19) >= "2010-09-01 00:00:00") {print $5;}}' | sort | uniq > tmp-installed-after
    
    detect all packages installed before the specified date::
    
        fgrep ' status installed ' /var/log/dpkg.log | sort | awk '{if (substr($0, 1, 19) < "2010-09-01 00:00:00") {print $5;}}' | sort | uniq > tmp-installed-before
    
    detect all packages officially marked as auto-installed::
    
        fgrep -B1 "Auto-Installed: 1" /var/lib/apt/extended_states | fgrep "Package: " | sed "s/Package: //" | sort > tmp-autoinstalled
    
    compute manually installed packages since the specified date::
    
        comm -23 tmp-installed-after <(sort tmp-installed-before tmp-autoinstalled | uniq)
    p.s.: the date i choose was the date right after os installation


    many thanks

  10. #10
    Join Date
    Sep 2009
    Location
    Canada, Montreal QC
    Beans
    1,809
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: List manually installed packages?

    I think in synaptic there is a filter for that.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •