Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 246502 - Removing sysvinit from OpenRC
Summary: Removing sysvinit from OpenRC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 250552
  Show dependency tree
 
Reported: 2008-11-12 16:25 UTC by Roy Marples
Modified: 2008-12-18 20:38 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
halt init script (halt.initd,323 bytes, text/plain)
2008-11-12 16:36 UTC, Roy Marples
Details
Ebuild patch (ebuild.diff,692 bytes, patch)
2008-11-12 16:39 UTC, Roy Marples
Details | Diff
Use inittab to call final halt and reboot (inittab.diff,760 bytes, patch)
2008-11-13 09:55 UTC, Roy Marples
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Marples 2008-11-12 16:25:33 UTC
Now that OpenRC has sysinit and shutdown runlevels, we've stripped pretty much all hardcoded stuff out now. The exception is a lot of reliance on sysvinit being present on Linux. Of course, there are multiple choices of init replacements these days, so punting the remaining sysvinit bits to the sysvinit package makes a lot of sense.

I'll be attaching an ebuild and files to try and handle this.
Comment 1 Roy Marples 2008-11-12 16:36:17 UTC
Created attachment 171552 [details]
halt init script
Comment 2 Roy Marples 2008-11-12 16:39:09 UTC
Created attachment 171553 [details, diff]
Ebuild patch

Moves reboot.sh and shutdown.sh out of init.d - they don't belong there.
Add's halt to the shutdown runlevel if the halt script does not already exist.
I personally don't like this step, but it maintains the status-quo with existing functionality.
Comment 3 Roy Marples 2008-11-13 09:55:37 UTC
Created attachment 171618 [details, diff]
Use inittab to call final halt and reboot

An alternative to the above would be to get inittab to call the final halt/reboot commands.

This should (although not tested) work along with baselayout-1 and removes the need to add anything to a runlevel.
Comment 4 Matthias Schwarzott gentoo-dev 2008-11-14 15:07:14 UTC
(In reply to comment #1)
> Created an attachment (id=171552) [edit]
> halt init script
> 

+pkg_preinst() {
+	# First time installs add halt to the shutdown runlevel
+	if [ ! -e "${ROOT}"/etc/init.d/halt ]; then
+		einfo "Auto adding halt init script to the shutdown runlevel"
+		ln -sf /etc/init.d/halt "${ROOT}"/etc/runlevels/shutdown
+	fi
+ }

Isn't this code likely to fail, as there already is an /etc/init.d/halt in baselayout and older openrc versions?
So first there need to be a blocker against these versions :/
But due to blocker resolution I guess we cannot be sure if the file is there before or not.
The check definitely needs to be changed.
Comment 5 Roy Marples 2008-11-14 15:16:14 UTC
(In reply to comment #4)
> Isn't this code likely to fail, as there already is an /etc/init.d/halt in
> baselayout and older openrc versions?

No. It has /etc/init.d/halt.sh, so the check is good.
Only the GIT version of OpenRC had the halt script and GIT users should know what they're doing.

But it could be an argument to prefer the inittab approach, which I prefer right now.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-03 22:13:44 UTC
The ebuild and init.d/halt aren't happening. The inittab ones will, but as two batches:

1.
+l0s:0:wait:/sbin/halt -dhip
+l6r:6:wait:/sbin/reboot -dk
Should break absolutely nothing in baselayout1.

2.
+# Run the sulogin shell in single user
+s0:S:wait:/sbin/rc single
+s1:S:wait:/sbin/sulogin
Potential for breakage with BL1 unknown.
Comment 7 Doug Goldstein (RETIRED) gentoo-dev 2008-12-03 22:25:14 UTC
Gentoo is targetting this for the 0.4.0 release since this is a drastic change from the 0.3.0 and doesn't just warrant a -rX bump since it will require a significant amount of patching.
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-03 22:47:00 UTC
Cardoe:
the bits in #1 should go into sysvinit already.
#2 needs testing and then going into a seperate sysvinit revision probably.
Comment 9 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-05 23:30:19 UTC
Roy:
There is a problem with the sulogin bits:
+# Run the sulogin shell in single user
+s0:S:wait:/sbin/rc single
+s1:S:wait:/sbin/sulogin
Specifically, inittab specifies that the first field is unique, and the change from the patch collides with the serial consoles. What value do you think we should use for Gentoo and you are going to use for other platforms?
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-05 23:51:37 UTC
InCVS: sysvinit-2.86-r11 with l0s and l6r lines.
Comment 11 Daniel Robbins 2008-12-08 17:45:34 UTC
How about "p0" and "p1", which stands for "power" - as those lines affect power state, it is somewhat intuitive.
Comment 12 Daniel Robbins 2008-12-08 17:55:24 UTC
To clarify (my earlier comment was really vague,) it seems better organized to have shutdown, halt and reboot commands in the "p" (power-state) runlevels. And then have rc single and sulogin branch off of the "lx" runlevel names, like this:

# 

l0s:S:wait:/sbin/rc single
l0l:S:wait:/sbin/sulogin

# commands that affect power state

ps:0:wait:/sbin/rc shutdown 
ph:0:wait:/sbin/halt -dhip
pr:6:wait:/sbin/reboot -dk 

I don't know if that will work but it seems less weird. If someone is trying to figure this out, consider that arrangement. It doesn't really matter but I thought I'd suggest it.
Comment 13 Matthias Schwarzott gentoo-dev 2008-12-16 11:37:47 UTC
How should the inittab changes for single-runlevel be done? A Revision bump, where the new version RDEPEND-blocks old baselayout/openrc versions? And all older openrc/baselayout does block the new one?

I doubt this will work? It is required to run after emerging baselayout-2 (is this check correct?).
# Ready for baselayout2/openrc-0.4.0, commented pending bug 246502
#has_version =sys-apps/baselayout-2* && sed -i -e '/^#BL2#/s,^#BL2#,,g' inittab
Comment 14 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-16 18:24:45 UTC
Roy: could you please nominate some specific non-conflicting names for the single-user runlevels so that we can have them live in the inittab?
Comment 15 Daniel Robbins 2008-12-16 18:28:43 UTC
I just ended up keeping them as-is. Serial is not enabled by default and those can be renamed if used.
Comment 16 Roy Marples 2008-12-16 19:28:55 UTC
(In reply to comment #14)
> Roy: could you please nominate some specific non-conflicting names for the
> single-user runlevels so that we can have them live in the inittab?
> 

Seeing as inittab allows 4 chars for the id, how about su?
su0:S:wait:/sbin/rc single
su1:S:wait:/sbin/sulogin
Comment 17 Doug Goldstein (RETIRED) gentoo-dev 2008-12-18 17:28:27 UTC
This is done in sys-apps/sysvinit-2.86-r12. Marking fixed.
Comment 18 Harald van Dijk (RETIRED) gentoo-dev 2008-12-18 18:27:07 UTC
> # Do not uncomment yet. Pending bug 246502
> su0:S:wait:/sbin/rc single
> su1:S:wait:/sbin/sulogin

That's scary; I'm assuming the comment should be ignored and removed?
Comment 19 Doug Goldstein (RETIRED) gentoo-dev 2008-12-18 20:38:37 UTC
heh. Screw up on my part. This has been removed.