Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add void.runit_readproctitle parameter to 2 and new void-runit(8) manpage #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions 2
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,24 @@

PATH=/usr/bin:/usr/sbin

readproctitle='log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'
for arg in $(cat /proc/cmdline); do
case $arg in
'void.runit_readproctitle='* )
doreadproctitle="$(echo "${arg}" | cut -d'=' -f2)"
if [ "0" = "${doreadproctitle}" ]; then
echo 'runit readproctitle disabled: '"${arg}"' (via kernel cmdline)'
readproctitle=
fi
;;
esac
done

runlevel=default
for arg in $(cat /proc/cmdline); do
if [ -d /etc/runit/runsvdir/"$arg" ]; then
echo "Runlevel detected: '$arg' (via kernel cmdline)"
runlevel="$arg"
if [ -d /etc/runit/runsvdir/"${arg}" ]; then
echo 'runit runlevel detected: '"${arg}"' (via kernel cmdline)'
runlevel="${arg}"
Comment on lines -8 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is necessary... I also don't like how quoting is being done.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right, that got in with my refactoring.

First nitpick is, I guess, the long envvar form. I personally prefer "${xxx}" form as it removes 99.99% ambiguities and special cases, and if I remember correctly, it is still proper POSIX.

Despite it being longer to type, I believe it is more readable. This script is not written/edited often, and it does not impact performance. Also due to experiences from work$$$, when I find short forms (eg. "$xxx") I tend to rewrite them subconsciously and automatically to full forms. Seems like that happened here, sorry.

But I do realize now, it might look out of place WTR original void script style. Point taken.

Second nitpick is, I guess, "runit runlevel" string prefix. That was motivated by the fact runlevels are meaningless arbitrary numbers assigned ad-hoc. While other init systems may have many "runleves", runit has only three mandatory ones: 1(postboot/precruise) 2(cruise/main) and 3(shutdown). Other are user assigned. This edit was done, I think, to reduce confusion, that we are actually booting into "runit" runlevel, not "sys v" one (runit does not emulate "sys v" runlevels "systemd style"), but I digress.

Anyway these lines can be reverted back to originals, if it increases the chance of this commit getting in. Your call?

fi
done

Expand All @@ -17,5 +30,11 @@ runsvchdir "${runlevel}"
mkdir -p /run/runit/runsvdir
ln -s /etc/runit/runsvdir/current /run/runit/runsvdir/current

exec env - PATH=$PATH \
runsvdir -P /run/runit/runsvdir/current 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'

if [ -z "${readproctitle}" ]; then
exec env - PATH="${PATH}" \
runsvdir -P /run/runit/runsvdir/current
else
exec env - PATH="${PATH}" \
runsvdir -P /run/runit/runsvdir/current "${readproctitle}"
fi
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ install:
install -m644 halt.8 ${DESTDIR}/${PREFIX}/share/man/man8
install -m644 modules-load.8 ${DESTDIR}/${PREFIX}/share/man/man8
install -m644 vlogger.8 ${DESTDIR}/${PREFIX}/share/man/man8
install -m644 void-runit.8 ${DESTDIR}/${PREFIX}/share/man/man8
ln -sf halt.8 ${DESTDIR}/${PREFIX}/share/man/man8/poweroff.8
ln -sf halt.8 ${DESTDIR}/${PREFIX}/share/man/man8/reboot.8
install -d ${DESTDIR}/etc/sv
Expand Down
149 changes: 149 additions & 0 deletions void-runit.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
.Dd October 31, 2018
.Dt void-runit 8
.Os
.Sh NAME
.Nm void-runit
.Nd information about Void Linux implementation of runit
.Sh SYNOPSIS
.Nm kernel
.Op Ar preceding kernel parameters ...
.Op Cm void.runit_readproctitle= Ns Ar 0|1
.Op Ar void_runsvdir
.Op Ar succeeding kernel parameters ...
.Sh DESCRIPTION
Void Linux uses
.Xr runit 8
as it's default
.Xr init 8
system.
.Pp
Like in case of any other
Linux based operating system, original
.Xr runit 8
init scripts have been slightly modified
to better suit Void's needs.
.Pp
Void's
.Xr runit 8
usually does right thing
on it's own, by default, but you
are free to tweak its execution to better
match your installation requirements.
.Pp
This can be done by passing
.Nm
arguments through kernel command line to
.Xr runit 8 Ns .
.Pp
Currently following arguments are supported:
.Bl -tag -width " "
.It Cm void.runit_readproctitle= Ns Ar 0|1
Disables
.Xr runsvdir 8
.Xr readproctitle 8 Ns Ap Ns
s
.Ar log
functionality.
.Pp
This might be desirable on systems where many
.Xr runit 8
services are damaged and are logging too many
error messages per second, causing
.Xr runsvdir 8
to consume excessive amounts of cpu time or
when system's operator is using other tools to
capture uncaught system log messages.
.It Ar void_runsvdir
This is name of specific subdirectory within
.Pa /etc/runit/runsvdir Ns .
.Pp
For
.Xr runit 8
it means same thing what
.Sy runlevel
or
.Sy target
means in other
.Xr init 8
schemes (like system V init or systemd for example).
.Pp
Eg. if you set
.Ar void_runsvdir
to
.Sy default
then
.Xr runit 8
will try to boot into
.Pa /etc/runit/runsvdir/default
directory (aka runlevel).
.Pp
Similarly if you set it to
.Sy single
then
.Xr runit 8
will boot into
.Pa /etc/runit/runsvdir/single Ns ,
which represents
.Sy single user mode Ns .
.Pp
There is no limit in number of
.Sy runsvdirs
(aka runlevels, targets) you can create,
but these
.Sy runsvdir
names are reserved by Void:
.Pp
.Bl -tag -width " " -compact
.It Cm default
.Sy runsvdir
into which Void boots by
default.
.It Cm single
Void boots into this
.Sy runsvdir
when boot error occurs (or when specifically
requsted by operator on kernel command line).
.It Cm current
Symlink to currently active
.Sy runsvdir
on a running system.
.El
.Pp
If not specified,
.Sy default
is assumed.
.Sh EXIT STATUS
Not applicable.
.Sh EXAMPLES
.Bd -literal -offset 0
vmlinuz-4.66.1_7 rw void.runit_readproctitle=0 single
.Ed
.Sh SEE ALSO
.Xr runit 8 ,
.Xr init 8 ,
.Xr runsvdir 8 ,
.Xr runsvchdir 8 ,
.Xr sv 8 ,
.Xr runsv 8
.Sh HISTORY
This manpage was written when
.Cm void.runit_readproctitle=
boot parameter was added to official
.Nm 2
(Void's runit stage 2) script of
.Nm void-runit
scripts package.
.Sh AUTHORS
.An Leah Neukirchen Aq Mt [email protected] .
.An Duncan Overbruck Aq Mt [email protected]
.An Martin Mišúth Aq Mt [email protected]
.Sh LICENSE
.Nm
is in the public domain.
.Pp
To the extent possible under law,
the creator of this work
has waived all copyright and related or
neighboring rights to this work.
.Pp
.Lk http://creativecommons.org/publicdomain/zero/1.0/