Summary

This post is about a single option around OpenBSD's rcctl , utility to "configure and control daemons and services".

In a word, when running rcctl start %service% fails, using -d option provides good information about why it fails.

Environment

OS: OpenBSD 6.4 amd64

✿ ✿ ✿

A Problem

I tried to build a Gitea server.

I was supposed to complete it with only 4 and a little more steps:



# pkg_add gitea # rcctl enable gitea # nvim /etc/gitea/conf/app.ini # rcctl start gitea

But the reality bit:



# rcctl start gitea # the same to the last step in the above gitea(failed)

I made desperate efforts to check logs and manuals like these:



# rcctl check gitea $ nvim -R /var/www/logs/%some-log% $ nvim -R /var/log/%some-log% $ nvim -R /usr/local/share/doc/pkg-manuals/gitea

But the reality still tasted bitter 😖

There were too little information to find out the way.

The Solution

-d option is.

Before

# rcctl restart gitea

The result is:



gitea(failed)

After

# rcctl -d restart gitea

The result is:



doing _rc_parse_conf doing _rc_quirks gitea_flags empty, using default >web< doing _rc_parse_conf /var/run/rc.d/gitea doing _rc_quirks doing _rc_parse_conf doing _rc_quirks gitea_flags empty, using default >web< doing _rc_parse_conf /var/run/rc.d/gitea doing _rc_quirks doing rc_check doing _rc_parse_conf doing _rc_quirks gitea_flags empty, using default >web< doing _rc_parse_conf /var/run/rc.d/gitea doing _rc_quirks doing rc_check gitea doing rc_start doing _rc_wait start No home directory /nonexistent! doing rc_check Logging in with home = "/". panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=... addr=... pc=...] goroutine 1 [running]: code.gitea.io/gitea/vendor/gopkg.in/ini%2ev1.(*Key).transformValue(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/vendor/gopkg.in/ini.v1/key.go:123 +0x... code.gitea.io/gitea/vendor/gopkg.in/ini%2ev1.(*Key).String(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/vendor/gopkg.in/ini.v1/key.go:130 +0x... code.gitea.io/gitea/vendor/gopkg.in/ini%2ev1.(*Key).MustString(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/vendor/gopkg.in/ini.v1/key.go:202 +0x... code.gitea.io/gitea/modules/setting.NewContext() /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/modules/setting/setting.go:1151 +0x... code.gitea.io/gitea/routers.GlobalInit() /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/routers/init.go:47 +0x... code.gitea.io/gitea/cmd.runWeb(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/cmd/web.go:83 +0x... code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0x... code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0x... code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(... /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x... main.main() /usr/obj/ports/gitea-1.5.0/go/src/code.gitea.io/gitea/main.go:52 +0x... doing _rc_rm_runfile (failed)

How rich the information is!

After all, thanks to Gitea's Github issues: #4692 and #4260 , I found it was caused by the wrong settings of [U2F] section in Gitea's app.ini .



# rcctl restart gitea gitea(ok)

OK 😆

Reference

rcctl has also a force option -f to start disabled service:



# rcctl -f start %disabled-service% %disabled-service%(ok)

✿ ✿ ✿

Happy serving 🕊