Skip to main content
Topic: Bootlogd in runit (Read 381 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Bootlogd in runit

How does one configure bootlogd under runit? I see there is a dinit service script but nothing for runit, even though bootlogd is a dependency.

Since bootlogd copies the data sent to /dev/console into a logfile, I assume one needs to create a script in /usr/lib/rc/sv.d and symlink it to /etc/rc/sysinit, to start running already in runlevel 1. Should the script come before everything else to capture all the output, i.e. something like 00-bootlogd? Or will this break something?

Has anyone experimented with this, and why is it only supported for dinit?

I'd appreciate any insight, just noticed it yesterday.

 

Re: Bootlogd in runit

Reply #1
So it turns out there is a script /usr/lib/rc/sv.d/bootlogd which I somehow didn't notice before. The earliest I can link it in /etc/rc/sysinit without triggering any errors is right after 05-root.

My only question now is where does it go in /etc/rc/shutdown?

I tried putting it last, but it doesn't catch anything past 40-misc, since it probably gets killed by kill_all (which matches all processes with session id not 0 or 1, and on my system bootlogd has session id around 510). Is there any way to stop bootlogd getting killed to also capture later events?

Maybe something like this in 40-misc?
Code: [Select]
kill_all(){
    SESSION_IDS=0,1
    test -f /run/bootlogd.pid && SESSION_ID+=,$(< /run/bootlogd.pid)
    pkill --inverse -s$SESSION_IDS -TERM
    sleep 1
    pkill --inverse -s$SESSION_IDS -KILL
}