Puppet fighting over /etc/apt/sources.list
Our current Puppet is set up to purge (delete) /etc/apt/sources.list
.
The problem is, APT::Periodic (apt-daily.service
) is recreating it every day: the file's creation time concurs with the schedule ofapt-daily.timer
(as seen with systemctl list-timers apt-daily.timer
). The creation of the file can also be reproduced manually:
# rm /var/lib/apt/periodic/*-stamp
# /usr/lib/apt/apt.systemd.daily update
# ls -l /etc/apt/sources.list
The file being purged every day leads to frequent and unnecessary triggers of apt update
, and this sometimes even causes Puppet run failures which show up in monitoring:
puppet-agent[3791032]: (/Stage[main]/Apt/File[sources.list]/ensure) removed (corrective)
puppet-agent[3791032]: (/Stage[main]/Apt::Update/Exec[apt_update]/returns) Reading package lists...
puppet-agent[3791032]: (/Stage[main]/Apt::Update/Exec[apt_update]/returns) E: Could not get lock /var/lib/apt/lists/lock. It is held by process 3791201 (apt-get)
puppet-agent[3791032]: (/Stage[main]/Apt::Update/Exec[apt_update]/returns) E: Unable to lock directory /var/lib/apt/lists/
puppet-agent[3791032]: (/Stage[main]/Apt::Update/Exec[apt_update]) Failed to call refresh: '/usr/bin/apt-get update' returned 100 instead of one of [0]
puppet-agent[3791032]: (/Stage[main]/Apt::Update/Exec[apt_update]) '/usr/bin/apt-get update' returned 100 instead of one of [0]
puppet-agent[3791032]: Applied catalog in 14.75 seconds
systemd[1]: puppet-run.service: Main process exited, code=exited, status=6/NOTCONFIGURED
systemd[1]: puppet-run.service: Failed with result 'exit-code'.