Cronjobs and scripts not running - zsh permission denied - sudo process unexpected status 0x57f

Hi,

I am running TrueNAS scale version ElectricEel-24.10.1 and there are two different odd behaviours that I’ve been experiencing.

First Odd Behaviour

There is a cronjob that was configured to run many versions prior to this update which continues to work with this update. Now after this update, I’ve tried to schedule a cronjob that resides in the /mnt/ path.

It looks something like this:
root@truenas[~]# ls -al /mnt/path/to/script/script.sh

-rwxr-xr-x 1 user1 group1 2078 May 20 12:01 /mnt/path/to/script/script.sh

Running it manually results it working just fine but scheduling it results in the following errors:

May 29 00:00:01 truenas cron[14128]: (root) CMD (/mnt/path/to/script/script.sh)
May 29 00:00:01 truenas cron[14128]: sudo: process 1060311 unexpected status 0x57f
May 29 00:00:01 truenas cron[14128]: Killed

cronjob is running under root and sudo is not involved so not sure why this error pops up. Can’t share the script here but I use the following shebang #!/bin/bash and below is the cronjob config:

Second Odd Behaviour

Running a script in /tmp results in zsh: permission denied error even though file ownerships and permissions are correct.

root@truenas[~]# whoami
root
root@truenas[~]# ls -al /tmp/testscript.sh
-rwx------ 1 root root 111 May 20 12:15 /tmp/testscript.sh
root@truenas[~]# /tmp/testscript.sh
zsh: permission denied: /tmp/testscript.sh
root@truenas[~]# chmod 777 /tmp/testscript.sh
root@truenas[~]# /tmp/testscript.sh
zsh: permission denied: /tmp/testscript.sh

Running the same script within root home directory doesn’t cause any issue and it runs fine. I’ve seen some tickets addressing above issues but I couldn’t understand what the fix is. Please help. Cheers,

/tmp is mounted noexec, probably.

For your other script put this at the top after the shebang line as a debugging aid:

exec >/tmp/debug.txt 2>&1
set -x

just change your command as below :

/bin/bash /mnt/path/to/script/script.sh

What is script trying to do? Out of box, for instance, you won’t be able to use gdb to attach to processes and it can result in an error message like this IIRC.

Thanks folks for the quick responses,

@pmh I’ve already tried it but the script doesn’t even start executing and fails.

@smione that worked. thanks very much. Can you please explain why did this work and adding just the shebang didn’t work?

@awalkerix script just lists directories for each user in descending order based on size.

Mainly due to restrictions from TrueNAS design.

If interested you can find more details in our related discussion thread

2 Likes