girlbossceo / conduwuit

a very cool, featureful fork of conduit
https://conduwuit.puppyirl.gay/
Apache License 2.0
288 stars 39 forks source link

Can't start it via systemd - status=226/NAMESPACE #554

Open jamieleinchen opened 3 weeks ago

jamieleinchen commented 3 weeks ago

Hewwo dear pwogwammers >:3

Introduction Hello, I've been able to run the precompiled Linux Musl Binary from the Release 0.4.5, but when I tried to start it through systemd I get the following errors:

System Information Operating System: Debian 12 CPU Architecture: x86_64

Journalctl log

Aug 16 13:42:53 matrix systemd[1]: Starting conduwuit.service - conduwuit Matrix homeserver...
Aug 16 13:42:53 matrix (onduwuit)[3130]: conduwuit.service: Failed to set up mount namespacing: /run/systemd/unit-root/var/lib/conduwuit: No such file or directory
Aug 16 13:42:53 matrix (onduwuit)[3130]: conduwuit.service: Failed at step NAMESPACE spawning /usr/sbin/conduwuit: No such file or directory
Aug 16 13:42:53 matrix systemd[1]: conduwuit.service: Main process exited, code=exited, status=226/NAMESPACE
Aug 16 13:42:53 matrix systemd[1]: conduwuit.service: Failed with result 'exit-code'.
Aug 16 13:42:53 matrix systemd[1]: Failed to start conduwuit.service - conduwuit Matrix homeserver.

I appreciate your help :)

isosphere commented 3 weeks ago

This is my working systemd service file on Debian bookworm that I offer with no warranty, maybe it will help?

I can't defend every line here, but it's working for me.

[Unit]
Description=conduwuit Matrix homeserver
After=network.target
Documentation=https://conduwuit.puppyirl.gay/
RequiresMountsFor=/var/lib/private/conduwuit

[Service]
DynamicUser=yes
Type=notify

AmbientCapabilities=
CapabilityBoundingSet=

DevicePolicy=closed
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
ProcSubset=pid
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectProc=invisible
ProtectSystem=strict
PrivateDevices=yes
PrivateMounts=yes
PrivateTmp=yes
PrivateUsers=yes
PrivateIPC=yes
RemoveIPC=yes
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service @resources
SystemCallFilter=~@clock @debug @module @mount @reboot @swap @cpu-emulation @obsolete @timer @chown @setuid @privileged @keyring @ipc
SystemCallErrorNumber=EPERM
StateDirectory=conduwuit

RuntimeDirectory=conduwuit
RuntimeDirectoryMode=0750

Environment="CONDUWUIT_CONFIG=/etc/conduwuit.toml"
BindPaths=/var/lib/private/conduwuit:/var/lib/conduwuit
BindPaths=/var/lib/private/conduwuit:/var/lib/private/matrix-conduit

ExecStart=/usr/local/bin/conduit
Restart=on-failure
RestartSec=5

TimeoutStopSec=4m
TimeoutStartSec=4m

StartLimitInterval=1m
StartLimitBurst=5

[Install]
WantedBy=multi-user.target
girlbossceo commented 3 weeks ago

Seems like we need to add the BindPaths= you have there to the Debian systemd unit.