retro-aim-server icon indicating copy to clipboard operation
retro-aim-server copied to clipboard

SQlite error when launching as systemd service

Open CursedSilicon opened this issue 7 months ago • 1 comments

Subject of the Issue

Retro-Aim-Server (RAS) does not start when deployed as a systemd service

Deployment Environment

  • Retro AIM Server Version: 0.16.1
  • Installation Method: Pre-Built, Linux x86_64
  • Other Relevant Details: Host is running Gentoo Linux x86_64

Steps to Reproduce

Added user "retroaim" and attached to group "retroaim"

Modified systemd .service file User and Group to match. Removed built in launch configuration and specified config to RAS settings file instead

Expected Behavior

Retro AIM Server runs

Actual Behavior

Sqlite seems to fail to launch with an "out of memory" error. The system has 32GB of RAM available

su-ing to the retroaim user and invoking the systemd exec function directly launches and operates as expected

Troubleshooting Data

May 10 22:26:37 CGHMN-SHAUN ras[38640]: Successfully loaded config file (/opt/retro-aim-server/settings.env) May 10 22:26:37 CGHMN-SHAUN ras[38640]: error initializing common deps: unable to create feedbag store: failed to run migrations: cannot create database driver: unable to open database file: out of memory (14) May 10 22:26:37 CGHMN-SHAUN systemd[1]: retro-aim-server.service: Main process exited, code=exited, status=1/FAILURE

CursedSilicon avatar May 11 '25 05:05 CursedSilicon

Thanks for reporting!

mk6i avatar May 11 '25 11:05 mk6i

I was able to reproduce this. The issue stems from a missing WorkingDirectory: the service is ran as user ras, however by default, all (root) systemd services are ran under /root (source).

So, the memory in question is not RAM, but disk memory; SQLite tries to write into /root without permissions and fails (and hence why using sudo everything works). The solution is to set WorkingDirectory to a path, where ras has r+w access.

I would suggest the usage of StateDirectory (documentation), since those directories will be created (and managed) by systemd.

Syndamia avatar Jul 05 '25 15:07 Syndamia

Thanks for your analysis, very helpful!

mk6i avatar Jul 05 '25 20:07 mk6i

fixed in v0.19.0

mk6i avatar Aug 25 '25 03:08 mk6i