Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Auto-Removing Meta packages that depend on other packages, should remove dependent packages... right?

We have a the ubuntu-virt-mgmt metapackage:

 # apt-cache showpkg ubuntu-virt-mgmt | grep -A1 Dependencies
Dependencies: 
1.3 - virt-manager (0 (null)) python-vm-builder (0 (null)) virt-viewer (0 (null)) 

Which depends on the virt-manager package:

 # apt-cache showpkg virt-manager | grep -A1 Dependencies
Dependencies: 
0.9.1-1ubuntu5.1 - gconf2 (2 2.28.1-2) python (2 2.7.1-0ubuntu2) python-gtk2 (0 (null)) python-glade2 (0 (null)) python-gnome2 (0 (null)) python-dbus (0 (null)) python-urlgrabber (0 (null)) python-vte (0 (null)) librsvg2-common (0 (null)) python-libvirt (2 0.7.1) virtinst (2 0.600.1) python-gtk-vnc (2 0.3.8) python-appindicator (0 (null)) libvirt-bin (2 0.4.6) virt-viewer (0 (null)) ssh-askpass (0 (null)) gnome-keyring (0 (null)) python-gnomekeyring (0 (null)) hal (0 (null)) python-guestfs (0 (null)) python-spice-client-gtk (0 (null)) gnome-icon-theme (0 (null)) 

If we install ubuntu-virt-mgmt metapackage, it installs all it's dependencies, including virt-manager

 # apt-get install -y ubuntu-virt-mgmt
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgtk-vnc-1.0-0 libgtk-vnc-2.0-0 libgvnc-1.0-0 python-gtk-vnc
  python-vm-builder virt-manager virt-viewer
Suggested packages:
  libvirt-bin hal python-guestfs python-spice-client-gtk
The following NEW packages will be installed:
  libgtk-vnc-1.0-0 libgtk-vnc-2.0-0 libgvnc-1.0-0 python-gtk-vnc
  python-vm-builder ubuntu-virt-mgmt virt-manager virt-viewer
0 upgraded, 8 newly installed, 0 to remove and 20 not upgraded.
Need to get 0 B/976 kB of archives.
After this operation, 8,321 kB of additional disk space will be used.
Selecting previously unselected package libgvnc-1.0-0.
(Reading database ... 271875 files and directories currently installed.)
Unpacking libgvnc-1.0-0 (from .../libgvnc-1.0-0_0.5.0-1ubuntu1_amd64.deb) ...
Selecting previously unselected package libgtk-vnc-1.0-0.
Unpacking libgtk-vnc-1.0-0 (from .../libgtk-vnc-1.0-0_0.5.0-1ubuntu1_amd64.deb) ...
Selecting previously unselected package libgtk-vnc-2.0-0.
Unpacking libgtk-vnc-2.0-0 (from .../libgtk-vnc-2.0-0_0.5.0-1ubuntu1_amd64.deb) ...
Selecting previously unselected package python-gtk-vnc.
Unpacking python-gtk-vnc (from .../python-gtk-vnc_0.5.0-1ubuntu1_amd64.deb) ...
Selecting previously unselected package virt-manager.
Unpacking virt-manager (from .../virt-manager_0.9.1-1ubuntu5.1_all.deb) ...
Selecting previously unselected package python-vm-builder.
Unpacking python-vm-builder (from .../python-vm-builder_0.12.4+bzr477-0ubuntu1_all.deb) ...
Selecting previously unselected package virt-viewer.
Unpacking virt-viewer (from .../virt-viewer_0.4.2-1_amd64.deb) ...
Selecting previously unselected package ubuntu-virt-mgmt.
Unpacking ubuntu-virt-mgmt (from .../ubuntu-virt-mgmt_1.3_all.deb) ...
Processing triggers for gconf2 ...
Processing triggers for man-db ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Setting up libgvnc-1.0-0 (0.5.0-1ubuntu1) ...
Setting up libgtk-vnc-1.0-0 (0.5.0-1ubuntu1) ...
Setting up libgtk-vnc-2.0-0 (0.5.0-1ubuntu1) ...
Setting up python-gtk-vnc (0.5.0-1ubuntu1) ...
Setting up virt-manager (0.9.1-1ubuntu5.1) ...
Setting up python-vm-builder (0.12.4+bzr477-0ubuntu1) ...
Setting up virt-viewer (0.4.2-1) ...
Processing triggers for python-central ...
Setting up ubuntu-virt-mgmt (1.3) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

And then autoremove ubuntu-virt-mgmr... it leaves behind all it's dependencies:

 #  apt-get autoremove -y ubuntu-virt-mgmt
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  ubuntu-virt-mgmt
0 upgraded, 0 newly installed, 1 to remove and 20 not upgraded.
After this operation, 32.8 kB disk space will be freed.
(Reading database ... 272353 files and directories currently installed.)
Removing ubuntu-virt-mgmt ...

However if we autoremove virt-manager it removes it's dependencies:

 #  apt-get autoremove -y virt-manager
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libgtk-vnc-1.0-0 python-gtk-vnc virt-manager
0 upgraded, 0 newly installed, 3 to remove and 20 not upgraded.
After this operation, 3,248 kB disk space will be freed.
(Reading database ... 272350 files and directories currently installed.)
Removing virt-manager ...
Removing python-gtk-vnc ...
Removing libgtk-vnc-1.0-0 ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for man-db ...
Processing triggers for gconf2 ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

What is the difference between the way metapackage and real package dependencies are processed?

Why does autoremoving the ubuntu-virt-mgmt metapackage fail to remove any dependencies, while autoremoving the virt-manager package works as expected?

Owner

hh commented Jun 27, 2012

metapackages are usually in a */metapackage section, other packages are in other sections.

aptitude markauto not being set being set for packages in the */metapackage sections, due to the default in /etc/apt/apt.conf.d/01autoremove

ubuntu-virt-mgmt is in the metapackages section, so it's dependent packages look like they are manually installed.

virt-manager has markauto set on it's dependent packages that get installed, so they get removed.

** https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2012-June/013688.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment