Ubuntu – How to determine which packages are part of a metapackage

16.04gnomemetapackagespackage-management

I am interested in taking a list of packages and figuring out which packages are part of a meta-package. That way, if I reinstall a new system I can limit my install to just the top level packages I need.

Has anyone written a script to do this sort of thing?

Best Answer

What you need is the dependencies of this meta-package. Keep in mind that when you install a package or meta-package using the software center or using the command sudo apt-get intstall PACKAGE_NAME the recommendations are installed too. You need to use sudo apt-get install --no-install-recommends PACKAGE_NAME if you want to install only the dependencies.

Let's take for example the lxde meta-package:

  1. You can use the command:

    apt-cache depends lxde
    
  2. Or you can search for lxde at synaptic package manager and right-click on it then choose Properties and see the Dependencies tab.

  3. Finally, the best way, in my opinion, is to search the meta-package you want here: http://packages.ubuntu.com/. For our example, the lxde meta-package is here: http://packages.ubuntu.com/xenial/lxde. Here you see both dependencies and recommendations (even the suggestions which are not installed by default) and if you click on a package you see its dependencies. If you click at the bottom of the page at the list of files link you will see that the meta-package doesn't include any important files itself (just a changelog.gz and a copyright file), unlike an actual package.