aptitude - get missing "recommends" packages

Posted on 2004-11-10
Last Modified: 2009-12-16
Recently I started using aptitude on my debian system for package management. I'm using the command line aptitude (no UI).

I figured out the command to display all my installed packages that have missing "recommends" dependencies, and I'd like to know what command I could issue to aptitude if I wanted to install all those missing "recommends" packages. I think the command I did was "aptitude search ~i~Brecommends", so given that list of packages, is there any way to go through that lists "recommends" and install the ones that are missing? Reading though the aptitude user manual leads me to believe that this is most likely possible, although I'm a little confused at the small differences between all the different (but similar) search patterns if offers. Anyone know how I could accomplish this?

thanks for your help
Question by:nexisvi
    LVL 24

    Expert Comment

    Am not fully sure if that will work
    aptitude update (to update to all the package descriptiosn)
    aptitude -f install package  -s (to simulat what apt would do)
    if you feel it's the "right" thing
    aptitude -f install package

    Am not sure if -f allows for package but at least this is the option which tries to fix

    LVL 2

    Expert Comment

    From the help:

    --with(out)-recommends Specify whether or not to treat recommends as
                    strong dependencies

    So try something like this:
    aptitude --with-recommends install <package_name>

    note: it shouldn't matter if it is already installed because the recommended packages are now treated as strong dependancies, and aptitude should realize that the dependancies arent being met.

    Hope that is what you were looking for.

    Author Comment

    Thank-you both for your suggestions.  Unfortunately I'm still unable to install the outstanding "recommends" packages.  When I execute the command "aptitude search ~i~Rrecommends" it will list about 24 packages that I currently have installed on my system, which have recommends which aren't installed.  I can verify by doing a "aptitude show packagename" and look at the recommends section, then search for that package and see that it's not installed.  

    When I try something like "aptitude install -f packagename", to an installed package, it won't do anything (in simulation, it says nothing to install, upgrade, etc).  I also tried "aptitude install --with-recommends packagename", but the same thing, it won't install the recommends.  Now, I though maybe if I try reinstalling the packages with the --with-recommends or -f switches, maybe during the reinstallation it will pick up the recommends, but that doesn't seem to work either.

    ex.  "aptitude reinstall --with-recommends ~i~Brecommends -s" will simulate that it would install 24 new packages...which is exactly how many packages have missing "recommends" dependencies, but it just won't install their recommends.  It's weird, because when I install new packages, it will automatically pick up on the recommends.  
    LVL 24

    Expert Comment

    Then use apt-get
    apt-get -f package...


    It seems you dependencies are not broken..
    Well it seems as if the problem is a different one. So I restart.
    You have packages installed but those package do point to other
    *recommendes packages. So what you want is just install the packages

    so just type apt-get install package1 package2 package3

    The package list are the recommended packages.

    A recommend ist just a suggestion the package works fine without them.


    Author Comment

    I know I can manually type in the list of all the missing recommends, but that is tedious and will take a long time.  There must be some clever regexp or something that would allow me to send those "recommends" packages as the list of packages to be installed.  Hmmm, maybe I can output those packages to a text file then use that text file as input for an aptitude installation?  I'll try it anyway.
    LVL 24

    Expert Comment

    Of course that will work. you can try somehing

    apt-get install `(aptitude the_needed_command_to_get_the_recommends)` this will write a
    all the recommended packagea onto the standard output from whic apt-get can read it.

    the `are backticks.


    Author Comment

    The problem is that I want to konw the aptitude command to get the recommends.  I know the command to list the packages that have missing "recommends", but no command to list those actual packages themselves.  The only way I can currenly do it is to manually type "aptitude info a_package_with_missing_recommends" and then apt-get install those packages.  This would take forever.
    LVL 24

    Expert Comment

    well it would put out which package it would install but doesn't that is what I understand. Now what's the problem just take this package which are supposed to be installed and just runn
    apt-get install on them

    so e.g foo is among the list then you just type
    apt-get install foo

    What else do you need but the names of the 24 packages which are supposed to be installed?


    Author Comment

    What I mean is that I get a list of the 24 _already installed_ packages, which have missing 'recommends' dependencies.  Each of those might have 4 missing 'recommends' dependencies.  24X4 = 96 packages to manually install, which seems tedious to me.  If I can grab the names of the recommended packages that are displayed when I see the 'info' of one of the 24 packages, and toss those names to something like apt-install, at the same time, then it would solve my problem.
    LVL 24

    Expert Comment

    Ah now we are getting somewhere ;-)
    what's the output of
    aptitude reinstall --with-recommends ~i~Brecommends -s
    on you machine? Do you have an example for one of the packages?

    However I understand you know the names of the packages wihic missing recommend parts and you get the output. So what you can do is open an xterminal marking the shown packages you see and feed them into aptitude I assume something along this lines

    aptitude install -r package_names_you_want_to_have will do then.

    If that won't work I need at least the outpt and a hint what package you like to have installed


    Author Comment


    When I issue the command as you suggested above:
        aptitude reinstall --with-recommends ~i~Brecommends -s
    I get the following:
    The following packages will be REINSTALLED:
      aptitude defoma file-roller gnome-desktop-environment gnomemeeting gs-gpl
      gstreamer0.8-plugin-apps ibritish imlib-base kdeadmin kdebase kdenetwork
      kdvi kiten konsole kooka kpackage libaspell15 libatk1.0-0 libesd0
      libglib2.0-0 libpango1.0-common libpaper1 libpt-plugins-alsa librsvg2-2
      libsasl2 libwww-perl mozilla-browser nautilus-cd-burner python2.3 quanta
      reportbug w3m xmms
    if I issue the following:
        aptitude search ~i~Brecommends

    I get the same list as above (except with a description of these packages).

    Lets look at the aptitude package as an example:
        aptitude show aptitude
    Package: aptitude
    State: installed
    Automatically installed: no
    Priority: optional
    Section: admin
    Maintainer: Daniel Burrows <>
    Uncompressed Size: 4944k
    Depends: libapt-pkg-libc6.3-5-3.3, libc6 (>= 2.3.2.ds1-4), libgcc1 (>=
             1:3.4.1-3), libncurses5 (>= 5.4-1), libsigc++-1.2-5c102, libstdc++5
             (>= 1:3.3.4-1)
    Recommends: aptitude-doc-en | aptitude-doc
    Description: terminal-based apt frontend
     aptitude is a terminal-based apt frontend with a number of useful features,
     including: a mutt-like syntax for matching packages in a flexible manner,
     dselect-like persistence of user actions, the ability to retrieve and display
     the Debian changelog of most packages, and extreme flexibility and

     aptitude is also Y2K-compliant, non-fattening, naturally cleansing, and

    As you can see, this package recommends either aptitude-doc-en or aptitude doc.  I check, and I have neither of those packages installed.  If I try the command
        aptitude reinstall aptitude -r -s
    I get the following:
    The following packages will be REINSTALLED:

    For some reason, it completely ignores my request to install the recommends packages.  Recently, I did my usual command to upgrade my packages to the latest version:
        aptitude update
        aptitude upgrade -r

    only I get the following:
    The following packages will be upgraded:
      base-config discover1-data docbook-dsssl exim4 exim4-base exim4-config
      exim4-daemon-light fam gnome-core gnome-desktop-environment groff-base
      kernel-package kernel-source-2.6.8 klogd libfam0c102 libgtkhtml2-0
      libraw1394-5 libxine1 manpages manpages-dev menu menu-xdg mozilla-firefox
      nautilus-media ssh sysklogd tasksel usbutils xli xmms xprt-common
      xprt-xprintorg zlib1g
    The following packages are RECOMMENDED but will NOT be installed:
      dasher gnome-accessibility-themes gnome-mag gnopernicus gok libmikmod2
    33 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 58.0MB of archives. After unpacking 1298kB will be freed.
    Do you want to continue? [Y/n/?]

    Why do I have packages that are RECOMMENDED but aren't being installed, when I specified that I want to treat recommends as important.  I even tried using the -f switch to force it to resolve dependencies, etc.  Also, I tried dist-upgrade -r -f, etc.  If just won't automatically install certain recommended packages.  I can install them manually, so it isn't a dependency or conflict thing.  I'm confused, any ideas why I am experiencing this behaviour?
    LVL 24

    Accepted Solution

    Well if aptitude does not what it should do, I would qualify that as a bug. So you go to the Debian package pages and search for aptitude and see what bugs are listed.

    However you might try to write an apt.conf which contains the needed switch.
    After that you could try to use apt-get to install the packages you know there name because aptitude has told you. What happens if you use apt-get to install the packages?


    Author Comment

    I'm using the "testing" distribution, so the dependency problems with recommends that I'm running into must be a bug.  Anyway, the best solution seems to be to simply use apt-get to install the missing recommends packages manually.  Thanks for your help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now