Seafile services Debian 11

I have just installed Seafile CE 9.0.10 Server on Debian 11 Bullseye. I have been running Seafile for years, so I’m pretty comfortable with it. But now, for some reason, I cannot get the services (seafile and seahub) to autostart! The only thing that works it to type “.[path to]seafile.sh start” and “.[path to]seahub.sh start” after booting up my server.

I was previously running Ubuntu 20.04, having migrated there from CentOS 8. Seafile is installed to /opt/seafile/seafile-server-latest. Can anyone see anything obviously wrong with this?

seafile.service:
[Unit]
Description=Seafile
After=mysql.service
After=network.target

[Service]
Type=forking
ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

seahub.service:
[Unit]
Description=Seafile
After=mysql.service
After=network.target

[Service]
Type=forking
ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start
ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop

[Install]
WantedBy=multi-user.target

Thanks!

You must execute systemctl as root, but Seafile should not be run under root.

Hence you must add:

User=seafile
Group=seafile

to both unit files.

Additionally, you should add seafile.service as a requirement to the seahub unit file.