11

Sometimes when installing a package, aptitude recommends several other packages.

Is there a way to show all previous recommended packages of all installed packages?

Edit:

Thanks for the replys so far. I already tried:

aptitude show ~i | grep '^Recommends' | cut -d ' ' -f 2-

Thats mostly ok. But it gives also things back like:

 console-setup | console-data (>= 2002.12.04dbs-1)

I want an easy way, to install all missing recommended packages.

So

 aptitude install console-setup | console-data (>= 2002.12.04dbs-1)

won't work ;-)

Is there a way, without manual checking all entries, to do this?

Alex.K.
  • 167
  • 2
  • 2
  • 8
casper
  • 499
  • 2
  • 5
  • 12

5 Answers5

12

Synaptic -> Custom Filters -> Missing Recommends

or

aptitude search '~RBrecommends:~i'

(thanks to http://blog.isonoe.net/post/2011/07/18/Debian-Tips-1%3A-Find-missing-recommended-packages)

Alan
  • 136
  • 1
  • 2
2

Get a list of installed packages with missing recommended package:

aptitude search '?installed?broken-recommends'

Get a list of not installed, missing packages that are recommended by installed packages - "missing recommends":

aptitude search '?broken-reverse-recommends(?installed)'

Get which package is recommending a specific "missing recommend":

aptitude search '?installed?broken-recommends(MISSING_PKG_NAME)'

One liner: For all "missing recommends", get by which packages are recommended:

for p in $(aptitude search -F%p '?broken-reverse-recommends(?installed)'); do echo $p; aptitude search "?installed?broken-recommends($p)"; done

You can find "missing recommends" in Synaptic package manager. (As I see, Synaptic shows also the missing Suggested packages.)

You can install all "missing recommends" with one command but I do not recommend it! First, review the list of packages before install. (For example, fresh install of debian buster shows missing "default-mta", which is a virtual package.)

apt install $(aptitude search -F%p '?broken-reverse-recommends(?installed)')

(This is summary from few similar questions. Hope it will help someone else.)

mmm
  • 21
  • 1
2

Maybe there's a more elegant way, but this works for me,

for package in $(dpkg --get-selections | grep -v deinstall | awk '{print $1}')
  do
    echo $package
    dpkg-query -s $package | grep Recommends
  done
EightBitTony
  • 9,211
  • 1
  • 32
  • 46
2

another suggestion:

awk '/(^Package|^Recomm)/' /var/lib/dpkg/status | grep -B1 ^Recommends

@EightBitTony: awk is also very good in searching, try this:

dpkg --get-selections | awk ' !/deinstall$/{print $1}'
ThorstenS
  • 3,084
  • 18
  • 21
2

Here my way - report for missing recommends :)

apt-cache --no-pre-depends --no-depends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances depends `dpkg --get-selections | grep '\sinstall$' | cut -f1` | grep -vf <(dpkg --get-selections | grep '\sinstall$' | cut -f1 | sed -e 's/^/ /' -e 's/\(:.*\|\)$/$/') | grep -B1 '^ '
mmm4m5m
  • 21
  • 2