You are not logged in.

#1 2017-10-08 10:55:08

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Booting BunsenLabs with OpenRC

Warning: this method may break your system so please *do not* use this on any "mission critical" boxen.

For those who dislike bloat, OpenRC is an init system that offers a greatly simplified solution compared to systemd or sysvinit (sysv-rc) with a much smaller codebase and consequent greater security, stability and reliability.

From the package page:

OpenRC is a dependency based service manager. It provides support for System V init, for booting, changing runlevels, starting and stopping services, and shutting down.

Originally written as a Gentoo project, OpenRC aims at being platform-agnostic. It works equally well on Linux, BSD and Hurd. It supports the traditional init system in Debian in addition to many alternatives. OpenRC is implemented in C in a small, simple and efficient way, making it easy to understand, extend and reuse.

It is already possible to use OpenRC in BunsenLabs in conjunction with sysvinit by installing the systemd-shim and sysvinit-core packages along with the stock jessie (or stretch) openrc package.

However, the latest versions of OpenRC now include the openrc-init binary that can be used as a drop-in replacement for /sbin/init

The advantages of this are that it allows systemd to remain in place so it can be used as a backup PID1 in case anything goes wrong [1] and also that it does not require the un-maintained systemd-shim package.

To take advantage of this method, first install sysvinit (we need some of the installed scripts for OpenRC):

sudo aptitude install sysvinit-core

Once the OpenRC package is installed (see below for details), the default init can be switched back to systemd so we can use that as a backup:

sudo aptitude install systemd-sysv

For OpenRC itself, I have backported the new version to Debian jessie & stretch:

https://download.opensuse.org/repositor … ebian_8.0/

https://download.opensuse.org/repositor … ebian_9.0/

Navigate to the amd64 (for 64-bit systems) or i386 (32-bit) folder, download the openrc .deb file and install the package with gdebi (right-click in the file manager should open this).

To use openrc-init, add this kernel commandline parameter:

init=/sbin/openrc-init

In BunsenLabs this can be done by adding the parameter inside the quotation marks on the GRUB_CMDLINE, erm, line in /etc/default/grub then update the GRUB configuration with:

sudo update-grub # or is it grub-update?

However, this will break any multi-boot systems so in that case please use /etc/grub.d/40_custom instead to add the parameter to BunsenLabs alone.

Upon a reboot, test with:

empty@testbed:~ $ cat /proc/1/comm
openrc-init
empty@testbed:~ $

A usage guide can be found at /usr/share/doc/openrc/guide.md.gz (other guides are also in that folder), read it with:

sudo apt install most
most /usr/share/doc/openrc/guide.md.gz

The Gentoo Wiki also has some tips:

https://wiki.gentoo.org/wiki/OpenRC

To reboot, use:

sudo /sbin/openrc-shutdown --reboot

To poweroff, run:

sudo /sbin/openrc-shutdown --poweroff

Other options are available for `openrc-shutdown`, see the "--help" option for details.

[1] boot with systemd again by pressing "e" with the BunsenLabs GRUB menu entry highlighted and simply delete the extra init=/sbin/openrc-init parameter and press <Ctrl>+x (at the same time) to boot the modified entry; remeber to modify grub.cfg to make this permanent if needed.

Last edited by Head_on_a_Stick (2017-10-15 21:01:54)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#2 2017-10-08 11:29:15

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Booting BunsenLabs with OpenRC

Thankyou hoas, i will have to give this a try sometime.

Offline

#3 2017-10-10 16:38:39

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Booting BunsenLabs with OpenRC

I have discovered that OpenRC can be used without the systemd-shim so I have changed the guide somewhat, check the OP for details.

Also, the stock configuration only allows for a single TTY (console) screen, which I find somewhat limiting.

To generate more, copy this file to /etc/init.d/agetty:

#!/sbin/openrc-run
# Copyright (c) 2017 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.

description="start agetty on a terminal line"
supervisor=supervise-daemon
port="${RC_SVCNAME#*.}"
term_type="${term_type:-linux}"
command=/sbin/agetty
command_args_foreground="${agetty_options} ${port} ${baud} ${termtype}"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	after local
}

start_pre() {
	if [ -z "$port" ]; then
		eerror "${RC_SVCNAME} cannot be started directly. You must create"
		eerror "symbolic links to it for the ports you want to start"
		eerror "agetty on and add those to the appropriate runlevels."
		return 1
	fi
}

Then symlink that to other agetty.$port files where $port is replaced with the console number (for example tty2), like this:

cd /etc/init.d
sudo ln -s agetty agetty.tty2 # add others as required

A configuration file is also useful:

sudo mkdir -p /etc/conf.d

Then create a file at /etc/conf.d/agetty with this content:

# Set the baud rate of the terminal line
#baud=""

# set the terminal type
#termtype="linux"

# extra options to pass to agetty for this port
#agetty_options=""

This file can then be symlinked for the other TTYs:

cd /etc/conf.d
sudo ln -s agetty agetty.tty # etc

Finally, add the extra TTYs to the default runlevel:

sudo rc-update add agetty.tty2

This will be started on a reboot or start it immediately with:

sudo rc-service agetty.tty2 start

“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#4 2017-10-10 17:32:50

bigbenaugust
Member
From: the 704 / KCLT
Registered: 2017-05-20
Posts: 179

Re: Booting BunsenLabs with OpenRC

This intrigues me. I might have to try it on my W530 at home, which is on Deuterium.

I'd run antiX except that I need disk encryption and their installer doesn't handle it.


--Ben
BL / MX / Raspbian... and a whole bunch of RHEL boxes. :)

Offline

#5 2017-10-11 20:00:57

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 776

Re: Booting BunsenLabs with OpenRC

I rather like open-rc on Gentoo I can see some playing with it on a systemd free system coming on.  Shame it wasn't considered mature enough when Debian switched from sysvinit, I would have not fought *that* change to the default.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Online

#6 2017-10-15 20:59:40

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Booting BunsenLabs with OpenRC

The OP is updated because my method was wrong — sysvinit needs to be installed first (apparently some of the scripts are needed), then the new OpenRC package before the default init is switched back to systemd.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#7 2017-10-16 22:11:22

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 776

Re: Booting BunsenLabs with OpenRC

Would be nice if the dev included those scripts and maybe adopted systemd-shim, I'd like to see OpenRC as a viable *stand alone* alternative to systemd, or sysvinit, rather than having to have two inits around for one OS.

Dunno if it's worth a wishlist category item on the BTS for OpenRC though, I still have to find the chance to play with it.


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Online

#8 2017-10-17 05:36:57

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: Booting BunsenLabs with OpenRC

I'd like to see OpenRC as a viable *stand alone* alternative to systemd, or sysvinit, rather than having to have two inits around for one OS.

I'm not sure if I get what you mean here. Maybe it's my poor English (crap it is, indeed). Is it that switching to openrc implies having systemd-shim and libsystemd onboard too?

Anyway, openrc is not exactly stand-alone per se. It needs an init to supervise; sysvinit, busybox or even, IIRC, runit can be supervised by openrc. So it's a supervisor/service manager over an init.

Offline

#9 2017-10-17 06:03:39

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Booting BunsenLabs with OpenRC

Bearded_Blunder wrote:

Would be nice if the dev included those scripts and maybe adopted systemd-shim

My current method does not require the systemd-shim at all, it offers an alternative init system without relying on an un-maintained package.

As far as I can tell, only /etc/inittab is actually needed and the sysvinit-core package supplies /usr/share/sysvinit/inittab, this file is copied over to /etc/ by the post-install script if it does not already exist and that is why my guide installs that package first.

As I see it, there are a few alternative options:

  • post the working /etc/inittab here so people can add it manually

  • add inittab to my version of the OpenRC package along with a post-install script stanza to copy it to /etc

  • request that Debian's OpenRC package does the same thing

I think the last option would be best but I don't think Debian are fond of my particular brand of hackery.

I'd like to see OpenRC as a viable *stand alone* alternative to systemd, or sysvinit, rather than having to have two inits around for one OS.

Try Alpine Linux, it's ace smile


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#10 2017-10-17 06:06:04

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Booting BunsenLabs with OpenRC

Snap wrote:

openrc is not exactly stand-alone per se. It needs an init to supervise

As noted in my OP, the newer versions of OpenRC include an openrc-init binary that my guide uses as PID1 (init) smile

EDIT: Alpine Linux uses busybox as /sbin/init because they already employ that package for their userspace tools but there was a discussion on the mailing lists about replacing that with openrc-init.

Last edited by Head_on_a_Stick (2017-10-17 06:08:09)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#11 2017-10-17 16:29:51

Bearded_Blunder
Dodging A Bullet
From: Seat: seat0; vc7
Registered: 2015-09-29
Posts: 776

Re: Booting BunsenLabs with OpenRC

Snap wrote:

Anyway, openrc is not exactly stand-alone per se. It needs an init to supervise; sysvinit, busybox or even, IIRC, runit can be supervised by openrc. So it's a supervisor/service manager over an init.

It seems to do the role of init just great by itself in Gentoo, without the need for any of the above-mentioned.

As for avoiding libsystemd0 being on board, that's impractical with a "pure" debian system, you're forced to mix sources with deuvan or antix, which begs the question why not just use those? Avoiding having the rest of systemd on board also requires a 3rd party repo for a graphical system, I could be wrong, but the one I use *appears* to be maintained by the same dev who's maintaining openrc in debian itself.

Head_on_a_Stick wrote:

My current method does not require the systemd-shim at all, it offers an alternative init system without relying on an un-maintained package.

Your current method requires systemd installed in it's entirety though, like saying a Honda Goldwing is an alternative to a BMW for a sidecar combination, without mentioning you have to have BOTH bikes bolted to the sidecar for it to move, but you can sit on the Honda seat if you like the padding better than the Beemer...

Or in other words a messy alternative.

Last edited by Bearded_Blunder (2017-10-17 16:30:58)


Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me

Online

#12 2017-10-17 18:58:46

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Booting BunsenLabs with OpenRC

Bearded_Blunder wrote:

Your current method requires systemd installed in it's entirety though, like saying a Honda Goldwing is an alternative to a BMW for a sidecar combination, without mentioning you have to have BOTH bikes bolted to the sidecar for it to move, but you can sit on the Honda seat if you like the padding better than the Beemer...

I would prefer to imagine that I am leaving the BMW K1300R in the garage while I take the SWM SM500R round town devil

There is a ton of cruft on my hard drive that rarely gets used and I have no problem with leaving systemd as a "backup" init system, you obviously feel differently.

Anyway, if we could stick to the technical aspects in this thread that would be great, thanks!


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#13 2017-10-19 07:12:52

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: Booting BunsenLabs with OpenRC

However, the latest versions of OpenRC now include the openrc-init binary that can be used as a drop-in replacement for /sbin/init

Wow... How I missed that! Need to try it. Thanks, HoaS.

Offline

Board footer

Powered by FluxBB