Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Bug TrueNAS-12.0-U1.1: Adding "Authorized Access iSCSI User" fails

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

Scampicfx

Member
Joined
Jul 4, 2016
Messages
113
This is the error message which appears when trying to add a user at
Sharing -> Block Shares (iSCSI) -> Authorized Access

Code:
Error: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1247, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 590, in do_execute
    cursor.execute(statement, parameters)
sqlite3.IntegrityError: NOT NULL constraint failed: services_iscsitargetauthcredential.iscsi_target_auth_peersecret

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 137, in call_method
    result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1195, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/local/lib/python3.8/site-packages/middlewared/service.py", line 455, in create
    rv = await self.middleware._call(
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1195, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 973, in nf
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/iscsi.py", line 333, in do_create
    data['id'] = await self.middleware.call(
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1238, in call
    return await self._call(
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1195, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 973, in nf
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/datastore/write.py", line 31, in insert
    await self.middleware.call('datastore.execute_write', table.insert().values(**insert))
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1238, in call
    return await self._call(
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1195, in _call
    return await methodobj(*prepared_call.args)
  File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/datastore/connection.py", line 65, in execute_write
    return await self.middleware.run_in_executor(self.thread_pool, self._execute_write, sql, binds)
  File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1110, in run_in_executor
    return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/datastore/connection.py", line 68, in _execute_write
    result = self.connection.execute(sql, binds)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 976, in execute
    return self._execute_text(object_, multiparams, params)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1145, in _execute_text
    ret = self._execute_context(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1287, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1481, in _handle_dbapi_exception
    util.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1247, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 590, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: services_iscsitargetauthcredential.iscsi_target_auth_peersecret
[SQL: INSERT INTO services_iscsitargetauthcredential (iscsi_target_auth_tag, iscsi_target_auth_user, iscsi_target_auth_secret, iscsi_target_auth_peeruser) VALUES (?, ?, ?, ?)]
[parameters: (1, 'gffdgdfgdfgdf', '/+gorWWdsWMLIz7Vx9JTLuzxIDI9So2JwqhUzlFwm3Hk1sYrQ+tv2g==', '')]
(Background on this error at: http://sqlalche.me/e/gkpj)


Version: TrueNAS-12.0-U1.1

I filled the fields:
- Group ID
- User
- Secret
- Secret (Confirm)

I left these fields blank:
- Peer User
- Peer Secret
- Peer Secret (Confirm)
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
779
That sure does look like a bug. Please file a ticket on jira.ixsystems.com so we can track if this was already resolved in the upcoming 12.0-U2 or if we need to do some additional work to resolve it.
 

headwhacker

Junior Member
Joined
Jan 3, 2021
Messages
17
It is a bug. The SQL insert statement and the error show it's expecting a value on iscsi_target_auth_peeruser.

Filling these up should work even if you don't use mutual CHAP.

- Peer User
- Peer Secret
- Peer Secret (Confirm)
 

smcclos

Junior Member
Joined
Jan 22, 2021
Messages
12
I too am seeing the same problem with TrueNAS-12.0-U1, I used the workaround, I just used no CHAP
 
Top