[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Scriptable interface for "set package selection to this set"



Hi,

I'm trying to build a small script to synchronize the package installation sets of a bunch of machines. My current approach is to simply run

    dpkg --clear-selections
    dpkg --set-selections <packages.txt
    apt-get --yes dselect-upgrade

I believe that this is the only interface that allows me to set the package selection without having to compare current and desired list. To get started, I first tried what would happen if I cleared the entire list:

    root@57ac7d42f84f:/# dpkg --clear-selections
    root@57ac7d42f84f:/# apt-get dselect-upgrade
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages will be REMOVED:
      adduser apt debian-archive-keyring e2fsprogs gpgv libapt-pkg6.0
      libcom-err2 libext2fs2 libffi8 libgnutls30 libhogweed6 libidn2-0
      libnettle8 libp11-kit0 libseccomp2 libsemanage-common libsemanage2
      libsepol2 libss2 libstdc++6 libtasn1-6 libunistring2 libxxhash0
      logsave mount passwd tzdata
    WARNING: The following essential packages will be removed.
    This should NOT be done unless you know exactly what you are doing!
      apt adduser (due to apt) gpgv (due to apt)
      libapt-pkg6.0 (due to apt) debian-archive-keyring (due to apt)
      libgnutls30 (due to apt) libseccomp2 (due to apt)
      libstdc++6 (due to apt) e2fsprogs libcom-err2 (due to e2fsprogs)
      libext2fs2 (due to e2fsprogs) libss2 (due to e2fsprogs)
      logsave (due to e2fsprogs)
    0 upgraded, 0 newly installed, 27 to remove and 0 not upgraded.
    After this operation, 30.4 MB disk space will be freed.
    E: Removing essential system-critical packages is not permitted.
    This might break the system.

As far as I can see, there are two things apt and dpkg disagree on:

 - whether apt itself is Essential

This is understandable, apt special-cases itself, and for a good reason. I have no problem hardcoding an "apt install" into my package selection, that solves this nicely.

 - whether e2fsprogs is Essential

This is only Important, not Essential, so dpkg marks it "deinstall", and apt doesn't want to remove it.

Outside of a container, obviously there will be more "Important" packages. I can hardcode a sensible package set to have something that works for me for now, but medium term I will probably have to explain this script to someone else.

The obvious problem with this interface is that half of it is provided by one tool, and half of it by another, and these implementations have incompatible worldviews that the user of the interface needs to be aware of, because it was never designed to be cohesive. Also, the name "dselect-upgrade" suggests that this is really an atavism. A useful one, but nonetheless probably not meant to be officially supported.

Since this functionality is useful, it would be nice to have a proper supported way to do this.

   Simon


Reply to: