[SOLVED] configctl action throws "Action not allowed or missing" error message

Started by imk82, August 20, 2024, 03:23:02 PM

Previous topic - Next topic
Hi all,

I try to setup a simple cronjob via UI. Unfortunately, I don't get the syntax for creating a respective action.

What I tried:
* read https://docs.opnsense.org/development/backend/configd.html
* created a file "actions_set_powersave_nvme.conf" under "/usr/local/opnsense/service/conf/actions.d"
* see content below
* restarted configd

My problem now is, when I try to test/start it via
configctl actions_set_powersave_nvme restart
I get the following error message:
Action not allowed or missing

Can anyone help me to find my mistake?

Thanks and best regards
Robert

Content of actions_set_powersave_nvme.conf:

[restart]
command:/sbin/nvmecontrol power -p 4 nvme0
parameters:
type:script
message:Setting nvme0 to powerstate 4
description:Set nvme disk 0 to power state 4

August 20, 2024, 04:46:59 PM #1 Last Edit: August 20, 2024, 04:49:01 PM by chemlud
http://kb.unixservertech.com/other/networking/opnsense/cron-jobs

Afterwards configure your cron jobs in GUI with new entry in drop-down menu under

System -> Settings -> Cron


What happens if you enter command directly in the console?
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....

QuoteWhat happens if you enter command directly in the console?

If I execute the command directly via console all is fine and working:
root@jupiter:~ # /sbin/nvmecontrol power -p 4 nvme0
root@jupiter:~ # echo $?
0
root@jupiter:~ # /sbin/nvmecontrol power nvme0
Current Power State is 4
Current Workload Hint is 0


I can select the action as well via Web GUI. But it is not working and in the console I see the error when trying to run it via configctl.

Action not allowed or missing

August 21, 2024, 01:20:47 PM #3 Last Edit: August 21, 2024, 01:26:26 PM by imk82
Ok, after digging a little deeper into the topic and the respective python code, it seems to be a generic error if the the action is not found which can have multiple reasons.

The most obvious one in my case is the leading actions_ in my configctl call which is plain wrong. Just for the notes, a call to configctl action ... or similar is as well not supported, same for a fullqualified path to the action.

So to sum up, what works a the end is:

/usr/local/opnsense/service/conf/actions.d/actions_nvmepowersave.conf:

[start]
command:/sbin/nvmecontrol power -p 4 nvme0
parameters:
type:script
message:Setting nvme0 to powerstate 4
description:Set nvme disk 0 to power state 4


working test call:

root@jupiter:~ # service configd restart
Stopping configd...done
Starting configd.
root@jupiter:~ # configctl nvmepowersave start
OK