Remote unlock fails

Hi !

With Truenas 25.04 i unlocked my dataset via the rest api but with 25.10 it seems not to work. i always get a failure

Unlocking TrueNAS…
GET http://192.168.X.X/api/v2.0/pool/dataset (listing dataset ids)…
POST http://192.168.X.X/api/v2.0/pool/dataset/unlock (unlocking nas_pool/tvheadend)…curl: (22) The requested URL returned error: 400
{“message”: “The following attributes are not expected: unlock_options”}

Is there a way to do this with the new truenas version ?

Ciao gerd

I don’t know the exact cause for your current error (and you don’t mention how you’re currently sending those commands) but I do know that the REST API was deprecated in 25.04 and will be removed entirely in 26.

It’s being replaced by Websocket which is already available in the version you’re currently running. Perhaps now is a good time for you to swap over to that?

If it’s not something you can do at this very moment then I recommend looking into if your API client has changed somehow, I very much doubt that iX made changes to the REST API in 25.10, so server-side it should be static. Your error suggests the client request is malformed.

Hi !

Sure its a good time to turnover, but im not really familar with that stuff (doing that with api was google work :slight_smile:
so if you have an idea => let me know i will try ..

Ciao Gerd

The 400 error is because the API schema changed in 25.10 - the unlock_options wrapper got removed, so the endpoint no longer recognises that parameter name. The parameters now go directly into the request body instead of nested under unlock_options.

Easiest path forward though is to switch to midclt which is already on the box and will not break across API versions:

midclt call pool.dataset.unlock "nas_pool/tvheadend" '{"datasets": [{"name": "nas_pool/tvheadend", "passphrase": "your_passphrase"}]}'

You can drop that into your unlock script as a direct replacement for the curl call. No authentication headers needed since midclt talks to the middleware directly on the local machine.

If you do want to keep using the REST API, the corrected call just sends the parameters at the top level of the JSON body without the unlock_options key wrapping them.

I stand corrected, thank you!

Hi !

OK im a litte bit far…. logged (as truenas_admin) on the local machine if i execute this , the dataset will be unlocked..

If i execute it via ssh remotely it does nothing (in both cases i get a kind of numerical results)

 ssh truenas_admin@192.168.X.X 'midclt call pool.dataset.unlock "nas_pool/tvheadend" '{"datasets": [{"name": "nas_pool/tvheadend", "passphrase": "password"}]}''

Ciao Gerd

Hi !

So how the curl call should look alike ?

Ciao Gerd

Curl? What do you mean, the command doesn’t involve curl.

In your post you show that you used ssh to directly run the command, did you use ssh previously as well, when it worked? Your initial post suggests you did it differently.

You obviously shouldn’t post any secret passphrases, but just to double-check: You did modify the command given by PaddraighOS so that it matched your nas name and included your passphrase, right?

Hi !

Right :slight_smile: i do not want to write my password down here .

Sry for misunderstanding… with last version i used a pyton script which i found here around to unlock it via remote (and it worked untill the upgrade)
Now im looking for a new solution to do this, on of them is e.g. to unlock it via remote ssh command.

I am thankfull for any other variant to do so :slight_smile:

In the previous post ir tried woith abouve mentioned shell command.. And as i wrote => kogged into the NAS it worked but doing this remotely it doesnt (also is not really clear for me what the changing numeric response mean)

IF you can give me a matching curl command, i will try this. :slight_smile:

Ciao Gerd

You could try posting the python script you have (with your passphrase redacted of course) and maybe someone here can suggest how to change it.

Hi !

Here we go…. all external things which are needed are filled correctly…

truenas_unlock.sh (3.1 KB)

Ciao Gerd