New install, systemd stuck on activating

Hi All,

I am trying to install gitea for the first time on Ubuntu server 22.04 LTS

The systemd unit (provided template one that the install documentation suggests using) seems to hang for me. I am just evaluating gitea at this stage, so wanted to just fire it up and let it use sqlite for its storage back-end etc. So I have left the defaults in there.

Here’s the bizarre thing, despite systemd saying the service failed to activate, there is a process running and I can reach the installation page in a web browser if I point it at ip:3000

Running it manually as the suggested ‘git’ user (the same way the systemd unit file attempts to start it)

git@ubuntuserver:~$ export GITEA_WORK_DIR=/var/lib/gitea
git@ubuntuserver:~$ /usr/local/bin/gitea web --config /etc/gitea/app.ini  
2023/11/16 14:17:56 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 6963
2023/11/16 14:17:56 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.21.0 built with GNU Make 4.3, go1.21.4 : bindata, sqlite, sqlite_unlock_notify
2023/11/16 14:17:56 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2023/11/16 14:17:56 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
2023/11/16 14:17:56 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /var/lib/gitea
2023/11/16 14:17:56 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /var/lib/gitea/custom
2023/11/16 14:17:56 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /etc/gitea/app.ini
2023/11/16 14:17:56 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run install page
2023/11/16 14:17:56 cmd/web.go:304:listen() [I] Listen:
2023/11/16 14:17:56 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
2023/11/16 14:17:56 ...s/graceful/server.go:70:NewServer() [I] Starting new Web server: tcp: on PID: 6963

This logging is a bit misleading… “Starting new web server” but there’s never any followup line to say its started, so it gives the impression it might still be attempting to start it - but the fact that I can reach the install page in a web browser would suggest its running?

Is the application meant to run as a daemon? It seems running it this way (like the systemd unit file attempts to) tries to run it in the foreground. This might be what is tripping up systemd, its expecting the command to finish but it never does (so the systemd unit sits there as activating).

Is there something fundamentally wrong with how the example systemd unit tries to launch the application?

The service type in the example systemd unit uses Type=notify

This expects the service to notify systemd with something like sd_notify() when its ready. I dont think this is happening and probably why it just sits there.

Cloned the git source code to look for any calls to sdnotify:

root@ubuntuserver:~/src/gitea# grep -rin 'sdnotify' *

Nada - So I am wondering how the suggested unit file which sets the Type=Notify could possibly work correctly? Am I missing something here?

Setting it to “Simple” would probably work, but “simple” is exactly as it implies, it just executes whatever is in ExecStart and assumes its all happy days from there.


So, until the initial install page has been visited and done, Type=Notify wont play nice it seems.

After visiting the install page and following the instructions, having a type of “Notify” in the unit file works… Strange since i couldnt see any calls to sdnotify in the source code.

Might be worth putting this little curveball in the install documentation perhaps as its bound to have tripped up other people too…

Nov 16 16:06:55 ubuntuserver systemd[1]: Started Gitea (Git with a cup of tea).

the above line only will appear in the log after the initial install page has been completed.