Bug 53221 - With 200k users samba doesn't start after update from UCS 4.4-8 to UCS 5.0-0
With 200k users samba doesn't start after update from UCS 4.4-8 to UCS 5.0-0
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Samba4
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Arvid Requate
Julia Bremer
:
Depends on: 49898 53212
Blocks:
  Show dependency treegraph
 
Reported: 2021-05-04 14:43 CEST by Arvid Requate
Modified: 2023-08-03 18:45 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2019072221000523
Bug group (optional):
Max CVSS v3 score:


Attachments
migrate-samldb-from-tdb-to-mdb (5.85 KB, text/x-python)
2021-06-03 13:21 CEST, Arvid Requate
Details
migrate-samldb-from-tdb-to-mdb (5.53 KB, text/x-python)
2021-06-09 23:29 CEST, Arvid Requate
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2021-05-04 14:43:58 CEST
We need a technical solution for this.

+++ This bug was initially created as a clone of Bug #53212 +++

With 200k users samba doesn't start after update from UCS 4.4-8 to UCS 5.0-0

Something with ldb seems stuck. E.g. this command doesn't return

ldbdel  -H /var/lib/samba/private/sam.ldb foo
Comment 2 Felix Botner univentionstaff 2021-05-11 13:35:28 CEST
We have pre-joined KVM templates, a master with 200.000+ user objects and a backup (4.4-8). This setup can be started with 

-> KVM_BUILD_SERVER=soft-test02 DOCKER=true release_update=testing ./utils/start-test.sh ./product-tests/samba/bigenv-new.cfg

or via jenkins Product-Test -> Samba bigenv

to reproduce the problem.

Once this is fixed, please also update ./product-tests/samba/bigenv-new.cfg!
Comment 3 Felix Botner univentionstaff 2021-05-27 16:52:16 CEST
(In reply to Felix Botner from comment #2)
> We have pre-joined KVM templates, a master with 200.000+ user objects and a
> backup (4.4-8). This setup can be started with 
> 
> -> KVM_BUILD_SERVER=soft-test02 DOCKER=true release_update=testing
> ./utils/start-test.sh ./product-tests/samba/bigenv-new.cfg
> 
> or via jenkins Product-Test -> Samba bigenv
> 
> to reproduce the problem.
> 
> Once this is fixed, please also update ./product-tests/samba/bigenv-new.cfg!

./product-tests/samba/bigenv.cfg
Comment 4 Arvid Requate univentionstaff 2021-06-03 13:21:41 CEST
Created attachment 10745 [details]
migrate-samldb-from-tdb-to-mdb

The attempts with

* samba-tool domain backup online
* samba-tool drs clone-dc-database

had the nasty side effect of changing all uSNChanged/uSNCreated values, which breaks DRS replication unless we also change the invocationId. Maybe that would have worked, but I didn't continue down that road.

I found a solution that seems to work much nicer (less data conversion, less risk, pretty fast, and the other DCs won't even notice). The attached script just works on the key-value backend database level and treats the keys and values as opaque blobs instead of parsing them as LDB objects. At its core it just uses python-tdb to read the TDB files and python-lmdb to write the MDB files and then flips the switch to activate MDB handling in sam.ldb.

It runs dbcheck by default before and after the migration, which can be disabled via command line option (for QA test runs).
Comment 5 Arvid Requate univentionstaff 2021-06-09 23:29:31 CEST
Created attachment 10746 [details]
migrate-samldb-from-tdb-to-mdb

I've adjusted the script to also work with the "encryptedSecrets" feature in more recent Samba versions that causes password hashes on disk to be protected by a layer of encryption.

I've created a new help article: https://help.univention.com/t/pre-update-checks-for-ucs-5-0-0-aborts-warning-about-a-very-large-samba-tdb-database/18014

If that's ok, then we should update the error message in the preup-check to the new article.
Comment 6 Julia Bremer univentionstaff 2021-06-14 09:28:54 CEST
Jenkins: OK
Manual Tests: OK
Reversion in case of error: OK
help-article: OK

TODO: Adjust preup-chekc message accordingly
Comment 7 Arvid Requate univentionstaff 2021-06-14 17:47:32 CEST
3e49b690 Adjust link help.univention.de in preup-check 

Package: univention-updater
Version: 15.0.3-66A~5.0.0.202106141124
Branch: ucs_5.0-0
Scope: errata5.0-0


For QA:

* pre-check-script + gpg (only internal):
  /var/univention/buildsystem2/test_mirror/ftp/download/univention-update-checks/pre-update-checks-5.0-0

* preup.sh + gpg:
  http://updates-test.knut.univention.de/dists/ucs500/
Comment 8 Julia Bremer univentionstaff 2021-06-14 17:53:28 CEST
Message: OK
Released to testing: OK
/var/univention/buildsystem2/test_mirror/ftp/download/univention-update-checks/pre-update-checks-5.0-0 OK

http://updates-test.knut.univention.de/dists/ucs500/ OK

Verified
Comment 9 Julia Bremer univentionstaff 2021-06-14 18:05:04 CEST
The new preup-check has been released