I converted an old Windows laptop into a Linux machine for occasional server use. It runs CachyOS with GNOME, and I've already set up Node.js, port forwarding, SSH key authentication, and a systemd service for Foundry VTT. The service is enabled and uses Restart=on-failure, but after reboot the laptop remains at the graphical login screen and eventually goes to sleep. The server becomes available only after I log in locally.
What's the proper way to have the Foundry service start and remain available after a reboot without requiring an interactive desktop login? Would automatic login be sufficient, or should I configure the service differently so the machine can stay locked while the server continues running?
4 Answers
A system service should run at boot regardless of whether anyone is logged into GNOME. If you can SSH in after reboot, check the service with `systemctl status your-service-name` and inspect its boot logs with `journalctl -u your-service-name -b`. That will show whether it started successfully or failed because of a dependency, working-directory issue, permissions, or environment variable that is only present in your desktop session.
Automatic login would probably make the current setup work, but it’s more of a workaround than a server configuration. Since this laptop is in your home and is already normally logged in, it may be acceptable for your risk tolerance, but I’d still fix the service scope and disable suspend first. Running Foundry in a container is another option: a Docker or Podman container with a restart policy can start automatically and keep the application isolated, with its data stored in a persistent directory.
Login and sleep are separate issues. Configure GNOME’s power settings so the machine never suspends while plugged in, and check that no other power-management service is overriding them. You don’t need to leave the desktop unlocked for a properly configured system service to keep running; the computer can remain at the login screen or have the session locked.
This sounds like the service may actually be a user-level systemd service. User services normally stop being started when that user is logged out unless lingering is enabled. The cleanest setup is to put Foundry in a system-level unit under `/etc/systemd/system/`, run it as a dedicated non-root user, enable it with `systemctl enable --now`, and make sure the unit has the required paths and environment explicitly defined. Alternatively, enable lingering for the account with `loginctl enable-linger username` so its user services can run without an active login.

Even with lingering enabled, check the unit after a reboot rather than assuming it worked. A system-level service is usually easier to reason about for a machine that is primarily acting as a server.