I am on an Ubuntu system that has the multiverse repository enabled, and I'd like to see whether I can disable it.

How can I check whether any package from multiverse is installed on the system?

  • It is not a duplicate. There, they mean a repository URL; multiverse is not a repository with a separate URL, but a section within a repository. The answer given there with aptitude doesn't work here; what may work is aptitude search '?section (multiverse) ?installed' – Reinier Post Sep 19 '19 at 21:47

Brute force:

dpkg --list | grep "^i" | awk '{print $2}' | while read P ; do D=$(apt-cache policy ${P} | grep "multiverse" | head -1) ; if [[ ${#D} -gt 0 ]] ; then echo "${P}:${D}" ; fi ; done
  • Seems to work, but is super slow. – mook765 Sep 19 '19 at 10:22
  • @mook765 Yes I've never seen a one-liner sooo sloowww. – WinEunuuchs2Unix Sep 19 '19 at 10:37
  • +1 doesn't matter to me that it's slow. It's easy to understand and effective. – user535733 Sep 19 '19 at 12:51
  • That is basically what I used today. It took over an hour to run, which I wasn't happy with, hence my question. It does work. – Reinier Post Sep 19 '19 at 20:48

The easiest way is in synaptic. Or you can use dpkg-query.

dpkg-query -W -f='${Section}\t\t${Package}\n' | grep -e ^multiverse

I revert my incorrect answer.

dpkg -l | awk '/^.i/ {print $2}' | xargs apt-cache policy | awk '/^[a-z0-9.\-]+:/ {pkg=$1}; /\*\*\*/ {OFS="\t"; ver=$2; getline; print pkg,ver,$2,$3}'|grep -v /var/lib/dpkg/status| sed -e 's/://'|awk '{printf "%-40s %-36s %-36s %-16s \n",$1,$2,$3, $4}' | grep multiverse
  • 1
    Nope, this command does not work correctly. – mook765 Sep 19 '19 at 10:21
  • I don't downvote very often but a broken one-liner anyone can quickly test deserves it. – WinEunuuchs2Unix Sep 19 '19 at 10:39
  • @mook why not? I'll try the solution from Wayne Vosberg and get the same two packages. – nobody Sep 19 '19 at 10:53
  • @nobody I get totally different results, also checked with synaptics shows that the command you provided doesn't seem to work correctly. Your command results in a single package for me, but this package is from universe. Section is not Origin. – mook765 Sep 19 '19 at 11:01
  • synaptic displays the origin, but I can't install it on a server. Where does it get its info from? – Reinier Post Sep 19 '19 at 21:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.