Cronicle icon indicating copy to clipboard operation
Cronicle copied to clipboard

[Bug]: Unable to run jobs using shell script plugin as user other than root

Open feerlessleadr opened this issue 11 months ago • 4 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

What happened?

I'm trying to run a job as my main user account, rather than root. I created an exact copy of the shell script plugin, and added in my UID to the advanced section.

However, when I try to run a job associated with that plugin, I get the following error

# Job ID: jm9ue5hmu02
# Event Title: yt-dlp update
# Hostname: pve-ubuntu
# Date/Time: 2025/04/23 16:33:27 (GMT-4)

/usr/bin/env: ‘node’: Permission denied

# Job failed at 2025/04/23 16:33:28 (GMT-4).
# Error 126: Child 16841 crashed with code: 126
# End of log.

Here is my plugin:

Image

and here is the job I'm trying to run:

Image

I'm sure I'm doing something wrong, but I'm not quite sure what it is. My user account (UID 100) doesn't give me a permission error when I type in 'node' in my terminal, but I'm more of a linux noob than not, so I may just be missing something silly.

I followed the directions on this github to get node and everything up and running as well.

Operating System

Ubuntu 24.04.2

Node.js Version

v22.15.0

Cronicle Version

0.9.78

Server Setup

Single Primary with Workers

Storage Setup

Local Filesystem

Relevant log output

# Job ID: jm9ue5hmu02
# Event Title: yt-dlp update
# Hostname: pve-ubuntu
# Date/Time: 2025/04/23 16:33:27 (GMT-4)

/usr/bin/env: ‘node’: Permission denied

# Job failed at 2025/04/23 16:33:28 (GMT-4).
# Error 126: Child 16841 crashed with code: 126
# End of log.

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

feerlessleadr avatar Apr 23 '25 20:04 feerlessleadr

It looks like you've installed Node.js to a location on your server that is not accessible by the other (non-root) user. Guessing you used "nvm" or something like that? It installs to weird locations.

Node.js has to be installed to /usr/bin/node or some other universally accessible location, where all users can access it, for the dynamic user switch feature to work.

jhuckaby avatar Apr 24 '25 02:04 jhuckaby

thanks - I'm kind of at a loss. I did use nvm to install, per the node.js site. I was having issues with systemd not being able to find node as well (therefore stopping it from starting upon boot). I followed the instuctions from this post, and it fixed my issue.

It seems however that even though I have the /usr/bin/node symlinked to the install location, and despite the fact that both root and my user can use node without issue, I'm still facing the same error.

When I run whereis node under root, I get the following:

root@ubuntu-pveserver:~# whereis node
node: /usr/bin/node /root/.nvm/versions/node/v22.15.0/bin/node

When I run it under my user, I get the following:

kevin@ubuntu-pveserver:~$ whereis node
node: /usr/bin/node /home/kevin/.nvm/versions/node/v22.15.0/bin/node

Any advice on what I can do to either continue to trouble shoot this or to fix?

feerlessleadr avatar Apr 24 '25 03:04 feerlessleadr

Ugh, so sorry about this. The "nvm" installer ruins everything. I am really dumbfounded that the Node.js people made it the default and recommended installation option on their website. It breaks everything.

If your server is ephemeral (VM, container, etc.) that you can easily destroy and recreate, I recommend you do that, and install Node.js from NodeSource:

https://github.com/nodesource/distributions#using-ubuntu-nodejs-20

This will install it to the standard, proper location.

Then reinstall Cronicle.

If you cannot easily recreate your server, try to see if you can get "nvm" to "uninstall" Node.js from the two users you installed it under, and then reinstall it from NodeSource as root.

https://www.linode.com/docs/guides/how-to-install-use-node-version-manager-nvm/#nvm-uninstall-steps

Good luck, and sorry!

jhuckaby avatar Apr 24 '25 03:04 jhuckaby

no worries at all my friend! I'll restore my VM backup to before I installed eveything and will start fresh using your instructions.

thanks!

feerlessleadr avatar Apr 24 '25 03:04 feerlessleadr