Solving code-server service failing to start after installation
After installing code-server
through the installation script, systemctl can fail to start code-server.service
:
$ systemctl status [email protected]
× [email protected] - code-server
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; preset: enabled)
Active: failed (Result: exit-code) since Thu 2025-02-13 10:58:16 UTC; 32s ago
Process: 847 ExecStart=/usr/bin/code-server (code=exited, status=217/USER)
Main PID: 847 (code=exited, status=217/USER)
CPU: 7ms
Feb 13 10:58:16 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: [email protected]: Scheduled restart job, restart >
Feb 13 10:58:16 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: [email protected]: Start request repeated too quic>
Feb 13 10:58:16 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: [email protected]: Failed with result 'exit-code'.
Feb 13 10:58:16 ubuntu-s-1vcpu-1gb-sgp1-01 systemd[1]: Failed to start [email protected] - code-server.
The fix for me was to edit the service file’s
User=%i
to
User=root
or whatever your username is.
Written on February 13, 2025