Strategies to debug cpython modules during provision

Andrew Bartlett abartlet at samba.org
Tue Apr 10 01:30:12 UTC 2018


On Tue, 2018-04-10 at 11:05 +1000, William Brown via samba-technical
wrote:
> Hi,
> 
> I'm trying to start on some samba4 development. During the provision
> process I have encountered an error:
> 
> Setting up sam.ldb users and groups
> ERROR(ldb): uncaught exception - operations error at
> ../source4/dsdb/samdb/ldb_modules/password_hash.c:3144
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/netcmd/__init__.py", line 176, in _run
>     return self.run(*args, **kwargs)
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/netcmd/domain.py", line 501, in run
>     plaintext_secrets=plaintext_secrets)
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/provision/__init__.py", line 2267, in provision
>     skip_sysvolacl=skip_sysvolacl)
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/provision/__init__.py", line 1866, in provision_fill
>     next_rid=next_rid, dc_rid=dc_rid)
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/provision/__init__.py", line 1527, in fill_samdb
>     }, controls=["relax:0", "provision:0"])
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/provision/common.py", line 55, in setup_add_ldif
>     ldb.add_ldif(data, controls)
>   File "/usr/local/samba/lib64/python2.7/site-
> packages/samba/__init__.py", line 229, in add_ldif
>     self.add(msg, controls)
> 
> 
> Inspecting the code, I see this is from password_hash.c's call to
> smb_krb5_init_context, and reading that code in
> source4/auth/kerberos/krb5_init_context.c between smb_krb5_init_context
> and smb_krb5_init_context_basic I can see some areas that *could* be
> the cause of the issue with regard to the system krb5.conf from MIT vs
> embedded heimdal.

Yep, the includedir statement.  A better error message would be good,
as would be backporting the patch for includedir from modern Heimdal.

> However to be 100% sure, I would like to attach a debugger into this
> process so that I can observe the error.
> 
> As I haven't debugging the samba-tool domain provision process before,
> I would like to know if there is any advice on how to go about doing
> this that could make my life a bit easier. Additionally, it would be
> great to know how to "clean up" after a failed installation like this.

gdb --args python ....

No need to clean up, it wipes every time.  (Somehow nobody has said
they have lost data re-running provision, I don't know why). 

Andrew Bartlett

-- 
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   
https://catalyst.net.nz/services/samba







More information about the samba-technical mailing list