• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

yum-cron: Auto-Update mit CentOS/Fedora

gehrke

Administrator
Teammitglied
Moin *,

ich habe ein Problem, das Auto-Update unter CentOS/Fedora ans Fliegen zu bringen. IMHO ist alles eingerichtet, aber es werden seit Tagen keine Updates automatisch eingespielt.

Installation am Beispiel CentOS:
Code:
# yum -y install yum-cron
# systemctl enable  yum-cron.service
# systemctl start  yum-cron.service
Code:
# systemctl status  yum-cron.service
● yum-cron.service - Run automatic yum updates as a cron job
   Loaded: loaded (/usr/lib/systemd/system/yum-cron.service; enabled; vendor preset: disabled)
   Active: active (exited) since So 2017-05-21 09:37:45 CEST; 2 days ago
  Process: 1015 ExecStart=/bin/touch /var/lock/subsys/yum-cron (code=exited, status=0/SUCCESS)
 Main PID: 1015 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/yum-cron.service

Mai 21 09:37:45 b2.gehrke.local systemd[1]: Starting Run automatic yum updates as a cron job...
Mai 21 09:37:45 b2.gehrke.local systemd[1]: Started Run automatic yum updates as a cron job.
Konfiguration unverändet:
Code:
# cat /etc/yum/yum-cron.conf
[commands]
#  What kind of update to use:
# default                            = yum upgrade
# security                           = yum --security upgrade
# security-severity:Critical         = yum --sec-severity=Critical upgrade
# minimal                            = yum --bugfix update-minimal
# minimal-security                   = yum --security update-minimal
# minimal-security-severity:Critical =  --sec-severity=Critical update-minimal
update_cmd = default

# Whether a message should be emitted when updates are available,
# were downloaded, or applied.
update_messages = yes

# Whether updates should be downloaded when they are available.
download_updates = yes

# Whether updates should be applied when they are available.  Note
# that download_updates must also be yes for the update to be applied.
apply_updates = yes

# Maximum amout of time to randomly sleep, in minutes.  The program
# will sleep for a random amount of time between 0 and random_sleep
# minutes before running.  This is useful for e.g. staggering the
# times that multiple systems will access update servers.  If
# random_sleep is 0 or negative, the program will run immediately.
# 6*60 = 360
random_sleep = 360


[emitters]
# Name to use for this system in messages that are emitted.  If
# system_name is None, the hostname will be used.
system_name = None

# How to send messages.  Valid options are stdio and email.  If
# emit_via includes stdio, messages will be sent to stdout; this is useful
# to have cron send the messages.  If emit_via includes email, this
# program will send email itself according to the configured options.
# If emit_via is None or left blank, no messages will be sent.
emit_via = stdio

# The width, in characters, that messages that are emitted should be
# formatted to.
output_width = 80


[email]
# The address to send email messages from.
# NOTE: 'localhost' will be replaced with the value of system_name.
email_from = root@localhost

# List of addresses to send messages to.
email_to = root

# Name of the host to connect to to send email messages.
email_host = localhost


[groups]
# NOTE: This only works when group_command != objects, which is now the default
# List of groups to update
group_list = None

# The types of group packages to install
group_package_types = mandatory, default

[base]
# This section overrides yum.conf

# Use this to filter Yum core messages
# -4: critical
# -3: critical+errors
# -2: critical+errors+warnings (default)
debuglevel = -2

# skip_broken = True
mdpolicy = group:main

# Uncomment to auto-import new gpg keys (dangerous)
# assumeyes = True
Es passiert leider nix. Bei manuellem Aufruf hingegen würden mehrere Updates starten:
Code:
# yum upgrade
Geladene Plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.halifax.rwth-aachen.de
 * epel: mirror.23media.de
 * extras: mirror.eu.oneandone.net
 * updates: ftp.halifax.rwth-aachen.de
Abhängigkeiten werden aufgelöst
--> Transaktionsprüfung wird ausgeführt
---> Paket kdelibs.x86_64 6:4.14.8-5.el7_2 markiert, um aktualisiert zu werden
---> Paket kdelibs.x86_64 6:4.14.8-6.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket kdelibs-common.x86_64 6:4.14.8-5.el7_2 markiert, um aktualisiert zu werden
---> Paket kdelibs-common.x86_64 6:4.14.8-6.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket kdelibs-ktexteditor.x86_64 6:4.14.8-5.el7_2 markiert, um aktualisiert zu werden
---> Paket kdelibs-ktexteditor.x86_64 6:4.14.8-6.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket libsmbclient.x86_64 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket libsmbclient.x86_64 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket libtirpc.x86_64 0:0.2.4-0.8.el7 markiert, um aktualisiert zu werden
---> Paket libtirpc.x86_64 0:0.2.4-0.8.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket libwbclient.x86_64 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket libwbclient.x86_64 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket rpcbind.x86_64 0:0.2.0-38.el7 markiert, um aktualisiert zu werden
---> Paket rpcbind.x86_64 0:0.2.0-38.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket samba-client.x86_64 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket samba-client.x86_64 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket samba-client-libs.x86_64 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket samba-client-libs.x86_64 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket samba-common.noarch 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket samba-common.noarch 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket samba-common-libs.x86_64 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket samba-common-libs.x86_64 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
---> Paket samba-libs.x86_64 0:4.4.4-12.el7_3 markiert, um aktualisiert zu werden
---> Paket samba-libs.x86_64 0:4.4.4-13.el7_3 markiert, um eine Aktualisierung zu werden
--> Abhängigkeitsauflösung beendet

Abhängigkeiten aufgelöst

=================================================================================================================
 Package                          Arch                Version                         Paketquelle          Größe
=================================================================================================================
Aktualisieren:
 kdelibs                          x86_64              6:4.14.8-6.el7_3                updates               11 M
 kdelibs-common                   x86_64              6:4.14.8-6.el7_3                updates              1.9 M
 kdelibs-ktexteditor              x86_64              6:4.14.8-6.el7_3                updates               73 k
 libsmbclient                     x86_64              4.4.4-13.el7_3                  updates              126 k
 libtirpc                         x86_64              0.2.4-0.8.el7_3                 updates               88 k
 libwbclient                      x86_64              4.4.4-13.el7_3                  updates              100 k
 rpcbind                          x86_64              0.2.0-38.el7_3                  updates               59 k
 samba-client                     x86_64              4.4.4-13.el7_3                  updates              547 k
 samba-client-libs                x86_64              4.4.4-13.el7_3                  updates              4.6 M
 samba-common                     noarch              4.4.4-13.el7_3                  updates              191 k
 samba-common-libs                x86_64              4.4.4-13.el7_3                  updates              161 k
 samba-libs                       x86_64              4.4.4-13.el7_3                  updates              260 k

Transaktionsübersicht
=================================================================================================================
Aktualisieren  12 Pakete

Gesamte Downloadgröße: 19 M
Is this ok [y/d/N]:

Logs:
Code:
Mai 23 21:01:01 b2.gehrke.local anacron[2633]: Normal exit (0 jobs run)
Mai 23 21:01:01 b2.gehrke.local run-parts(/etc/cron.hourly)[2637]: starting 0yum-hourly.cron
Mai 23 21:02:46 b2.gehrke.local run-parts(/etc/cron.hourly)[2679]: finished 0yum-hourly.cron

Wie geschrieben, mit einem aktuellen Fedora/DNF sieht das genau so aus. Was übersehe ich?
TNX


cu, gehrke
 
OP
gehrke

gehrke

Administrator
Teammitglied
Außer dem schon - nachträglich (sorry) - zitierten ist mir nix aufgefallen.
 
OP
gehrke

gehrke

Administrator
Teammitglied
Nein. Ich hatte gehofft, dies mit Geduld und 1 Woche Testzeit auf mehreren Systemen zu kompensieren.
 

marce

Guru
ich würd' es zum Test mal auf -1 stellen.

Ich kann's hier gerade nich ausprobieren aber ich erinnere mich an alte Zeiten, wo diese mehr oder weniger nicht so 100% zu bestimmende Laufzeit von anacron und Konsorten mich auch schon das eine oder andere mal zur Weißglut getrieben hat.
 
OP
gehrke

gehrke

Administrator
Teammitglied
TNX
Code:
[root@b2 ~]# grep 'random_sleep = ' /etc/yum/yum-cron.conf
#random_sleep = 360
random_sleep = -1

Code:
[root@b2 ~]# systemctl restart  yum-cron.service ; journalctl -f
[...]
Mai 24 07:09:36 b2.gehrke.local polkitd[1033]: Registered Authentication Agent for unix-process:2962:25035001 (system bus name :1.125 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale de_DE.UTF-8)
Mai 24 07:09:36 b2.gehrke.local systemd[1]: Stopping Run automatic yum updates as a cron job...
Mai 24 07:09:36 b2.gehrke.local systemd[1]: Starting Run automatic yum updates as a cron job...
Mai 24 07:09:36 b2.gehrke.local systemd[1]: Started Run automatic yum updates as a cron job.
Mai 24 07:09:36 b2.gehrke.local polkitd[1033]: Unregistered Authentication Agent for unix-process:2962:25035001 (system bus name :1.125, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale de_DE.UTF-8) (disconnected from bus)
Das scheint leider keinen Durchbruch gebracht zu haben. Ob das polkitd-Zeug damit zu tun hat, ist mir derzeit noch unklar, halte ich aber eher für unwahrscheinlich...
 
OP
gehrke

gehrke

Administrator
Teammitglied
Irgendwas ist anders. Und alles, was anders ist, ist gut...
Code:
Message  3:
From root@b2.gehrke.local  Wed May 24 19:31:34 2017
Return-Path: <root@b2.gehrke.local>
X-Original-To: root
Delivered-To: root@b2.gehrke.local
From: Anacron <root@b2.gehrke.local>
To: root@b2.gehrke.local
Content-Type: text/plain; charset="UTF-8"
Subject: Anacron job 'cron.daily' on b2.gehrke.local
Date: Wed, 24 May 2017 19:31:34 +0200 (CEST)
Status: R

/etc/cron.daily/0yum-daily.cron:

The following updates will be applied on b2.gehrke.local:
================================================================================
 Package                  Arch        Version                Paketquelle  Größe
================================================================================
Aktualisieren:
 kdelibs                  x86_64      6:4.14.8-6.el7_3       updates       11 M
 kdelibs-common           x86_64      6:4.14.8-6.el7_3       updates      1.9 M
 kdelibs-ktexteditor      x86_64      6:4.14.8-6.el7_3       updates       73 k
 libsmbclient             x86_64      4.4.4-13.el7_3         updates      126 k
 libtirpc                 x86_64      0.2.4-0.8.el7_3        updates       88 k
 libwbclient              x86_64      4.4.4-13.el7_3         updates      100 k
 rpcbind                  x86_64      0.2.0-38.el7_3         updates       59 k
 samba-client             x86_64      4.4.4-13.el7_3         updates      547 k
 samba-client-libs        x86_64      4.4.4-13.el7_3         updates      4.6 M
 samba-common             noarch      4.4.4-13.el7_3         updates      191 k
 samba-common-libs        x86_64      4.4.4-13.el7_3         updates      161 k
 samba-libs               x86_64      4.4.4-13.el7_3         updates      260 k

Transaktionsübersicht
================================================================================
Aktualisieren  12 Pakete
The updates were successfully applied
Code:
[root@b2 ~]# yum upgrade
Geladene Plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.halifax.rwth-aachen.de
 * epel: mirror.23media.de
 * extras: mirror1.hs-esslingen.de
 * updates: ftp.halifax.rwth-aachen.de
No packages marked for update
Ausser der dokumentierten Änderung habe ich nichts gemacht. Derzeit habe ich keinen Schimmer, warum das jetzt funktioniert und vorher nicht.
 
OP
gehrke

gehrke

Administrator
Teammitglied
Ich habe die Einstellung
Code:
random_sleep = -1
auf 4 Systemen (3x yum/CentOS, 1x dnf/Fedora) konfiguriert. Bis auf das oben zitierte eine mal brachte das aber keinen Erfolg.

Zumindest auf dem dnf-basierten System scheint diese Einstellung sogar schädlich zu sein:
Code:
Jun 04 08:43:53 j10.gehrke.local systemd[1]: Starting dnf automatic...
Jun 04 08:43:53 j10.gehrke.local python3[27931]: detected unhandled Python exception in '/usr/bin/dnf-automatic'
Jun 04 08:43:53 j10.gehrke.local abrt-server[27933]: ABRT_IGNORE variable is 1 - not saving the crash
Jun 04 08:43:53 j10.gehrke.local abrt-server[27933]: 'post-create' on '/var/spool/abrt/Python3-2017-06-04-08:43:53-27931' exited with 1
Jun 04 08:43:53 j10.gehrke.local abrt-server[27933]: Deleting problem directory '/var/spool/abrt/Python3-2017-06-04-08:43:53-27931'
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]: Traceback (most recent call last):
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:   File "/usr/bin/dnf-automatic", line 32, in <module>
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:     sys.exit(dnf.automatic.main.main(sys.argv[1:]))
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:   File "/usr/lib/python3.5/site-packages/dnf/automatic/main.py", line 140, in main
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:     sleeper = random.randint(0, conf.commands.random_sleep)
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:   File "/usr/lib64/python3.5/random.py", line 227, in randint
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:     return self.randrange(a, b+1)
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:   File "/usr/lib64/python3.5/random.py", line 205, in randrange
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]:     raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
Jun 04 08:43:53 j10.gehrke.local dnf-automatic[27931]: ValueError: empty range for randrange() (0,0, 0)
Jun 04 08:43:53 j10.gehrke.local systemd[1]: dnf-automatic.service: Main process exited, code=exited, status=1/FAILURE
Jun 04 08:43:53 j10.gehrke.local systemd[1]: Failed to start dnf automatic.

Code:
[root@j10 ~]# ls -ltar /var/spool/abrt/
insgesamt 44
drwxr-xr-x. 12 root   root 4096 27. Dez 16:59 ..
-rw-------.  1 root   root   20 18. Mai 17:27 last-ccpp
-rw-------.  1 root   root   22  4. Jun 08:43 last-via-server
drwxr-x---.  3 root   abrt 4096  4. Jun 08:43 Python3-2017-04-23-10:32:32-32731
drwxr-x---.  3 root   abrt 4096  4. Jun 08:43 ccpp-2017-05-18-07:02:25-24873
drwxr-x---.  3 root   abrt 4096  4. Jun 08:43 ccpp-2017-05-08-23:31:54-21214
drwxr-x---.  3 root   abrt 4096  4. Jun 08:43 ccpp-2017-05-08-21:59:36-21355
drwxr-x---.  3 gehrke   abrt 4096  4. Jun 08:43 ccpp-2017-05-07-17:16:49-14393
drwxr-x---.  3 gehrke   abrt 4096  4. Jun 08:43 ccpp-2017-05-07-17:16:49-14392
drwxr-x---.  3 gehrke abrt 4096  4. Jun 08:43 ccpp-2017-05-05-10:52:20-4309
drwxr-x--x.  9 root   abrt 4096  4. Jun 08:43 .
Ich habe den Wert nun auf '0' oder '60' gesetzt.

Überall scheint der Dienst aktiv, aber nirgendwo wird effektiv ein Update durchgeführt (yum history bzw. dnf history).
Code:
Jun 05 09:01:01 i1-wlan CROND[21124]: (root) CMD (run-parts /etc/cron.hourly)
Jun 05 09:01:01 i1-wlan run-parts(/etc/cron.hourly)[21128]: starting 0anacron
Jun 05 09:01:01 i1-wlan run-parts(/etc/cron.hourly)[21135]: finished 0anacron
Jun 05 09:01:01 i1-wlan run-parts(/etc/cron.hourly)[21138]: starting 0yum-hourly.cron

Code:
Jun 05 09:01:01 b2.gehrke.local CROND[5092]: (root) CMD (run-parts /etc/cron.hourly)
Jun 05 09:01:01 b2.gehrke.local run-parts(/etc/cron.hourly)[5095]: starting 0anacron
Jun 05 09:01:01 b2.gehrke.local anacron[5102]: Anacron started on 2017-06-05
Jun 05 09:01:01 b2.gehrke.local anacron[5102]: Will run job `cron.daily' in 44 min.
Jun 05 09:01:01 b2.gehrke.local anacron[5102]: Jobs will be executed sequentially
Jun 05 09:01:01 b2.gehrke.local run-parts(/etc/cron.hourly)[5104]: finished 0anacron
Jun 05 09:01:01 b2.gehrke.local run-parts(/etc/cron.hourly)[5106]: starting 0yum-hourly.cron
Jun 05 09:02:23 b2.gehrke.local run-parts(/etc/cron.hourly)[5125]: finished 0yum-hourly.cron
Jun 05 09:03:23 b2.gehrke.local run-parts(/etc/cron.hourly)[5135]: finished 0yum-hourly.cron
Jun 05 09:06:07 b2.gehrke.local chronyd[1073]: Selected source 176.9.100.86
[...]
Jun 05 09:45:01 b2.gehrke.local anacron[5102]: Job `cron.daily' started
Jun 05 09:45:01 b2.gehrke.local run-parts(/etc/cron.daily)[5241]: starting 0yum-daily.cron
Klar könnte das ein Bug sein, aber es sind ja zwei unabhängige Systeme (yum + dnf). Ich muss irgendetwas banales übersehen!?!
 
OP
gehrke

gehrke

Administrator
Teammitglied
gehrke schrieb:
Ich muss irgendetwas banales übersehen!?!
Arghh. Dieser Mechanismus schreibt seine Ergebnisse scheinbar nicht ins journal, sondern stellt sie nur per Mail dar. Dort sehe ich tatsächlich den Status und eine Fehlermeldung:

Code:
From root@b2.gehrke.local  Mon Jun  5 10:08:59 2017
Return-Path: <root@b2.gehrke.local>
X-Original-To: root
Delivered-To: root@b2.gehrke.local
From: Anacron <root@b2.gehrke.local>
To: root@b2.gehrke.local
Content-Type: text/plain; charset="UTF-8"
Subject: Anacron job 'cron.daily' on b2.gehrke.local
Date: Mon,  5 Jun 2017 10:08:59 +0200 (CEST)
Status: R

/etc/cron.daily/0yum-daily.cron:

error: /var/cache/yum/x86_64/7/updates/packages/NetworkManager-team-1.4.0-20.el7_3.x86_64.rpm: headerRead failed: hdr blob(131296): BAD, read returned 0
The following updates will be applied on b2.gehrke.local:
================================================================================
 Package                       Arch    Version                   Paketquelle                                                                                         
                                                                          Größe                                                                                      
================================================================================                                                                                     
Installieren:                                                                                                                                                        
 kernel                        x86_64  3.10.0-514.21.1.el7       updates   37 M                                                                                      
Aktualisieren:
[...]
Transaktionsübersicht
================================================================================
Installieren    1 Paket
Aktualisieren  53 Pakete
Updates failed to install with the following error message: 
Problem beim Öffnen des Paketes NetworkManager-team-1.4.0-20.el7_3.x86_64.rpm
Damit sollte sich doch wohl etwas anfangen lassen. Dann schaue ich mal auf den anderen Systemen nach...
 
Oben