Skip to content

ncm-spma: update_pkgs in yum plugin tries to remove empty list of packages #1553

@lexming

Description

@lexming

SPMA is failing to complete in one of our systems because it tries to execute yum remove without any packages

[DEBUG] Running transaction: remove
install libstdc++.i686 kernel-firmware procps sssd-client.i686 compat-libstdc++-33.i686 python-argparse module-init-tools
transaction solve
transaction run

[DEBUG] keeps_state set
[VERB] Executing command: yum -c /etc/yum.conf -y shell with options: stderr=SCALAR(0x38cf5e8) stdin=remove
install libstdc++.i686 kernel-firmware procps sssd-client.i686 compat-libstdc++-33.i686 python-argparse module-init-tools
transaction solve
transaction run
stdout=SCALAR(0x38d5b00)
[WARN] running transaction produced warnings: Error: Need to pass a list of pkgs to remove
Mini usage:

erase PACKAGE...

Remove a package or packages from your system

aliases: remove, autoremove, erase-n, erase-na, erase-nevra, autoremove-n, autoremove-na, autoremove-nevra, remove-n, > remove-na, remove-nevra

[VERB] running transaction output: Loaded plugins: priorities, product-id, search-disabled-repos, subscription-
: manager, versionlock

This system is not registered with an entitlement server. You can use subscription-manager to register.

Excluding 38 updates due to versionlock (use "yum versionlock status" to show them)
Package libstdc++-4.8.5-44.el7.i686 already installed and latest version
Package linux-firmware-20200421-80.git78c0348.el7_9.noarch already installed and latest version
Package procps-ng-3.3.10-28.el7.x86_64 already installed and latest version
Package sssd-client-1.16.5-10.el7_9.13.i686 already installed and latest version
Package compat-libstdc++-33-3.2.3-72.el7.i686 already installed and latest version
Package python-2.7.5-92.el7_9.x86_64 already installed and latest version
Package kmod-20-28.el7.x86_64 already installed and latest version
--> Finding unneeded leftover dependencies
Found and removing 0 unneeded dependencies
Success resolving dependencies
Leaving Shell

[WARN] Command output: Loaded plugins: priorities, product-id, search-disabled-repos, subscription-
: manager, versionlock

This system is not registered with an entitlement server. You can use subscription-manager to register.

Excluding 38 updates due to versionlock (use "yum versionlock status" to show them)
Package libstdc++-4.8.5-44.el7.i686 already installed and latest version
Package linux-firmware-20200421-80.git78c0348.el7_9.noarch already installed and latest version
Package procps-ng-3.3.10-28.el7.x86_64 already installed and latest version
Package sssd-client-1.16.5-10.el7_9.13.i686 already installed and latest version
Package compat-libstdc++-33-3.2.3-72.el7.i686 already installed and latest version
Package python-2.7.5-92.el7_9.x86_64 already installed and latest version
Package kmod-20-28.el7.x86_64 already installed and latest version
--> Finding unneeded leftover dependencies
Found and removing 0 unneeded dependencies
Success resolving dependencies
Leaving Shell

[ERROR] Failed running transaction: Error: Need to pass a list of pkgs to remove

I tracked down this issue to update_pkgs():

$to_rm = $self->packages_to_remove($wanted);
defined($to_rm) or return 0;
$self->spare_dependencies($to_rm, $to_install, $error_is_warn);
$tx = $self->schedule(REMOVE, $to_rm);

In the affected system, packages_to_remove() returns an empty $to_rm list. This is the result of spare_deps_required(), which generates the following list of leaves:

[DEBUG] List of packages flagged as leaves:
[DEBUG] ( SINDES-ca-certificate-cerberus;noarch SOAPpy;noarch acpid;x86_64 autofs;x86_64 biosdevname;x86_64 cabundle-hpcvub;noarch cdp-listend;noarch cluster-modules;noarch compat-libstdc++-33;i686 compat-libstdc++-33;x86_64 config-templates-metaconfig-ugent;noarch dos2unix;x86_64 dstat;noarch e2fsprogs;x86_64 emacs-nox;x86_64 figlet;x86_64 fprintd-pam;x86_64 grub2;x86_64 htop;x86_64 hwloc;x86_64 icinga-checks-ugent;noarch iotop;noarch iperf3;x86_64 ipmitool;x86_64 ipset;x86_64 kernel-tools;x86_64 kernel;x86_64 kexec-tools;x86_64 lldpd;x86_64 lsof;x86_64 lsscsi;x86_64 lvm2;x86_64 mc;x86_64 mcelog;x86_64 microcode_ctl;x86_64 mlocate;x86_64 nagios-plugins-bonding;x86_64 nagios-plugins-disk;x86_64 nagios-plugins-dns;x86_64 nagios-plugins-http;x86_64 nagios-plugins-ldap;x86_64 nagios-plugins-procs;x86_64 nagios-plugins-time;x86_64 nano;x86_64 ncm-accounts;noarch ncm-altlogrotate;noarch ncm-authconfig;noarch ncm-autofs;noarch ncm-ccm;noarch ncm-cdispd;noarch ncm-cdp;noarch ncm-chkconfig;noarch ncm-cron;noarch ncm-dirperm;noarch ncm-download;noarch ncm-filecopy;noarch ncm-fstab;noarch ncm-grub;noarch ncm-metaconfig;noarch ncm-modprobe;noarch ncm-named;noarch ncm-network;noarch ncm-nrpe;noarch ncm-query;noarch ncm-shorewall;noarch ncm-sindes_getcert;noarch ncm-spma;noarch ncm-sudo;noarch ncm-symlink;noarch ncm-sysconfig;noarch ncm-systemd;noarch ncm-useraccess;noarch ncm-validate;noarch nfs-utils;x86_64 nmap-ncat;x86_64 nrpe;x86_64 numactl;x86_64 nuttcp;x86_64 openssh-server;x86_64 pakiti2-client;noarch parted;x86_64 pbzip2;x86_64 pciutils;x86_64 pigz;x86_64 podman;x86_64 ptpd;x86_64 pyOpenSSL;x86_64 python-perf;x86_64 python-vsc-host-tools;noarch redhat-lsb-core;x86_64 rootfiles;noarch rsyslog;x86_64 screen;x86_64 service_sanity;noarch shorewall-init;noarch smartmontools;x86_64 sssd-client;i686 sssd-tools;x86_64 sssd;x86_64 strace;x86_64 sudo;x86_64 sysstat;x86_64 tcpdump;x86_64 tcsh;x86_64 telnet;x86_64 tmux;x86_64 traceroute;x86_64 unzip;x86_64 update-firmware-ugent;x86_64 vim-enhanced;x86_64 vsc-profiles-brussel;noarch vsc-scripts-brussel;noarch wget;x86_64 zabbix-module-systemd;x86_64)

All of the packages are subsequently deleted from the list as false positives, which is reasonable, and $to_rm stays empty. However, defined($to_rm) still evaluates to true and the execution continues with the empty list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions