Code-server: systemd unit won't persist

Created on 19 May 2020  路  17Comments  路  Source: cdr/code-server

  • Web Browser: Chrome 81.0.4044.129
  • Local OS: Windows 10 10.0.18363 Build 18363
  • Remote OS: Debian 10
  • code-server --version: 3.3.0 52eeccaba1c20279592d790b053639b5ad8ac99d
    Note: running behind Apache reverse-proxy

Last night, I re-built my development server and installed Code Server 3.3 using the guide provided (thanks!). Previously, I managed it via a systemd service which launched it on start-up and kept it running -- the guide now states to use 'systemctl --user restart code-server,' which works fine and launches it when the shell is open, but closes it when I close the shell. Is this behavior by design / is there any guidance for keeping it running?

needs-investigation

Most helpful comment

I think I might have fixed it. Tried a reboot with this and works normally now:
sudo loginctl enable-linger username
Sorry for all of the the trouble; appreciate the work you guys put into this.

All 17 comments

If you run:

systemctl --user enable --now code-server

As mentioned in the guide, it should launch on startup.

restart is only for reloading from the config file.

If that doesn't work, lmk and I'll reopen this issue.

Same behavior with that command. Stays open for as long as the Terminal window is open.

Interesting, will try to reproduce.

Just as a note, I've upgraded to 3.3.1 6f1309795e1cb930edba68cdc7c3dcaa01da0ab3 with same behavior observed.

Seems to work for me.

I created a Debian 10 VM on GCP and then installed code-server with the instructions from the guide. Then followed the guide to setup a self signed certificate and listen on 0.0.0.0:443. Verified I could connect to the instance's public IP and then rebooted.

Confirmed I could access code-server once the instance was up. Did not login into the VM until I verified I could access code-server.

Might be something different about your systemd setup.

We're also using a systemd service but it's a systemd user service.

It's at https://github.com/cdr/code-server/blob/aa872701481ad371f25a6cc7042ca1e55d05e782/ci/build/code-server.service and installed as part of the .deb.

What does systemctl get-default print?

Prints graphical.target

Seems right to me.

How about systemctl --user status code-server?

image

It's perplexing. It works as long as my user is logged in, and Nagios confirms that Node is running, but as soon as I exit the terminal, the application stops and Nagios says Node is not running.

Do you see any logs in journalctl --user -u code-server?

Negatory.

I'm stumped. Can you try a fresh machine with Debian 10?

Yeah, I can. This was basically straight off a clean Deb10 distro last night, so I'm not sure what good it will do, but I'll try and let you know. The only slight deviation off your guide is that I'm running it through an Apache reverse proxy as opposed to Caddy; not sure if that would make a difference.

Shouldn't be a problem re Apache.

Weird thing is also I just tested a fresh Deb10 machine on GCP so then I'm not sure what the difference is between our setups.

If you copy the systemd user service and turn it into a system service, do things operate as expected?

I tried that earlier, copying it into /etc/systemd/system, running systemctl start code-server -- it would say that it was active, but nothing would happen.

Here's my Apache and config files for further
image
image

I think I might have fixed it. Tried a reboot with this and works normally now:
sudo loginctl enable-linger username
Sorry for all of the the trouble; appreciate the work you guys put into this.

I think I might have fixed it. Tried a reboot with this and works normally now:

Nice 馃殌

Sorry for all of the the trouble; appreciate the work you guys put into this.

All good, appreciate the discusssion, didn't know you could configure lingering.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justmao945 picture justmao945  路  3Comments

korzq picture korzq  路  3Comments

infogulch picture infogulch  路  3Comments

RealSlimMahdi picture RealSlimMahdi  路  3Comments

KSXGitHub picture KSXGitHub  路  3Comments