While installing gentoo into a VM, I observed the following behaviour: (chroot) livecd init.d # rc-update add net.eth0 * service net.eth0 added to runlevel sysinit For reference the version of openrc in the instance was: (chroot) livecd init.d # emerge -pv openrc These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-apps/openrc-0.24.2::gentoo USE="ncurses netifrc pam unicode -audit -debug -newnet (-prefix) (-selinux) -static-libs" 208 KiB Total: 1 package (1 reinstall), Size of downloads: 208 KiB I would expect in the absence of a runlevel being specified the service to be added to the default runlevel, or the command to fail with a message saying to specify the runlevel. The current behaviour is, in my opinion, a violation of the principle of least surprise, and counter-intuitive.
Further testing shows that following the reboot to complete the install, the rc-update add service adds the service to the default runlevel.
From the manpage: add service Add the service to the runlevel or the current one if none given. Services added to the boot runlevel must exist in /etc/init.d. Presuming that since you booted with a livecd and then chrooted it, it fellback on sysinit as the "current", but I'll bring the openrc devs in for confirmation.
(In reply to NP-Hardass from comment #2) > Presuming that since you booted with a livecd and then chrooted it, it > fellback on sysinit as the "current", but I'll bring the openrc devs in for > confirmation. This is correct. rc-update simply uses rc_runlevel_get() to get the current runlevel. On Linux systems, OpenRC uses /run/openrc/softlevel to record the current runlevel. This file does not exist during very early boot, so the function defaults to the sysinit runlevel, as most of the other consumers of the function rely on this behavior. The only way to fix this would be to make rc-update explicitly check for the existence of the runlevel file, and fail if it does not exist. Relatedly, OpenRC doesn't have a concept of a "default runlevel." Yes, there's a runlevel named "default" in the standard configuration, but OpenRC will only enter this runlevel (or really, any runlevel) if explicitly told to do so (which is what Gentoo's default /etc/inittab does), so the name is kind of confusing.
There has been no activity on this bug in a while. If we were to make the existance of the softlevel file a requirement for rc-update, that might cause breakage for other consumers. You should always be able to specify which runlevel you want to add a service to, for example: # rc-update add foobar default This should add foobar to the default runlevel. Feel free to re-open this bug if you feel that we should fail instead of treating sysinit as the default runlevel if one can't be determined.