DEV Community

Cover image for rcctl: How to debug in OpenBSD 6.4
nabbisen
nabbisen

Posted on • Updated on • Originally published at obsd.solutions

rcctl: How to debug in OpenBSD 6.4

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
Enter fullscreen mode Exit fullscreen mode

But the reality bit:

# rcctl start gitea # the same to the last step in the above
gitea(failed)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

The result is:

gitea(failed)
Enter fullscreen mode Exit fullscreen mode

After

# rcctl -d restart gitea
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

OK 😆


Reference

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

# rcctl -f start %disabled-service% 
%disabled-service%(ok)
Enter fullscreen mode Exit fullscreen mode
✿ ✿ ✿

Happy serving 🕊

Latest comments (0)