Bug 55535 - Cron job fails to create backups for mdb databases in samba
Summary: Cron job fails to create backups for mdb databases in samba
Status: RESOLVED DUPLICATE of bug 56434
Alias: None
Product: UCS
Classification: Unclassified
Component: Samba
Version: UCS 5.0
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: Samba maintainers
QA Contact: Samba maintainers
URL: https://git.knut.univention.de/univen...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-06 16:29 CET by Simon Streit
Modified: 2024-02-15 16:41 CET (History)
6 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.086
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2022122721000071
Bug group (optional): bitesize, Workaround is available
Customer ID: 00009
Max CVSS v3 score:


Attachments
Patch to fix bug. (1.03 KB, patch)
2023-01-12 10:03 CET, Simon Streit
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Streit univentionstaff 2023-01-06 16:29:24 CET
A customer has reported that they cannot create backups after
migrating their idmap backend to mdb [1]: 

root@primary0:~# /usr/sbin/univention-samba4-backup --days 15
Failed to open ./private/sam.ldb.d/CN=SCHEMA,CN=CONFIGURATION,DC=EXAMPLE,DC=COM.ldb
Error while backing up ./private/sam.ldb.d/CN=SCHEMA,CN=CONFIGURATION,DC=EXAMPLE,DC=COM.ld with tdbbackup - status 1

It is known that tdbbackup cannot create backups with mdb files.  An
alternative is to use mdb_copy.

This costumer was kind enough to provide a patch for a workaround to
this problem:

--- /usr/sbin/univention-samba4-backup        2022-11-21 10:23:01.000000000 +0100
+++ univention-samba4-backup        2022-12-27 14:06:25.388375524 +0100
@@ -129,7 +129,7 @@
 
 cd $FROMWHERE
 for d in $DIRS; do
-        relativedirname=`find . -type d -name "$d" -prune`
+        relativedirname=`find . -maxdepth 1 -type d -name "$d" -prune` # IMPORTANT: added -maxdepth 1 to avoid getting other dirs called "private" further down the tree, e.g. deep in the sysvol dir
         n=`echo $d | sed 's/\//_/g'`
         if [ "$d" = "private" ]; then
                 for db in tdb ldb; do
@@ -143,7 +143,12 @@
                                         tdbbackup $file
                                         Status=$?
                                         if [ $Status -ne 0 ]; then
-                                                terminate_on_error "Error while backing up $file with tdbbackup - status $Status"
+                                                echo "Error while backing up $file with tdbbackup - status $Status - will try mdb_copy in case MDB format is used" >&2
+                                                mdb_copy -c -n $file > $file.bak
+                                                Status=$?
+                                                if [ $Status -ne 0 ]; then
+                                                    terminate_on_error "Error while backing up $file with mdb_copy - status $Status"
+                                                fi
                                         fi
                                 fi
                         done


[1] https://help.univention.com/t/pre-update-checks-for-ucs-5-0-0-aborts-warning-about-a-very-large-samba-tdb-database/18014
Comment 1 Arvid Requate univentionstaff 2023-01-11 21:54:26 CET
Please attach the patch as a file so that devs can download and apply it.
Comment 2 Simon Streit univentionstaff 2023-01-12 10:03:49 CET
Created attachment 11020 [details]
Patch to fix bug.
Comment 4 Stefan Gohmann univentionstaff 2023-07-18 15:24:16 CEST
Any updates?

The support ticket is still waiting for a fix.
Comment 7 Arvid Requate univentionstaff 2024-02-15 16:41:56 CET
Should be fixed by the erratum for Bug #56434.

That change adjusted univention-samba4-backup to use
"samba-tool domain backup offline" instead of our code.

*** This bug has been marked as a duplicate of bug 56434 ***