Bug 49399 - Add Diagnostic check for tdb errors in sam.ldb.d/*
Add Diagnostic check for tdb errors in sam.ldb.d/*
Product: UCS
Classification: Unclassified
Component: UMC - System diagnostic
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-0-errata
Assigned To: Fathan Vidjaja
Felix Botner
Depends on:
  Show dependency treegraph
Reported: 2019-04-30 17:47 CEST by Arvid Requate
Modified: 2019-06-26 17:42 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.023
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Ticket number: 2019042321000705
Bug group (optional):
Max CVSS v3 score:

redirecting from stdout to stderror (972 bytes, patch)
2019-06-11 14:51 CEST, Fathan Vidjaja
Details | Diff
Refactor all error on exit in script (2.25 KB, patch)
2019-06-24 13:05 CEST, Fathan Vidjaja
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2019-04-30 17:47:58 CEST
We had a case, where the the /usr/sbin/univention-samba4-backup script called by the cron job /etc/cron.d/univention-samba4-backup aborted because the tdb-tools detected an error in one of the Samba ldb files. Like this:

root@master:~# cd /var/lib/samba/private
root@master:~# tdbbackup sam.ldb.d/DC=DOM,DC=INTRANET.ldb
Failed to insert into sam.ldb.d/DC=DOM,DC=INTRANET.ldb.bak.tmp
failed to copy sam.ldb.d/DC=DOM,DC=INTRANET.ldb

The thing is: This went unnoticed for quite a while, because none of these error messages was logged. There was a /var/mail/systemmail file of about 50 MB and growing, but no message about the failure of the job. The tdbbackup script returns an exit code of 1 and outputs the messages to stderr. Additionally the /usr/sbin/univention-samba4-backup outputs

echo "Error while backing up $file with tdbbackup - status $Status"

to stdout. We should take some measure to improve the reporting in this case. Maybe a nagios job would be the right thing.
Comment 1 Fathan Vidjaja univentionstaff 2019-06-11 14:51:01 CEST
Created attachment 10058 [details]
redirecting from stdout to stderror
Comment 2 Felix Botner univentionstaff 2019-06-14 14:20:04 CEST
echo ..
exit 1

occurs several times, we should handle all of those, maybe

die() { echo "$*" 1>&2 ; exit 1; }

instead of

echo "Error while backing up $file with tdbbackup - status $Status"
                        exit 1
Comment 3 Fathan Vidjaja univentionstaff 2019-06-24 13:05:40 CEST
Created attachment 10081 [details]
Refactor all error on exit in script

This patch refactor so that all error message are redirected to stderror and exit the script. This also will send an system email per cron if such errors triggers.
Comment 4 Felix Botner univentionstaff 2019-06-24 13:49:41 CEST
OK, merge
Comment 5 Fathan Vidjaja univentionstaff 2019-06-24 14:16:49 CEST
Patch is merged and built in univention-samba4 ver. 8.0.0-25A~

88e30756 :Bug #49399: redirect error message from tdbbackup to stderr so cron will email error
3c13a13c :Bug #49399: refactoring all exits on error

39b05bc2 :Bug #49399: Version bump
dd780e41 :Bug #49399: yaml
Comment 6 Felix Botner univentionstaff 2019-06-24 15:25:59 CEST
Comment 7 Arvid Requate univentionstaff 2019-06-26 17:42:52 CEST