Fun with dotfiles

When booting OpenBSD 6.3 (at least), the /etc/rc startup script reads /root/.profile. This can produce some rather entertaining boot failures, including things like syslogd timing out on startup, preventing you from getting any log data about what might be wrong…

I’m quite certain this wasn’t the case in earlier releases, but I’m not sure when it crept in.

# Simple confirmation:
echo sleep 60 >> /root/.profile
# It will take an extra ~8 minutes to boot

It looks like they try to work around this by setting HOME=/ in /etc/rc, and having a separate /.profile, but it doesn’t work; it still reads /root/.profile.

Ah, there it is! /etc/rc.d/rc.subr:

rc_start() {
        ${rcexec} "${daemon} ${daemon_flags}"


[ -z "${daemon_user}" ] && daemon_user=root


rcexec="su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c"

So, anything executed from a proper start/stop rc script gets executed in a fresh su -l session (even if it’s running as root), and that resets $HOME.

The machine I was upgrading pre-dates the rc.d scripts, so it didn’t have the problem.

Comments via Isso

Markdown formatting and simple HTML accepted.

Sometimes you have to double-click to enter text in the form (interaction between Isso and Bootstrap?). Tab is more reliable.