Nicolas Kovacs
2018-Feb-26 14:03 UTC
[CentOS] Going back to a minimal system : strange problem
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 at microlinux.fr T?l. : 04 66 63 10 32
Gordon Messmer
2018-Feb-26 15:12 UTC
[CentOS] Going back to a minimal system : strange problem
On 02/26/2018 06:03 AM, Nicolas Kovacs wrote:> 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.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...
Nicolas Kovacs
2018-Feb-26 17:25 UTC
[CentOS] Going back to a minimal system : strange problem
Le 26/02/2018 ? 16:12, Gordon Messmer a ?crit :> 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.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 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...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 at microlinux.fr T?l. : 04 66 63 10 32
Nicolas Kovacs
2018-Feb-26 17:40 UTC
[CentOS] Going back to a minimal system : strange problem
Le 26/02/2018 ? 16:12, Gordon Messmer a ?crit?:> 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.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 at microlinux.fr T?l. : 04 66 63 10 32