-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Running code-server as systemd service on Ubuntu #3652
-
Hi,
I'm trying to run code-server as a systemd service on Ubuntu 20.04
Here's my service unit
[Unit]
Description=VSCode on the web
After=nginx.service
[Service]
User=user
Group=user
WorkingDirectory=/home/user/coder
Environment="PATH=/home/user/coder"
ExecStart=/usr/bin/code-server --bind-addr 127.0.0.1:8888
[Install]
WantedBy=multi-user.target
But keep running into this error when I tried to start the service with: systemctl start code-server
systemctl status code-server
●くろまる code-server.service - VSCode on the web
Loaded: loaded (/lib/systemd/system/code-server.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021年06月22日 12:12:17 AEST; 7s ago
Process: 525044 ExecStart=/usr/bin/code-server --bind-addr 127.0.0.1:8888 (code=exited, status=127)
Main PID: 525044 (code=exited, status=127)
systemd[1]: Started VSCode on the web.
code-server[525044]: /usr/bin/env: ‘sh’: No such file or directory
systemd[1]: code-server.service: Main process exited, code=exited, status=127/n/a
systemd[1]: code-server.service: Failed with result 'exit-code'.
If I'm on a console window, logged in as user user
, I can run this command /usr/bin/code-server --bind-addr 127.0.0.1:8888
without any issue and code-server
is working properly.
here's the user's line in /etc/passwd
user:x:1000:1000:User Name,,,:/home/user:/bin/bash
I'm confused. Not sure where to look at
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 2 replies
-
code-server[525044]: /usr/bin/env: ‘sh’: No such file or directory
Hmmm 🤔 Maybe @code-asher or @oxy knows
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
Thanks for your suggestions, I'll try and feedback later. The service unit content was copied from another issue thread in this repo. sh
is by default in the system wide PATH
environment (/etc/environment
), so looks like the ENVIRONMENT=...
is not needed at all. :) I'm still quite new with setting up services in Linux.
/home/user/coder
is just an empty directory where code-server
use as working dir
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
confirm that after removing the Environment=...
line from my code-server.service
, code-server was able to startup
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 2