A
A
andrew_andrey2019-07-29 12:49:50
linux
andrew_andrey, 2019-07-29 12:49:50

Why is there a code=exited, status=210/CHROOT error when running a node.js app as a standalone service with systemd?

Config:

[Unit]
Description=LTPS NodeJS App
After=network-online.target

[Service]
Restart=on-failure
WorkingDirectory=/home/{user}/test-server
ExecStart= /home/{user}/.nvm/versions/node/v10.16.0/bin/nodemon /home/{user}/test-server/app.js

[Install]
WantedBy=multi-user.target

The node is installed via nvm. When starting the service, an error occurs code=exited, status=210/CHROOT. If you add the environment Environment=PATH=/home/{user}/.nvm/versions/node/v10.16.0/bin the error disappears. Can you explain how it works? In most of the configs that I found, the path to the node is /usr/bin and there are no such problems.
In which directory should the service config be kept? /lib/systemd/system or /etc/systemd/system

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TyzhSysAdmin, 2019-07-29
@POS_troi

Because /usr/bin is in the "default" PATH, and "/home/{user}/.nvm/versions/node/v10.16.0/bin" only in the user's
PS forgot
User= / Group=

E
Evgeny Glebov, 2020-09-08
@GLeBaTi

There was such a mistake when the comments were not before setting the parameter, but at the end of the line. For example: you need to replace with (or remove the comment altogether):
WorkingDirectory=/var/www #комментарий

#комментарий
WorkingDirectory=/var/www

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question