Daily cron job doesn't report failures

Bug #691050 reported by Loïc Minier
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Binary package hint: apt

Hi

I'm using unattended-upgrades in a lucid vm, setup for security updates to be installed automatically.

I realized recently that this stopped working for some time, but I didn't get any error whatsoever: there were available security updates when I would launch aptitude, but they would not get installed overnight anymore.

To find out what was going on, I've set APT::Periodic::Verbose 2; in the apt config; I got this output in the next day's cron:
/etc/cron.daily/apt:
verbose level 2
sleeping for 537 seconds
apt-key net-update (success)
download updated metadata (error)
download upgradable (not run)
unattended-upgrade (not run)
check_stamp: interval=0
autoclean (not run)
aged: ctime <30 and mtime <30 and ctime>2 and mtime>2
end remove by archive size: size=508 < 512000

(I found it hard to force a run, there is no flag to e.g. ignore the timestamp checks and force this cron job to do what it would do nightly; you have to edit it and disable a bunch of tests, but then it's not obvious that the right thing is being changed etc.)

The problem was that one of the APT repository I was tracking had gone away, it had been removed, resulting in apt-get update failing to complete:
E: Some index files failed to download, they have been ignored, or old ones used instead.

but this went on unnoticed for weeks.

I think this cron job should report failures by:
- outputting something meaningful to stderr when an error condition appears
- returning with a non-zero exit status when some error condition occurs

and ideally, it would be possible to run it manually during day, even if it ran overnight, perhaps a "force" flag allowing to ignore timestamp checks?

Cheers,

Tags: patch
Revision history for this message
Loïc Minier (lool) wrote :

Oh and another thing which would be useful to disable when running the cron script by hand is the random sleep

Michael Vogt (mvo)
Changed in apt (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Loïc Minier (lool)
summary: - Daily cron job doesn't report faliures
+ Daily cron job doesn't report failures
Revision history for this message
Torsten Spindler (tspindler) wrote :

The attached patch would introduce two options to the cron job, -r for suppressing the random sleep and -u for showing usage information.

tags: added: patch
Revision history for this message
Steve Dodd (anarchetic) wrote :

Ironically, 12 years later in 22.04, /usr/lib/apt/apt.systemd.daily doesn't seem to indicate success or failure to systemd either, which means you can't use e.g. journalctl -p err as a "one stop shop" to find things that are failing on system :(

Revision history for this message
Steve Dodd (anarchetic) wrote :

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=778878 relevant, though thread seems to have been hijacked.

Revision history for this message
Steve Dodd (anarchetic) wrote :
Revision history for this message
Steve Dodd (anarchetic) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.