Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

HOWTO: How I learned to stop worrying and love metapackages

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
confuseling
Posts: 2121
Joined: 2009-10-21 01:03

HOWTO: How I learned to stop worrying and love metapackages

#1 Post by confuseling »

This document explains in a fairly comprehensive way the so called 'metapackage problem', where a package manager (usually aptitude) seems to want to uninstall half your system, and how to avoid it. If you understand what dependency tracking package management, autoremoval and metapackages are, you can probably skip to "Summary of the problem".

Package management

Debian, like the majority of modern Linux distributions, has a package management system which automatically resolves dependencies. A program that a user wants to use, which we shall call package X, doesn't need to include all the code or data it depends upon - it can specify its dependence on a supporting package or library, which we shall call library L. Since package X requires library L to function, the package manager will not allow package X to be installed if library L can't be.

Why not include everything needed in the same package? A program always has to rely on the platform's basic resources - you can't distribute a copy of the standard C library, or a UI widget toolkit, with every program. But even with higher level code, any attempt to make self-contained packages creates redundancy, increasing overall maintenance effort and system resource usage. It is easier to port a single copy of a library to a new architecture, or to update it on an established one, than to deal with many duplicates (or worse, near duplicates). It is better to occupy disk space, bandwidth and memory once, and present any potential mistakes - including security flaws - once. Division into minimally overlapping packages is a significant part of the reason why you can install a functional Linux system in a few gigabytes or less, and why a well configured and updated Linux system is considered comparatively secure.

Dependency tracking and automatic removal

Back to our example: if the user installs package X, library L will be installed automatically as a dependency. If library L has its own dependencies, and if those dependencies have further dependencies, and so forth, all will be installed automatically too. If the user then installs package Y, which also depends upon library L, the same code in library L and down its dependency chain is reused.

If the user now uninstalls package X, the package manager knows library L is still required; it will only be automatically removed once package Y is removed too. To be more precise, a package is marked to be removed automatically only once it is 'orphaned', which is to say that it and everything else further up its dependency chain - everything that depends upon it, however indirectly - was installed automatically.

This 'dependency tracking' is one of the major strengths of many Unix-like systems, but also a source of consternation for new users. Often, removing a package you don't want on Debian will lead to the package manager wanting to remove many programs you do want, such as a large part of GNOME. This is usually because these things were installed as part of the same metapackage, and is very easy to resolve once you understand what is happening.

Metapackages

Some packages are provided for convenience of installation for groups of packages (or packages that replace one another, providing fundamentally the same function, such as kernels), and don't actually do anything other than depend upon other packages - these are called metapackages. gnome is an example, weighing in at 50 odd kilobytes, and having no functional purpose in itself. If you install gnome, it tells the package manager to install all of the functional components of the GNOME desktop environment automatically as dependencies; the user is spared from having to worry about installing them individually. If the components of GNOME change, a new version of the gnome metapackage can change its dependencies; any that are no longer required will be automatically removed, and any new requirements will be automatically installed. Conversely, if you want to remove GNOME, you can just remove the metapackage, and the dependent parts will be removed as long as nothing else requires them.

The 'perverse' effect of this is that if you remove one of the components of gnome, gnome's dependencies are no longer satisfied, and since these dependencies are strict requirements, as far as the package manager is concerned this necessitates the removal of the metapackage. Packages that were installed as its dependencies, i.e. much of GNOME, will be orphaned and automatically removed. This is not what the user wants, but the package manager has no way of knowing that given the information it has - the user must either install something else which depends only upon the desired packages, or directly tell the package manager that they are still required, and should from now on be considered as having been installed manually.

Although keeping the rest of the dependencies is straightforward, note that because dependencies are strict, it is never possible to remove some of them without removing the metapackage itself. Convenience and modularity are traded off here, and the user has to decide when it is appropriate to sacrifice the administrative simplicity metapackages provide. Disk space is normally cheap, and it's often simpler to just hide undesired applications in the menus - see under 'Avoiding problems'.

Summary of the problem
  • Packages depend upon other packages, and dependencies are strict.
  • The package manager will install dependencies automatically, and will mark automatically installed dependencies which have lost all of their manually installed 'parents' to be automatically removed.
  • Metapackages are those that do nothing but depend upon other packages. If you remove one of their dependencies, you force the removal of the metapackage, 'orphaning' other dependencies. Unless you install other packages which depend upon them, or mark them as manually installed, they will be marked to be automatically removed.
The simple command line approach

Arguments in <angle brackets> are mandatory, those in [square brackets] are optional.

Let's say metapackage M was used to install package X and package Y. Package X is no longer required, but package Y is. We remove package X, without instructing the package manager to 'autoremove' any left over packages. If there is a smaller metapackage N, which depends upon package Y but not package X, we can simply install that instead. If there isn't, we individually mark package Y and any other components we need as having been installed manually. Finally, we clean up any left over packages.

I find the simplest way to do this from the command line is to rely on the default behaviours of apt-get and aptitude: aptitude runs the 'autoremove' step automatically, apt-get does not. So we can use apt-get to do some surgery, until aptitude reports that the system is in a consistent state.
  • Code: Select all

    apt-get remove <package X>
    
    Removes package X, which breaks and forces the removal of metapackage M, marking its dependencies as ready for automatic removal, but not actually removing them.
  • Code: Select all

    aptitude install -s
    
    Attempts to solve the present dependency situation, in practise here giving us a list of the packages that are currently marked for automatic removal - metapackage M's other dependencies. The '-s' is for simulate, so if you want to go ahead with aptitude's suggestion, you should remove it. 'apt-get autoremove -s' would have worked just as well.
  • If a smaller metapackage N exists, we install that:

    Code: Select all

    apt-get install <metapackage N>
    
    Even if it was already installed as part of metapackage M, this marks it as installed manually, rather than as a dependency. It and its dependencies are no longer marked for removal.
  • If there is no suitable smaller metapackage, or if there are other packages we still want to keep:

    Code: Select all

    apt-get install <package Y> [...]
    


    Marks package Y and any others listed as having been installed manually.

    Here, the key thing to remember is that as long as the dependencies are correctly specified by the packagers, the average user (which is to say someone who isn't compiling things from source or installing unpackaged binaries from outside Debian, etc.) should never have to care about libraries. If the user marks all of the user-visible applications they want to use as manually installed, their libraries will be kept automatically. What is left over is by definition unnecessary.

    In practise, when presented with a long list of packages for removal, only some of which are recognised, it's often simplest to chip away at them by 'installing' a few you want to keep at a time. As many libraries are shared between a great many programs, the list will dwindle quite quickly to something easier to take in fully.
  • One final:

    Code: Select all

    aptitude install
    
    To again list left over orphaned packages - this time without the '-s', because we want to actually remove them.
An example

In a Wheezy virtual machine, we:
  • Install gnome
  • Remove evolution, forcing the removal of gnome
  • Find out what components are marked for automatic removal
  • 'Install' gnome-core, a smaller metapackage
  • 'Install' other packages until the list of things scheduled for removal doesn't include anything we want to keep
  • Check everything is consistent, and remove left over packages

Code: Select all

root@debian-stable-vbox:~# aptitude install gnome
The following NEW packages will be installed:

... [lots of packages]

Accept this solution? [Y/n/q/?] y

The following NEW packages will be installed:

...
 
0 packages upgraded, 1060 newly installed, 0 to remove and 0 not upgraded.
Need to get 727 MB of archives. After unpacking 2,211 MB will be used.
Do you want to continue? [Y/n/?] y

...


root@debian-stable-vbox:~# apt-get remove evolution
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  evolution evolution-plugins gnome
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 7,309 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 135675 files and directories currently installed.)
Removing gnome ...
Removing evolution-plugins ...
Removing evolution ...
Processing triggers for gconf2 ...
Processing triggers for menu ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for man-db ...


root@debian-stable-vbox:~# aptitude install -s
The following NEW packages will be installed:
  evolution-plugins{b} gnome{b} 
The following packages will be REMOVED:
  bogofilter{u} bogofilter-bdb{u} bogofilter-common{u} evolution-common{u} evolution-webcal{u} 
0 packages upgraded, 2 newly installed, 5 to remove and 0 not upgraded.
Need to get 0 B/990 kB of archives. After unpacking 49.5 MB will be freed.
The following packages have unmet dependencies:
 evolution-plugins : Depends: evolution (= 3.4.4-3) but it is not going to be installed.
 gnome : Depends: evolution (>= 3.4) but it is not going to be installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     evolution-plugins [Not Installed]                  
2)     gnome [Not Installed]                              



Accept this solution? [Y/n/q/?] y
The following packages will be REMOVED:
  aisleriot{u} ant{u} ant-optional{u} argyll{u} at-spi2-core{u} baobab{u} bogofilter{u} bogofilter-bdb{u} bogofilter-common{u} browser-plugin-gnash{u} ca-certificates-java{u} 
  caribou{u} caribou-antler{u} cheese{u} crda{u} dconf-tools{u} default-jre{u} default-jre-headless{u} dnsmasq-base{u} empathy{u} empathy-common{u} espeak-data{u} 
  evolution-common{u} evolution-webcal{u} file-roller{u} finger{u} fonts-cantarell{u} fonts-lyx{u} fonts-opensymbol{u} fonts-sil-gentium{u} fonts-sil-gentium-basic{u} 
  gcalctool{u} gdebi{u} gdm3{u} gedit{u} gedit-common{u} gedit-plugins{u} gir1.2-atspi-2.0{u} gir1.2-gdata-0.0{u} gir1.2-gnomekeyring-1.0{u} gir1.2-goa-1.0{u} 
  gir1.2-gtop-2.0{u} gir1.2-gucharmap-2.90{u} gir1.2-javascriptcoregtk-3.0{u} gir1.2-rb-3.0{u} gir1.2-tracker-0.14{u} gir1.2-vte-2.90{u} gir1.2-webkit-3.0{u} 
  gir1.2-wnck-3.0{u} glchess{u} glines{u} gnash{u} gnash-common{u} gnect{u} gnibbles{u} gnobots2{u} gnome-backgrounds{u} gnome-color-manager{u} gnome-core{u} 
  gnome-dictionary{u} gnome-disk-utility{u} gnome-documents{u} gnome-font-viewer{u} gnome-games{u} gnome-games-data{u} gnome-games-extra-data{u} gnome-icon-theme-extras{u} 
  gnome-mag{u} gnome-nettool{u} gnome-orca{u} gnome-packagekit{u} gnome-packagekit-data{u} gnome-screenshot{u} gnome-shell-extensions{u} gnome-sudoku{u} gnome-system-log{u} 
  gnome-tweak-tool{u} gnome-video-effects{u} gnomine{u} gnotravex{u} gnotski{u} gnuchess{u} gnuchess-book{u} grilo-plugins-0.1{u} gtali{u} gucharmap{u} guile-2.0-libs{u} 
  hamster-applet{u} iagno{u} icedtea-6-jre-cacao{u} icedtea-6-jre-jamvm{u} icedtea-netx{u} icedtea-netx-common{u} inkscape{u} iputils-tracepath{u} iw{u} java-common{u} 
  libapache-pom-java{u} libatk-adaptor{u} libatk-adaptor-data{u} libatk-bridge2.0-0{u} libatk-wrapper-java{u} libatk-wrapper-java-jni{u} libatspi1.0-0{u} libatspi2.0-0{u} 
  libavahi-gobject0{u} libavahi-ui-gtk3-0{u} libblas3gf{u} libboost-program-options1.49.0{u} libboost-thread1.49.0{u} libbrlapi0.5{u} libcaribou-gtk-module{u} 
  libcaribou-gtk3-module{u} libchamplain-0.12-0{u} libchamplain-gtk-0.12-0{u} libcmis-0.2-0{u} libcolamd2.7.1{u} libcolorblind0{u} libcommons-beanutils-java{u} 
  libcommons-collections3-java{u} libcommons-compress-java{u} libcommons-digester-java{u} libcommons-logging-java{u} libcommons-parent-java{u} libdb-java{u} libdb-je-java{u} 
  libdb5.1-java{u} libdb5.1-java-jni{u} libdee-1.0-4{u} libdiscid0{u} libdmapsharing-3.0-2{u} libdotconf1.0{u} libespeak1{u} libevolution{u} libexttextcat-data{u} 
  libexttextcat0{u} libgail-common{u} libgdict-1.0-6{u} libgdict-common{u} libgdu-gtk0{u} libgeocode-glib0{u} libgexiv2-1{u} libgnome-mag2{u} libgpod-common{u} libgpod4{u} 
  libgraphite2-2.0.0{u} libgrilo-0.1-0{u} libgsl0ldbl{u} libgtk-vnc-2.0-0{u} libgtkhtml-4.0-0{u} libgtkhtml-4.0-common{u} libgtkhtml-editor-4.0-0{u} libgtkmm-2.4-1c2a{u} 
  libgupnp-av-1.0-2{u} libgupnp-dlna-1.0-2{u} libgvnc-1.0-0{u} libhsqldb-java{u} libhyphen0{u} libicc2{u} libicu4j-java{u} libimdi0{u} libjaxp1.3-java{u} libjim0debian2{u} 
  libjline-java{u} libjtidy-java{u} liblinear-tools{u} liblinear1{u} liblouis-data{u} liblouis2{u} liblucene2-java{u} libmagick++5{u} libminiupnpc5{u} libmtp-common{u} 
  libmtp-runtime{u} libmtp9{u} libmythes-1.2-0{u} libnatpmp1{u} libnetfilter-conntrack3{u} libnl-3-200{u} libnl-genl-3-200{u} libnl-route-3-200{u} libplot2c2{u} libpst4{u} 
  libpstoedit0c2a{u} libraw5{u} libreadline5{u} libregexp-java{u} libreoffice{u} libreoffice-base{u} libreoffice-base-core{u} libreoffice-calc{u} libreoffice-common{u} 
  libreoffice-core{u} libreoffice-draw{u} libreoffice-emailmerge{u} libreoffice-filter-binfilter{u} libreoffice-filter-mobiledev{u} libreoffice-gnome{u} libreoffice-gtk{u} 
  libreoffice-impress{u} libreoffice-java-common{u} libreoffice-math{u} libreoffice-report-builder-bin{u} libreoffice-style-galaxy{u} libreoffice-style-tango{u} 
  libreoffice-writer{u} librhythmbox-core6{u} libservlet2.5-java{u} libsofia-sip-ua-glib3{u} libsofia-sip-ua0{u} libsonic0{u} libspeechd2{u} libsvm-tools{u} 
  libtelepathy-farstream2{u} libunique-3.0-0{u} libvisio-0.0-0{u} libwnck-common{u} libwnck22{u} libwpd-0.9-9{u} libwpg-0.2-2{u} libwps-0.2-2{u} libxalan2-java{u} 
  libxerces2-java{u} libxml-commons-external-java{u} libxml-commons-resolver1.1-java{u} libxss1{u} libxz-java{u} lightsoff{u} lp-solve{u} mahjongg{u} media-player-info{u} 
  minissdpd{u} mobile-broadband-provider-info{u} modemmanager{u} nautilus-sendto-empathy{u} network-manager{u} network-manager-gnome{u} nmap{u} openjdk-6-jre{u} 
  openjdk-6-jre-headless{u} openjdk-6-jre-lib{u} p7zip-full{u} perlmagick{u} pstoedit{u} python-brlapi{u} python-gconf{u} python-gnome2{u} python-louis{u} python-mako{u} 
  python-markupsafe{u} python-notify{u} python-pyatspi{u} python-pyatspi2{u} python-pyorbit{u} python-speechd{u} python-uno{u} python-wnck{u} python-zeitgeist{u} 
  quadrapassel{u} rdesktop{u} rhythmbox{u} rhythmbox-data{u} rhythmbox-plugin-cdrecorder{u} rhythmbox-plugins{u} rygel{u} rygel-playbin{u} rygel-preferences{u} 
  rygel-tracker{u} seahorse{u} shotwell{u} shotwell-common{u} simple-scan{u} sound-juicer{u} sound-theme-freedesktop{u} speech-dispatcher{u} swell-foop{u} telepathy-gabble{u} 
  telepathy-idle{u} telepathy-logger{u} telepathy-rakia{u} telepathy-salut{u} transmission-common{u} transmission-gtk{u} ttf-liberation{u} ttf-sil-gentium-basic{u} 
  tzdata-java{u} uno-libs3{u} unoconv{u} ure{u} usb-modeswitch{u} usb-modeswitch-data{u} vinagre{u} vino{u} wireless-regdb{u} wpasupplicant{u} xbrlapi{u} xdg-user-dirs-gtk{u} 
  xfonts-mathml{u} xul-ext-adblock-plus{u} zeitgeist-core{u} 
0 packages upgraded, 0 newly installed, 300 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 1,006 MB will be freed.
Do you want to continue? [Y/n/?] n
Abort.


root@debian-stable-vbox:~# apt-get install gnome-core gnome-shell-extensions
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gnome-shell-extensions is already the newest version.
gnome-shell-extensions set to manually installed.
gnome-core is already the newest version.
gnome-core set to manually installed.
The following packages were automatically installed and are no longer required:
  aisleriot ant ant-optional argyll bogofilter bogofilter-bdb bogofilter-common browser-plugin-gnash ca-certificates-java cheese default-jre default-jre-headless
  evolution-common evolution-webcal file-roller finger fonts-lyx fonts-opensymbol fonts-sil-gentium fonts-sil-gentium-basic gdebi gedit gedit-common gedit-plugins
  gir1.2-gdata-0.0 gir1.2-gnomekeyring-1.0 gir1.2-goa-1.0 gir1.2-gucharmap-2.90 gir1.2-javascriptcoregtk-3.0 gir1.2-rb-3.0 gir1.2-tracker-0.14 gir1.2-vte-2.90 gir1.2-webkit-3.0
  glchess glines gnash gnash-common gnect gnibbles gnobots2 gnome-color-manager gnome-documents gnome-games gnome-games-data gnome-games-extra-data gnome-nettool gnome-sudoku
  gnome-tweak-tool gnome-video-effects gnomine gnotravex gnotski gnuchess gnuchess-book grilo-plugins-0.1 gtali guile-2.0-libs hamster-applet iagno icedtea-6-jre-cacao
  icedtea-6-jre-jamvm icedtea-netx icedtea-netx-common inkscape iputils-tracepath java-common libapache-pom-java libatk-wrapper-java libatk-wrapper-java-jni libblas3gf
  libboost-program-options1.49.0 libboost-thread1.49.0 libcmis-0.2-0 libcolamd2.7.1 libcommons-beanutils-java libcommons-collections3-java libcommons-compress-java
  libcommons-digester-java libcommons-logging-java libcommons-parent-java libdb-java libdb-je-java libdb5.1-java libdb5.1-java-jni libdee-1.0-4 libdiscid0 libdmapsharing-3.0-2
  libevolution libexttextcat-data libexttextcat0 libgexiv2-1 libgpod-common libgpod4 libgraphite2-2.0.0 libgrilo-0.1-0 libgsl0ldbl libgtkhtml-4.0-0 libgtkhtml-4.0-common
  libgtkhtml-editor-4.0-0 libgtkmm-2.4-1c2a libgupnp-av-1.0-2 libgupnp-dlna-1.0-2 libhsqldb-java libhyphen0 libicc2 libicu4j-java libimdi0 libjaxp1.3-java libjline-java
  libjtidy-java liblinear-tools liblinear1 liblucene2-java libmagick++5 libminiupnpc5 libmtp-common libmtp-runtime libmtp9 libmythes-1.2-0 libnatpmp1 libplot2c2 libpst4
  libpstoedit0c2a libraw5 libregexp-java libreoffice libreoffice-base libreoffice-base-core libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw
  libreoffice-emailmerge libreoffice-filter-binfilter libreoffice-filter-mobiledev libreoffice-gnome libreoffice-gtk libreoffice-impress libreoffice-java-common libreoffice-math
  libreoffice-report-builder-bin libreoffice-style-galaxy libreoffice-style-tango libreoffice-writer librhythmbox-core6 libservlet2.5-java libsofia-sip-ua-glib3 libsofia-sip-ua0
  libsvm-tools libvisio-0.0-0 libwnck-common libwnck22 libwpd-0.9-9 libwpg-0.2-2 libwps-0.2-2 libxalan2-java libxerces2-java libxml-commons-external-java
  libxml-commons-resolver1.1-java libxss1 libxz-java lightsoff lp-solve mahjongg media-player-info minissdpd nmap openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
  p7zip-full perlmagick pstoedit python-gconf python-gnome2 python-mako python-markupsafe python-notify python-pyorbit python-uno python-wnck python-zeitgeist quadrapassel
  rhythmbox rhythmbox-data rhythmbox-plugin-cdrecorder rhythmbox-plugins rygel rygel-playbin rygel-preferences rygel-tracker seahorse shotwell shotwell-common simple-scan
  sound-juicer swell-foop telepathy-rakia transmission-common transmission-gtk ttf-liberation ttf-sil-gentium-basic tzdata-java uno-libs3 unoconv ure xdg-user-dirs-gtk
  xfonts-mathml xul-ext-adblock-plus zeitgeist-core
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


root@debian-stable-vbox:~# apt-get install libreoffice gnome-games cheese gdebi gedit rhythmbox shotwell
Reading package lists... Done
Building dependency tree       
Reading state information... Done
cheese is already the newest version.
cheese set to manually installed.
gdebi is already the newest version.
gdebi set to manually installed.
gedit is already the newest version.
gedit set to manually installed.
gnome-games is already the newest version.
gnome-games set to manually installed.
libreoffice is already the newest version.
libreoffice set to manually installed.
rhythmbox is already the newest version.
rhythmbox set to manually installed.
shotwell is already the newest version.
shotwell set to manually installed.
The following packages were automatically installed and are no longer required:
  argyll bogofilter bogofilter-bdb bogofilter-common browser-plugin-gnash evolution-common evolution-webcal file-roller finger gir1.2-gdata-0.0 gir1.2-goa-1.0
  gir1.2-tracker-0.14 gnash gnash-common gnome-color-manager gnome-documents gnome-nettool gnome-tweak-tool hamster-applet inkscape iputils-tracepath libblas3gf
  libboost-program-options1.49.0 libboost-thread1.49.0 libevolution libgsl0ldbl libgtkhtml-4.0-0 libgtkhtml-4.0-common libgtkhtml-editor-4.0-0 libgtkmm-2.4-1c2a
  libgupnp-dlna-1.0-2 libicc2 libimdi0 liblinear-tools liblinear1 libminiupnpc5 libnatpmp1 libpst4 libsofia-sip-ua-glib3 libsofia-sip-ua0 libsvm-tools libwnck-common libwnck22
  libxss1 minissdpd nmap p7zip-full perlmagick python-gconf python-gnome2 python-notify python-pyorbit python-wnck rygel rygel-playbin rygel-preferences rygel-tracker seahorse
  simple-scan sound-juicer telepathy-rakia transmission-common transmission-gtk unoconv xdg-user-dirs-gtk xul-ext-adblock-plus
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


root@debian-stable-vbox:~# apt-get install gnome-documents inkscape seahorse
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gnome-documents is already the newest version.
gnome-documents set to manually installed.
inkscape is already the newest version.
inkscape set to manually installed.
seahorse is already the newest version.
seahorse set to manually installed.
The following packages were automatically installed and are no longer required:
  argyll bogofilter bogofilter-bdb bogofilter-common browser-plugin-gnash evolution-common evolution-webcal file-roller finger gnash gnash-common gnome-color-manager
  gnome-nettool gnome-tweak-tool hamster-applet iputils-tracepath libblas3gf libboost-program-options1.49.0 libboost-thread1.49.0 libevolution libgtkhtml-4.0-0
  libgtkhtml-4.0-common libgtkhtml-editor-4.0-0 libgupnp-dlna-1.0-2 libicc2 libimdi0 liblinear-tools liblinear1 libminiupnpc5 libnatpmp1 libpst4 libsofia-sip-ua-glib3
  libsofia-sip-ua0 libsvm-tools libwnck-common libwnck22 libxss1 minissdpd nmap p7zip-full python-gconf python-gnome2 python-notify python-pyorbit python-wnck rygel
  rygel-playbin rygel-preferences rygel-tracker simple-scan sound-juicer telepathy-rakia transmission-common transmission-gtk xdg-user-dirs-gtk xul-ext-adblock-plus
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


root@debian-stable-vbox:~# aptitude install -s
The following NEW packages will be installed:
  evolution-plugins{b} gnome{b} 
The following packages will be REMOVED:
  bogofilter{u} bogofilter-bdb{u} bogofilter-common{u} evolution-common{u} evolution-webcal{u} 
0 packages upgraded, 2 newly installed, 5 to remove and 0 not upgraded.
Need to get 0 B/990 kB of archives. After unpacking 49.5 MB will be freed.
The following packages have unmet dependencies:
 evolution-plugins : Depends: evolution (= 3.4.4-3) but it is not going to be installed.
 gnome : Depends: evolution (>= 3.4) but it is not going to be installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     evolution-plugins [Not Installed]                  
2)     gnome [Not Installed]                              



Accept this solution? [Y/n/q/?] y
The following packages will be REMOVED:
  argyll{u} bogofilter{u} bogofilter-bdb{u} bogofilter-common{u} browser-plugin-gnash{u} evolution-common{u} evolution-webcal{u} file-roller{u} finger{u} gnash{u} 
  gnash-common{u} gnome-color-manager{u} gnome-nettool{u} gnome-tweak-tool{u} hamster-applet{u} iputils-tracepath{u} libblas3gf{u} libboost-program-options1.49.0{u} 
  libboost-thread1.49.0{u} libevolution{u} libgtkhtml-4.0-0{u} libgtkhtml-4.0-common{u} libgtkhtml-editor-4.0-0{u} libgupnp-dlna-1.0-2{u} libicc2{u} libimdi0{u} 
  liblinear-tools{u} liblinear1{u} libminiupnpc5{u} libnatpmp1{u} libpst4{u} libsofia-sip-ua-glib3{u} libsofia-sip-ua0{u} libsvm-tools{u} libwnck-common{u} libwnck22{u} 
  libxss1{u} minissdpd{u} nmap{u} p7zip-full{u} python-gconf{u} python-gnome2{u} python-notify{u} python-pyorbit{u} python-wnck{u} rygel{u} rygel-playbin{u} 
  rygel-preferences{u} rygel-tracker{u} simple-scan{u} sound-juicer{u} telepathy-rakia{u} transmission-common{u} transmission-gtk{u} xdg-user-dirs-gtk{u} 
  xul-ext-adblock-plus{u} 
0 packages upgraded, 0 newly installed, 56 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 149 MB will be freed.
Do you want to continue? [Y/n/?] n
Abort.


root@debian-stable-vbox:~# aptitude install
The following NEW packages will be installed:
  evolution-plugins{b} gnome{b} 
The following packages will be REMOVED:
  bogofilter{u} bogofilter-bdb{u} bogofilter-common{u} evolution-common{u} evolution-webcal{u} 
0 packages upgraded, 2 newly installed, 5 to remove and 0 not upgraded.
Need to get 0 B/990 kB of archives. After unpacking 49.5 MB will be freed.
The following packages have unmet dependencies:
 evolution-plugins : Depends: evolution (= 3.4.4-3) but it is not going to be installed.
 gnome : Depends: evolution (>= 3.4) but it is not going to be installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     evolution-plugins [Not Installed]                  
2)     gnome [Not Installed]                              



Accept this solution? [Y/n/q/?] y
The following packages will be REMOVED:
  argyll{u} bogofilter{u} bogofilter-bdb{u} bogofilter-common{u} browser-plugin-gnash{u} evolution-common{u} evolution-webcal{u} file-roller{u} finger{u} gnash{u} 
  gnash-common{u} gnome-color-manager{u} gnome-nettool{u} gnome-tweak-tool{u} hamster-applet{u} iputils-tracepath{u} libblas3gf{u} libboost-program-options1.49.0{u} 
  libboost-thread1.49.0{u} libevolution{u} libgtkhtml-4.0-0{u} libgtkhtml-4.0-common{u} libgtkhtml-editor-4.0-0{u} libgupnp-dlna-1.0-2{u} libicc2{u} libimdi0{u} 
  liblinear-tools{u} liblinear1{u} libminiupnpc5{u} libnatpmp1{u} libpst4{u} libsofia-sip-ua-glib3{u} libsofia-sip-ua0{u} libsvm-tools{u} libwnck-common{u} libwnck22{u} 
  libxss1{u} minissdpd{u} nmap{u} p7zip-full{u} python-gconf{u} python-gnome2{u} python-notify{u} python-pyorbit{u} python-wnck{u} rygel{u} rygel-playbin{u} 
  rygel-preferences{u} rygel-tracker{u} simple-scan{u} sound-juicer{u} telepathy-rakia{u} transmission-common{u} transmission-gtk{u} xdg-user-dirs-gtk{u} 
  xul-ext-adblock-plus{u} 
0 packages upgraded, 0 newly installed, 56 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 149 MB will be freed.
Do you want to continue? [Y/n/?] y
(Reading database ... 135573 files and directories currently installed.)
Removing argyll ...
Removing bogofilter ...
Removing bogofilter-bdb ...
Removing bogofilter-common ...
Removing browser-plugin-gnash ...
Removing evolution-common ...
Removing evolution-webcal ...
Removing file-roller ...
Removing gnome-nettool ...
Removing finger ...
Removing gnash ...
Removing gnash-common ...
Removing gnome-color-manager ...
Removing gnome-tweak-tool ...
Removing hamster-applet ...
Removing iputils-tracepath ...
Removing libblas3gf ...
Removing libboost-program-options1.49.0 ...
Removing libboost-thread1.49.0 ...
Removing libevolution ...
Removing libgtkhtml-editor-4.0-0 ...
Removing libgtkhtml-4.0-0 ...
Removing libgtkhtml-4.0-common ...
Removing rygel-tracker ...
Removing rygel-preferences ...
Removing rygel-playbin ...
Removing rygel ...
Removing libgupnp-dlna-1.0-2 ...
Removing libicc2:amd64 ...
Removing libimdi0:amd64 ...
Removing liblinear-tools ...
Removing nmap ...
Removing liblinear1 ...
Removing transmission-gtk ...
Removing libminiupnpc5 ...
Removing libnatpmp1 ...
Removing libpst4:amd64 ...
Removing telepathy-rakia ...
Removing libsofia-sip-ua-glib3 ...
Removing libsofia-sip-ua0 ...
Removing libsvm-tools ...
Removing python-wnck ...
Removing libwnck22 ...
Removing libwnck-common ...
Removing libxss1:amd64 ...
Removing minissdpd ...
Removing p7zip-full ...
Removing python-gnome2 ...
Removing python-gconf ...
Removing python-notify ...
Removing python-pyorbit ...
Removing simple-scan ...
Removing sound-juicer ...
Removing transmission-common ...
Removing xdg-user-dirs-gtk ...
Removing xul-ext-adblock-plus ...
Processing triggers for man-db ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for libglib2.0-0:amd64 ...
Processing triggers for gconf2 ...
Processing triggers for menu ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for shared-mime-info ...
Processing triggers for install-info ...
Processing triggers for mime-support ...
Processing triggers for python-support ...

Aptitude's ncurses interface

Another approach is to use aptitude's powerful visual interface. It takes a small amount of getting used to, but is very much worth the trouble. You can find documentation in /usr/share/doc/aptitude, having installed the aptitude-doc-en package, or at http://www.algebraicthunk.net/~dburrows ... de/doc/en/

A synopsis:
  • Run 'aptitude' without arguments at a root prompt
  • Hit '/', and type the name of the package you want to remove. 'n' and shift-'n' to repeat search in either direction.
  • Select it in the list, and hit '-', then 'g' and 'g' again to remove it
  • Hit 'g' again to list the packages scheduled for removal
  • Scroll through the list hitting '+' to mark those required as manually installed
  • Once happy, hit 'g' to implement the changes
Avoiding the issue

There are several ways to circumvent autoremoval, but it is a useful feature, so these are not recommended. Accumulating unnecessary packages is a waste of disk space and bandwidth, and will needlessly complicate future package upgrades and installations.
  • Turning autoremove off:

    For aptitude, if you set:

    Code: Select all

    Aptitude::Delete-Unused "False";
    
    In /root/.aptitude/config, or for apt-get:

    Code: Select all

    APT::Get::AutomaticRemove "0";
    
    In /etc/apt.conf (n.b., this is the default anyway), autoremove is never going to run automatically.
  • The nuclear option:

    Code: Select all

    aptitude keep-all
    
    Marks all currently installed packages as manually installed. Should only be used if you really know what you're doing.
  • The tactical nuclear option:

    Code: Select all

    aptitude unmarkauto "?reverse-depends(<metapackage>) | ?reverse-recommends(<metapackage>)"
    
    Recursively marks the installed dependencies (and recommended packages) for that specific metapackage as manually installed. Better than the nuclear option, but often still far from ideal.
Avoiding problems
  • Use the netinst iso for installations. Deselect everything at the Tasksel menu (I leave 'laptop' selected if I'm using a laptop). The resultant system is a good minimal starting place.
  • Some prefer to tell apt-get and aptitude not to install recommended packages by default. Put:

    Code: Select all

    APT::Install-Recommends "False";
    
    In /etc/apt.conf. Alternatively, if you prefer to usually install recommendations, you can override the setting temporarily - for example when installing larger metapackages - using either:

    Code: Select all

    aptitude install -R <metapackage>
    
    Or:

    Code: Select all

    apt-get install --no-install-recommends <metapackage>
    
  • You can copy an unwanted application's desktop file from /usr/share/applications to ~/.local/share/applications and add the "NoDisplay=true" key to remove it from the menus. Note that you'll need to mirror the subdirectory structure found in /usr/share/applications for this to work, e.g. if the distribution's desktop file is in the kde4 subdirectory, yours should be too.
  • To find out what installed packages depend upon something, you can use:

    Code: Select all

    aptitude search "?and(?depends(<package>), ?installed)"
    
    And to find out why Aptitude is selecting the dependencies it selects, try:

    Code: Select all

    aptitude -o Debug::pkgDepCache::AutoInstall=1 install -s <metapackage>
    
  • Rather than digging through logfiles in /var/log/apt/ or /var/log/aptitude, you can record a specific transaction using 'script' or 'tee'. For example;

    Code: Select all

    aptitude install <metapackage> | tee metapackage.txt
    
  • For very lightweight systems, consider trying a standalone window manager instead of a full-fledged desktop environment like GNOME, KDE or Xfce. Some of them are very usable.
  • Consider using virtualisation software such as VirtualBox for experiments. It's very handy having a safe sandbox, and being able to restore it to a known state quickly and without disruption.
Last edited by confuseling on 2014-06-19 23:01, edited 74 times in total.
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: HOWTO: How I learned to stop worrying and love metapacka

#2 Post by milomak »

great guide
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

emariz
Posts: 2901
Joined: 2008-10-17 07:59

Re: HOWTO: How I learned to stop worrying and love metapacka

#3 Post by emariz »

Some messages that you may find useful:

On the importance of meta-packages:
http://forums.debian.net/viewtopic.php?p=244429#p244429
http://forums.debian.net/viewtopic.php?p=497442#p497442

On meta-packages:
http://forums.debian.net/viewtopic.php?p=405215#p405215
http://forums.debian.net/viewtopic.php?p=497411#p497411
I find it useful to introduce the concepts of "levels" or "layers" of a dependency chain, for one needs to recognise "tier 1", core packages when removing a general package, like a meta-package.

On removing a meta-package:
http://forums.debian.net/viewtopic.php?p=495732#p495732
http://forums.debian.net/viewtopic.php?p=229212#p229212

Reconstructing the meta-package gnome-core (in Squeeze):
http://forums.debian.net/viewtopic.php?p=336556#p336556

An upgrade from Squeeze to Wheezy:
http://forums.debian.net/viewtopic.php?p=497187#p497187

I use Squeeze, all Backports, Debian Mozilla and Deb Multimedia, and there were only three easy-to-solve issues during the upgrade. I am positive that this is a direct result of maintaining a coherent dependency chain while building the system.
Last edited by emariz on 2013-06-25 15:24, edited 1 time in total.

confuseling
Posts: 2121
Joined: 2009-10-21 01:03

Re: HOWTO: How I learned to stop worrying and love metapacka

#4 Post by confuseling »

Thanks milomak.

emariz: there's a fair bit of reading I've got to get through... :-)

I think the first post is long enough already, and I will probably only correct it, rather than add to it. If I can come up with enough material to write a follow up, I will, but equally if you want to distil your thoughts yourself, it would make a very welcome addition to the thread.
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: HOWTO: How I learned to stop worrying and love metapacka

#5 Post by llivv »

Being mostly a minimalist, I've stayed away from big meta packages
like xorg, kde-full and gnome, to list a few.
I use aptitude in visual mode almost exclusively.
ever since I switched from dselect about 7 years ago.
dselect to aptitude:
While learning how to install and configure xfree using dselect and just starting to get the hang of it
I was informed in this forum that dselect was depreciated for aptitude.
Greatful for this info I made the painful switch immediately. 7 years later I still learn new
ways to use aptitude and new hot key shortcuts that drastically
reduce the time needed to manage deb upgrades installs removal purges edit: and breakage

both within and between releases.
Aptitudes dependency resolver is a a work of art imo.
And I use it to learn how I can resolve dependencies of a simple nature
while it does the heavy lifting for me.
Apt is also a very powerful tool and does everything aptitude does
as well as a few things aptitude doesn't, once it is learned how to tell it what to do.
Dpkg is what it is, the back end and bottom line.
But we already know some of these parts to the packaging puzzle,
as well as how tight the learning curve can be when reading the documentation.
7 years and I'm still learning new things about the one tool I use the most.
Is that saying anything?
Daniel, I salute you
as I salute the ones that came before.
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

confuseling
Posts: 2121
Joined: 2009-10-21 01:03

Re: HOWTO: How I learned to stop worrying and love metapacka

#6 Post by confuseling »

I agree, aptitude is awesome, and aptitude's visual mode especially so. It took me a long time (and emariz harping on about it constantly :-) ) to bother trying the latter, but it makes things much easier.

I'm grumpy now, because I've realised I should have called the thread:

Dr. Metapackage
or:
How I Learned to Stop Worrying and Love the Bloat

:mrgreen:
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here

woodscroller
Posts: 21
Joined: 2013-06-14 07:20

Re: HOWTO: How I learned to stop worrying and love metapacka

#7 Post by woodscroller »

confuseling wrote: * For very lightweight systems, consider trying a standalone window manager instead of a full-fledged desktop environment like GNOME, KDE or Xfce. Some of them are very usable.

* Consider using virtualisation software such as VirtualBox for experiments. It's very handy having a safe sandbox, and being able to restore it to a known state quickly and without disruption.


Nicely written guide. Thanks for taking the time to do so.

I'm not completly new to GNU/Linux but, I've been a long time Ubuntu user. Meaning, I didn't really crawl under the hood and turn any wrenches... well, some, but problems I ran into were pretty well covered by the multitude of others on their forum and fan-boy sites alike.

The goal now is to run a stripped down, lean & mean version of Debian, so I'm approaching it with virtualbox. In the interim, I'll have Wheezy chugging along to get past the hurdles I'll run into!
~Steve

Jessie - xfce4

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: HOWTO: How I learned to stop worrying and love metapacka

#8 Post by milomak »

through another thread i learnt how powerful aptitude is

i had never used the ncurses part of it but it is quite helpful especially when you try to remove a meta-data package but don't want your whole system to be uninstalled.
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

confuseling
Posts: 2121
Joined: 2009-10-21 01:03

Re: HOWTO: How I learned to stop worrying and love metapacka

#9 Post by confuseling »

Here's a good one on finding reverse dependencies.

http://forums.debian.net/viewtopic.php?p=387605
The Forum's search box is terrible. Use site specific search, e.g.
https://www.google.com/search?q=site%3A ... terms+here

User avatar
pete_m
Posts: 23
Joined: 2010-08-21 12:40
Location: London & the Balkans

Re: HOWTO: How I learned to stop worrying and love metapacka

#10 Post by pete_m »

Thanks for a fine thread. .

I use both apt-get and aptitude depending on the circumstances( and occasionally synaptic).
.
Running Debian Sid with Gnome, I'm currently repairing things after inadvertently inviting
( through a late-night apt-get dist-upgrade) a number of fresh gnome upgrades as things move toward 3.10 and 3.12.
This broke my existing 3.8 . ..

Metapackage gnome would be of no help, but it looks as if the smaller gnome-core is successfully restoring the 3.8 versions I need . ..

Some may find wajig useful

Code: Select all

apt-get install wajig 
- this program allows you to use apt-get, dpkg, apt-cache. .and probably others from a single command - it saves remembering some detaills .. .for me especially useful when hold/ unhold -ing a package when a bug is reported during the upgrade process.

The point about letting Debian move at its own pace is well-made.
When gnome-shell was new I installled it, it failed to work so I forgot about it for some months - when I then decided to try it again,it worked - the rolling upgrade process had caught up and repaired whatever had been upsetting gnome-shell

P.S. running install metapackage gnome-core has fixed things( apparently on my USB stick, where I've been chroot'ed, but not yet booted to) and verifiably on my main system, whch for the last few days had only been prepared to run gnome-fallback. . .

Onwards and upwards. ..

Post Reply