Hey everybody,
I am setting up a vagrant vm to test out nomad, I know about the dev mode, but I wanted to build a mini cluster on my machine.
This machine is a nomad server, to set it up I am following the official documentation.
The problem is that I am struggling to start nomad as nomad user.
This is the systemd output with the failure status=1
nomad.service - Nomad
Loaded: loaded (/etc/systemd/system/nomad.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2022-09-25 19:22:28 UTC; 1s ago
Docs: https://www.nomadproject.io/docs/
Process: 5848 ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d (code=exited, status=1/FAILURE)
Main PID: 5848 (code=exited, status=1/FAILURE)
CPU: 85ms
Journalctl :
Sep 25 19:29:44 server nomad[7030]: ==> Error loading configuration from /etc/nomad.d: open /etc/nomad.d: permission denied
Sep 25 19:29:44 server systemd[1]: nomad.service: Main process exited, code=exited, status=1/FAILURE
Sep 25 19:29:44 server systemd[1]: nomad.service: Failed with result 'exit-code'.
It’s clear this is a permission issue but why I have no clue.
This are the permissions on /etc/nomad.d/
drwx------ 2 root root 4096 Sep 25 19:18 .
drwxr-xr-x 73 root root 4096 Sep 25 19:18 ..
-rw-r--r-- 1 root root 373 Sep 25 19:18 server.hcl
This is my nomad service file, pretty standard since it’s from the official docs:
[Unit]
Description=Nomad
Documentation=https://www.nomadproject.io/docs/
Wants=network-online.target
After=network-online.target
# When using Nomad with Consul it is not necessary to start Consul first. These
# lines start Consul before Nomad as an optimization to avoid Nomad logging
# that Consul is unavailable at startup.
#Wants=consul.service
#After=consul.service
[Service]
# Nomad server should be run as the nomad user. Nomad clients
# should be run as root
User=nomad
Group=nomad
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d
KillMode=process
KillSignal=SIGINT
LimitNOFILE=65536
LimitNPROC=infinity
Restart=on-failure
RestartSec=2
[Install]
WantedBy=multi-user.target
I am pretty sure it’s something stupid or embarassing preventing nomad to run as nomad user.
Do you any advice ?
Thanks to anyone kind enough to reply
I did not state it before but if I run nomad as root user, everything is fine.