aptitude - get missing "recommends" packages

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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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.
nexisviAuthor Commented:
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.  
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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.

nexisviAuthor Commented:
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.
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.

nexisviAuthor Commented:
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.
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?

nexisviAuthor Commented:
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.
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

nexisviAuthor Commented:

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?
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?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nexisviAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.