HenriWahl / checkmk-agent-plugin-yum

Checks for updates on RPM-based distributions via yum.
GNU General Public License v2.0
23 stars 22 forks source link

Report if there are any broken repos / timeouts etc #69

Open swampdogmash opened 4 months ago

swampdogmash commented 4 months ago

It would be useful to know if the yum command failed not just due to an arbitrary timeout, but because of any repo problems. Still figuring out how this might be implemented, but it would be good to see a way to report this.

swampdogmash commented 4 months ago

Possibly the below to help identify this 👍

[root@server1 ~]# yum history
Loaded plugins: enabled_repos_upload, fastestmirror, langpacks, package_upload, product-id, search-disabled-repos, subscription-manager, tracer_upload
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    35 | -y update --skip-broken  | 2024-04-01 03:01 | Update         |   71 EE
    34 | -y update --skip-broken  | 2024-01-01 03:06 | Update         |   35 ss
    33 | -y update --skip-broken  | 2023-12-04 03:01 | Update         |    5 EE
    32 | -y update --skip-broken  | 2023-11-06 03:03 | Update         |   24 ss
    31 | -y update --skip-broken  | 2023-10-02 03:04 | I, U           |   32 ss
    30 | -y update --skip-broken  | 2023-09-04 03:01 | Update         |   11 ss
    29 | -y update --skip-broken  | 2023-08-07 03:02 | Update         |   17 ss
    28 | -d 2 -y install check-mk | 2023-07-27 10:11 | Install        |    1 EE
    27 | -d 2 -y remove check_mk- | 2023-07-27 10:08 | Erase          |    2
    26 | -y update --skip-broken  | 2023-07-03 03:04 | Update         |   23 ss
    25 | -y update --skip-broken  | 2023-06-05 03:04 | Update         |    5 ss
    24 | -y update --skip-broken  | 2023-05-01 03:04 | Update         |    9 ss
    23 | -y update --skip-broken  | 2023-04-03 03:05 | Update         |   31 ss
    22 | install -y rh-python38 r | 2023-03-21 11:46 | Install        |    9
    21 | -y update --skip-broken  | 2023-03-06 03:05 | Update         |    5 ss
    20 | -y update --skip-broken  | 2023-02-06 03:05 | Update         |   39 EE
    19 | -y update --skip-broken  | 2023-01-02 03:04 | Update         |   44 ss
    18 | -y update --skip-broken  | 2022-12-05 03:05 | Update         |  121 EE
    17 | -y update --skip-broken  | 2022-06-06 03:01 | I, O, U        |  649 EE
    16 | update openscap-scanner  | 2022-06-01 09:30 | Update         |    2
history list
Uploading Enabled Repositories Report
Loaded plugins: fastestmirror, langpacks, product-id, subscription-manager

[root@server1 ~]# yum -C -y update --setopt=tsflags=test

Loaded plugins: enabled_repos_upload, fastestmirror, langpacks, package_upload, product-id, search-disabled-repos, subscription-manager, tracer_upload
Resolving Dependencies
--> Running transaction check
---> Package kmod-kvdo.x86_64 0:6.1.2.41-5.el7 will be updated
---> Package kmod-kvdo.x86_64 0:6.1.3.23-5.el7 will be an update
--> Processing Dependency: kernel(dm_unregister_target) = 0xeeeae71b for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel(dm_register_target) = 0x979ddcc5 for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel(dm_put_device) = 0x412d503d for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel(dm_get_device) = 0xa425b4a9 for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel >= 3.10.0-1133.el7 for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
---> Package vdo.x86_64 0:6.1.2.41-4.el7 will be updated
---> Package vdo.x86_64 0:6.1.3.23-5.el7 will be an update

One of the configured repositories failed (Unknown),

 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Caching enabled but no local cache of /var/cache/yum/x86_64/7/COMPANY_CentOS7_base_x86_64/52054a7556dcc66951d6ae2baf7963112ffb8a2aee35d5b55efc63f89bc323a3-filelists.xml.gz from COMPANY_CentOS7_base_x86_64
Uploading Enabled Repositories Report
Loaded plugins: fastestmirror, langpacks, product-id, subscription-manager
[root@server1 ~]#

Resulting in a final "potential" command of:

yum -C -y update --setopt=tsflags=test 2>&1 | grep "One of the configured repositories failed"
swampdogmash commented 4 months ago

and where there are dependency errors. Here 1 update IS available, but doesn't install due to dependencies.

Loaded plugins: enabled_repos_upload, fastestmirror, langpacks, package_upload, product-id, search-disabled-repos, subscription-manager, tracer_upload
Existing lock /var/run/yum.pid: another copy is running as pid 50890.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 116 M RSS (336 MB VSZ)
    Started: Thu Apr  4 13:07:12 2024 - 00:03 ago
    State  : Running, pid: 50890
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 195 M RSS (415 MB VSZ)
    Started: Thu Apr  4 13:07:12 2024 - 00:05 ago
    State  : Running, pid: 50890
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 226 M RSS (448 MB VSZ)
    Started: Thu Apr  4 13:07:12 2024 - 00:07 ago
    State  : Running, pid: 50890
Resolving Dependencies
--> Running transaction check
---> Package kmod-kvdo.x86_64 0:6.1.2.41-5.el7 will be updated
---> Package kmod-kvdo.x86_64 0:6.1.3.23-5.el7 will be an update
--> Processing Dependency: kernel(dm_unregister_target) = 0xeeeae71b for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel(dm_register_target) = 0x979ddcc5 for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel(dm_put_device) = 0x412d503d for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel(dm_get_device) = 0xa425b4a9 for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Processing Dependency: kernel >= 3.10.0-1133.el7 for package: kmod-kvdo-6.1.3.23-5.el7.x86_64
--> Finished Dependency Resolution
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_put_device) = 0x412d503d
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_put_device) = 0x660c95fc
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_get_device) = 0xa425b4a9
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_get_device) = 0x304f1d09
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_unregister_target) = 0xeeeae71b
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_unregister_target) = 0x33f324ab
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel >= 3.10.0-1133.el7
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel = 3.10.0-1062.el7
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_register_target) = 0x979ddcc5
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_register_target) = 0xfcd652d7
**********************************************************************
yum can be configured to try to resolve such errors by temporarily enabling
disabled repos and searching for missing dependencies.
To enable this functionality please set 'notify_only=0' in /etc/yum/pluginconf.d/search-disabled-repos.conf
**********************************************************************

Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_put_device) = 0x412d503d
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_put_device) = 0x660c95fc
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_get_device) = 0xa425b4a9
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_get_device) = 0x304f1d09
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_unregister_target) = 0xeeeae71b
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_unregister_target) = 0x33f324ab
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel >= 3.10.0-1133.el7
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel = 3.10.0-1062.el7
Error: Package: kmod-kvdo-6.1.3.23-5.el7.x86_64 (COMPANY_CentOS7_base_x86_64)
           Requires: kernel(dm_register_target) = 0x979ddcc5
           Installed: kernel-3.10.0-1062.el7.x86_64 (@anaconda)
               kernel(dm_register_target) = 0xfcd652d7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
Uploading Enabled Repositories Report
Loaded plugins: fastestmirror, langpacks, product-id, subscription-manager
swampdogmash commented 3 months ago

Also include error message:

"This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions"

swampdogmash commented 3 months ago

And:

Caching enabled but no local cache of /var/cache/yum/x86_64/7Server/rhel-7-server-rpms/feaf80df74e21e879e47243739f4405f618ec2ef-filelists.xml.gz from rhel-7-server-rpms/7Server/x86_64

As an example of another error which can appear