[Samba] Error after upgrade NT_STATUS_INTERNAL_DB_CORRUPTION

Rowland penny rpenny at samba.org
Wed Jul 24 16:31:04 UTC 2019


On 24/07/2019 17:05, Rowland penny via samba wrote:
> On 24/07/2019 16:01, Carlos via samba wrote:
>> Hi
>>
>> samba-tool dbcheck
>> ERROR(<class 'KeyError'>): uncaught exception - 'No such element'
>>   File 
>> "/opt/samba/lib/python3.6/site-packages/samba/netcmd/__init__.py", 
>> line 185, in _run
>>     return self.run(*args, **kwargs)
>>   File 
>> "/opt/samba/lib/python3.6/site-packages/samba/netcmd/dbcheck.py", 
>> line 141, in run
>>     check_expired_tombstones=selftest_check_expired_tombstones)
>>   File "/opt/samba/lib/python3.6/site-packages/samba/dbchecker.py", 
>> line 221, in __init__
>>     self.tombstoneLifetime = int(res[0]["tombstoneLifetime"][0])
>
> I think this is a python 3 problem, the code around line 221 in 
> dbchecker is this:
>
>         res = samdb.search(base=ntds_service_dn,
>                            scope=ldb.SCOPE_BASE,
>                            expression="(objectClass=nTDSService)",
>                            attrs=["tombstoneLifetime"])
>         if "tombstoneLifetime" in res[0]:
>             self.tombstoneLifetime = int(res[0]["tombstoneLifetime"][0])
>         else:
>             self.tombstoneLifetime = 180
>
> It searches in AD to find the tombstone lifetime and it looks like the 
> search works, because the line that fails:
>
> self.tombstoneLifetime = int(res[0]["tombstoneLifetime"][0])
>
> is only run if 'tombstoneLifetime' is in the search result, so it 
> seems to be found, but then not found ????
>
> Let me think about this to see if I can come up with a fix.
>
> Rowland
>
>
>
OK, when I actually checked a DC running 4.10.6, the code actually looks 
like this:

         res = samdb.search(base=ntds_service_dn,
                            scope=ldb.SCOPE_BASE,
                            expression="(objectClass=nTDSService)",
                            attrs=["tombstoneLifetime"])
         self.tombstoneLifetime = int(res[0]["tombstoneLifetime"][0])

but in 'master', it now looks like this:

         res = samdb.search(base=ntds_service_dn,
                            scope=ldb.SCOPE_BASE,
                            expression="(objectClass=nTDSService)",
                            attrs=["tombstoneLifetime"])
         if "tombstoneLifetime" in res[0]:
             self.tombstoneLifetime = int(res[0]["tombstoneLifetime"][0])
         else:
             self.tombstoneLifetime = 180

So, try opening 'dbchecker.py' in your favourite editor and make it look 
like the latter and try again.

/usr/lib/python3/dist-packages/samba/dbchecker.py

Starts at line 217

Rowland






More information about the samba mailing list