[PATCH] Create a custom testenv from backup-file for manual testing

Tim Beale timbeale at catalyst.net.nz
Wed Nov 7 20:27:43 UTC 2018

Hi Andreas,

OK, that's weird. Do you have the lmdb-utils package installed? It's
needed for mdb_copy(), which samba-tool is trying to run at the point it

The ubuntu dependencies listed on the wiki should be correct, but the
other distros may need updating to include this package.


On 8/11/18 5:10 AM, Andreas Schneider wrote:
> On Tuesday, 30 October 2018 21:52:19 CET Tim Beale via samba-technical wrote:
>> The attached patch allows you to easily spin up any custom testenv that
>> you want, for manual testing. All you need is a backup-file that the
>> testenv DC will be based off.
>> The main use-case is any testing that involves a large database.
>> Creating user accounts is slow. Even with the improvements to the
>> traffic_replay user generation, creating 5,000 users still takes close
>> to 10 minutes. Instead of creating a blank testenv and slowly populating
>> it with users, you can do this step once, take a backup, and then spin
>> up the backup database multiple times as a new testenv.
>> This testenv might be useful in other situations too. E.g. testing
>> migrating databases across samba versions, you spot a DB corruption and
>> want to try diagnosing/fixing it without completely losing the original
>> problem state, you want to create a labdc-replica testenv of a real
>> network, etc.
>> Also fixed a couple of minor dnsupdate problems that were making
>> debugging testenv bootstrapping issues difficult.
>> CI pass: https://gitlab.com/catalyst-samba/samba/pipelines/34756736
> Hi Tim,
> running make test locally, I get:
> ERROR(<type 'exceptions.OSError'>): uncaught exception - [Errno 2] No such 
> file or directory                                                                              
>   File "bin/python/samba/netcmd/__init__.py", line 184, in _run                                                                                                           
>     return self.run(*args, **kwargs)                                                                                                                                      
>   File "bin/python/samba/netcmd/domain_backup.py", line 982, in run                                                                                                       
>     self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             
>   File "bin/python/samba/netcmd/domain_backup.py", line 907, in backup_smb_dbs
>     copy_function(sam_file)
>   File "bin/python/samba/netcmd/domain_backup.py", line 866, in 
> offline_mdb_copy
>     mdb_copy(path, path + self.backup_ext)
>   File "bin/python/samba/mdb_util.py", line 35, in mdb_copy
>     status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)
>   File "/usr/lib64/python2.7/subprocess.py", line 185, in check_call
>     retcode = call(*popenargs, **kwargs)
>   File "/usr/lib64/python2.7/subprocess.py", line 172, in call
>     return Popen(*popenargs, **kwargs).wait()
>   File "/usr/lib64/python2.7/subprocess.py", line 394, in __init__
>     errread, errwrite)
>   File "/usr/lib64/python2.7/subprocess.py", line 1047, in _execute_child
>     raise child_exception
> Failed to create backup using:
> NSS_WRAPPER_HOSTS='/home/asn/workspace/projects/samba/st/hosts' 
> projects/samba/st/dns_host_fie"  KRB5_CONFIG="/home/asn/workspace/projects/
> samba/st/backupfromdc/etc/krb5.conf" KRB5CCNAME="/home/asn/workspace/projects/
> samba/st/offlinebackupdc/krb5_ccache"  ./bin/amba-tool domain backup offline -
> s /home/asn/workspace/projects/samba/st/backupfromdc/etc/smb.conf --
> targetdir=/home/asn/workspace/projects/samba/st/tmp/9r3r9134qP at /home/asn/
> workspace/projects/samba/selftest/target/Samba4.pm line 2701.
> failed to start up environment 'offlinebackupdc' at /home/asn/workspace/
> projects/samba/selftest/target/Samba.pm line 83.                                                 
> samba can't start up known environment 'offlinebackupdc' at /home/asn/
> workspace/projects/samba/selftest/selftest.pl line 983.

More information about the samba-technical mailing list