[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


aptitude - get missing "recommends" packages

Posted on 2004-11-10
Medium Priority
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
  • 6
  • 6
LVL 24

Expert Comment

ID: 12563096
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


Expert Comment

ID: 12572111
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

ID: 12572240
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.  
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

LVL 24

Expert Comment

ID: 12572412
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

ID: 12574588
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

ID: 12581564
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

ID: 12600921
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

ID: 12605607
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

ID: 12605679
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

ID: 12612292
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

ID: 12640314

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 <dburrows@debian.org>
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

fridom earned 600 total points
ID: 12642623
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

ID: 12668649
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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

872 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