Cannot create NFS share (sqlite3.OperationalError)

lpwevers

Cadet
Joined
Apr 7, 2021
Messages
3
Hello,

I did a clean install of TrueNAS-12.0-U2.1. In the storage pool I have 2 datasets that I'd like to share via NFS. Creating the first share went fine, however, when I try to create the share for the other dataset I get this error:
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.OperationalError: unable to open database file

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/nfs.py", line 318, 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 33, in insert
    result = 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 69, 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.OperationalError: (sqlite3.OperationalError) unable to open database file
[SQL: INSERT INTO sharing_nfs_share (nfs_paths, nfs_comment, nfs_network, nfs_hosts, nfs_alldirs, nfs_ro, nfs_quiet, nfs_maproot_user, nfs_maproot_group, nfs_mapall_user, nfs_mapall_group, nfs_security, nfs_enabled) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
[parameters: ('["/mnt/Data/ISO"]', '', '', '', 0, 0, 0, '', '', '', '', '', 1)]
(Background on this error at: http://sqlalche.me/e/e3q8)


Normally, I'd try to give the NAS a reboot, but since it's running production I can't just do that. Any suggestion on how to fix this issue would be greatly appreciated.
 

lpwevers

Cadet
Joined
Apr 7, 2021
Messages
3
Ah, never mind, I managed to fix it. I found out that /data/freenas-v1.db was read only. Then using 'lsof' gave me the pid of the locking process. That turned out to be something called 'middlewared'

So I did a
Code:
service middlewared restart

and after that I was able to add the share using the web interface.
 
Top