Going Back To A Minimal System : Strange Problem

Home » CentOS » Going Back To A Minimal System : Strange Problem
CentOS 4 Comments

Hi,

Some time ago I wrote a little script elaguer.sh (“élaguer” means “to prune”) which simply removes all packages that are *not* part of a minimal installation.

First I created a list of packages that make up a minimal CentOS
installation. On a fresh install, I would do something like this:

# rpm -qa –queryformat ‘%{NAME}\n’ | sort > minimal.txt

Here’s the resulting list of packages. I added a comment on top:

https://github.com/kikinovak/CentOS-7-server-lan/blob/master/config/pkglists/minimal.txt

And here’s the script to prune the installation, e. g. remove everything that’s not on the list.

https://github.com/kikinovak/CentOS-7-server-lan/blob/master/elaguer.sh

This script worked perfectly for some time. But now it seems like something has changed somewhere under the hood. Because when I run it now, the script fails at the final package removal stage. One curious detail: it seems like it tries now to remove ‘yum’ and ‘systemd’, so
‘yum’ exits with an error. But it didn’t do that before, so my guess is either ‘yum’ behaves differently now, or package dependencies are calculated differently. Anyway, I’m a bit clueless here.

Any suggestions?

Cheers from the freezing South of France,

Niki

Microlinux – Solutions informatiques durables
7, place de l’église – 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32

4 thoughts on - Going Back To A Minimal System : Strange Problem

  • I would hazard to guess that the flaw is simply that from time to time, packages are added to the minimal install as a side effect of adding in new dependencies.  If you had a minimal install and simply ran “yum update”, you would periodically see yum report that it would install new packages for dependencies, in addition to the updates.  As that is the case, you will need to update your minimal package list immediately before running the pruning script in order to avoid removal of core packages.

    I wonder if it might work to use a yum transaction, in which you first remove everything (which avoids the need for the list entirely), then adds the minimal package set, and then commits the transaction…

  • Le 26/02/2018 à 16:12, Gordon Messmer a écrit :

    That was my thought also, but the only difference between a fresh installation of CentOS 7.4 and the updated version as of today is the replacement of grub2 by grub2-tools, so that’s not the reason apparently.

    I only have a very vague notion of yum transactions, so I’ll look into that and report back.

    Cheers,

    Niki


    Microlinux – Solutions informatiques durables
    7, place de l’église – 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32

  • Le 26/02/2018 à 16:12, Gordon Messmer a écrit :

    OK, I found the culprit. A simple mix-up in my minimal package list. The file I used was the old one from a CentOS 7.2 installation. A simple
    ‘diff’ showed me where I was wrong.

    I updated the minimal package list, and everything works like a charm again.

    Cheers,

    Niki


    Microlinux – Solutions informatiques durables
    7, place de l’église – 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32

  • My idea was:

    # yum shell
    > transaction
    > remove *
    Skipping the running kernel: kernel-3.10.0-693.11.1.el7.x86_64
    > install @core
    > run

    …but that doesn’t work.  First, because it complains that @core has no packages to install, but second and more importantly, it appears that even if you get the package selection right it will remove and reinstall the packages.  I’m not positive that’ll break, but offhand, it doesn’t look like the transaction would have been a workable solution.  You know, in case you were curious.  :)