Creating SMB user account on TrueNAS 25.04.2.6 results in "passdb.tdb lacks expected key"

I built a replacement TrueNAS server and are preparing for production use. It will primarily be used for media storage and local streaming. I have replicated the datasets from the existing TrueNAS server. While creating some more SMB User accounts I keep getting a validation error: “USER_noel: passdb.tdb lacks expected key”.

I have searched for this error online and while not getting an exact match, an AI summary mentions deleting /var/db/system/samba4/private/passdb.tdb and if that does not exist deleting secrets.db. In my case, passdb.tdb does exist in that location (I am logged into the shell as local as local admin). I have listed below the possible AI resolution and the full Validation Error. I hope someone may help me otherwise it’ll be a pain to reinstall TrueNAS.

Possible AI resolution

If the passdb.tdb file is missing or corrupted, a common workaround is to remove the file and regenerate it. This can be done by stopping the SMB service, removing the file at /var/db/system/samba4/private/passdb.tdb, and then running midclt call smb.synchronize_passdb -job to rebuild the database. However, this approach should be used cautiously, as it may affect existing user authentication data. In some cases, the secrets.tdb file may also need to be deleted if passdb.tdb is absent, though this is less common. Ensuring that all SMB-enabled users have valid passwords is essential to prevent the passdb.tdb from failing to initialize.

Validation Error

USER_noel: passdb.tdb lacks expected key

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/api/base/server/ws_handler/rpc.py”, line 323, in process_method_call
result = await method.call(app, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/api/base/server/method.py”, line 52, in call
result = await self.middleware.call_with_audit(self.name, self.serviceobj, methodobj, params, app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 911, in call_with_audit
result = await self.call(method, serviceobj, methodobj, params, app=app,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 720, in call
return await methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/service/crud_service.py”, line 256, in create
return await self.middleware.call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 731, in call
return await self.run_in_executor(prepared_call.executor, methodobj, *prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 624, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/service/crud_service.py”, line 294, in nf
rv = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/api/base/decorator.py”, line 101, in wrapped
result = func(*args)
^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/account.py”, line 738, in do_create
self.middleware.call_sync(‘smb.update_passdb_user’, data | {‘id’: pk})
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 1041, in call_sync
return methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/plugins/smb
/passdb.py", line 38, in update_passdb_user
existing_entry = self.passdb_list([[‘username’, ‘=’, user[‘username’]]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/api/base/decorator.py”, line 101, in wrapped
result = func(*args)
^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/smb/passdb.py”, line 31, in passdb_list
self.synchronize_passdb(True).wait_sync(raise_error=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/smb/passdb.py”, line 75, in synchronize_passdb
pdb_entries = {entry[‘user_rid’]: entry for entry in query_passdb_entries(, {})}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/smb/util_passdb.py”, line 334, in query_passdb_entries
return filter_list(passdb_entries(as_dict=True), filters, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/utils/init.py”, line 601, in filter_list
rv = list(list)
^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/plugins/smb
/util_passdb.py", line 313, in passdb_entries
parsed = parse_passdb_entry(hdl, entry[‘key’], entry[‘value’])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/middlewared/plugins/smb
/util_passdb.py", line 281, in parse_passdb_entry
raise PassdbMustReinit(f’{key}: passdb.tdb lacks expected key’) from None
middlewared.plugins.smb
.util_passdb.PassdbMustReinit: USER_noel: passdb.tdb lacks expected key

The AI solution is nonsense as is typical for chatbot help. That’s an unusual error. Can you PM me a debug?

Issue magically resolved on rebooting TrueNAS - troublehooting 101!

The file is stored on tmpfs, so it’s not surprising it went away on reboot.

1 Like