Daemons in Gentoo Prefix with OpenRC

Table of Contents

1 Abstract

I am going to take the development of prefix support in OpenRC, deploy OpenRC to work with baselayout in Prefix, and extend Prefix with the long-waited feature1 of services daemons.

2 Objective

Port OpenRC to Gentoo Prefix to organize daemons.

3 Big Picture

Gentoo Prefix is a Gentoo portage managed system installed in a prefix directory. The main purpose is to leverage the Gentoo Linux Portage tree to other Linux distributions, BSD variants, Solaris, hpux, aix and even WINNT.

Gentoo Prefix is usually used by a normal user on the system, providing a systematic way to install new package into a shared computing environment without superuser privilege.

After several years of development since 2006, Gentoo Prefix has grown mature, especially on most tested platforms like x86-linux, amd64-linux, x86-macosx, to name a few.

At present, developers are actively porting changes in Gentoo Prefix back into the main Gentoo Portage tree (in Gentoo community called gentoo-x86), thanks to the introduction of new portage API, aka. "EAPI", 3 and 42.

4 Motive

Gentoo Prefix (hereafter Prefix) is a productive foreground environment. Daemons in Prefix can be run manually to be detached from foreground. This practice is not scalable, and soon becomes tedious.

There was effort to address this issue since 2007 to have services in Prefix, documented in the (in)famous bug #1962941. The scheme works for linux Prefix, but non portable to other host OS like Solaris.

At the same time, Gentoo/*BSD grows and calls for a portable init system that can be used across Linux and BSD kernel/userland. In 2010, OpenRC project answered the call to design a platform-agnostic init system3. Now it matures and serves as default in Gentoo.

Early effort of OpenRC includes a goal of supporting Prefix. But due to lack of man power and the habit of using Prefix only foreground, the Prefix plan was dropped in OpenRC git tree4.

At the same time, Prefix tree becomes an overlay on gentoo-x86, bringing Prefix closer (if not indistinguishable) to standard Gentoo5. It's time to reconsider background support in Prefix with in the light of OpenRC.

5 Deliverables

5.1 general guideline

This project includes exploring experimental features of openrc. Unexpected pieces would emerge along the way.

I will make flexible so I have a number of target to reach within this project and see which will fit or not the timespan.

The first one will be make a good checklist of features openrc has now and which features you want to add to it.

The second one is to compare with other init systems features list and see what we got and what we do not.

The third one is to implement that.

I'd make weekly milestones to see what had been done, what is missing and what to do next, the first one being openrc on prefix.

The end result target will be having the ability to use rc/rc-status and such on a prefix, and at least 3 other main features.

Besides, a rough timeline of my current expectation is created as followed.

5.2 before mid-term

  1. functioning OpenRC tarball and ebuild on Prefix with superuser privilege (hereafter superuser Prefix)
  2. improved baselayout ebuild using OpenRC on superuser Prefix
  3. functioning OpenRC tarball and ebuild on normal user Prefix, which is configurable to be used in superuser Prefix
  4. baselayout changes reviewed by Gentoo Base Project and merged back into gentoo-x86
  5. a reference arm-linux Prefix system running mldonkey6, proftpd7, tinc8, nginx9 from OpenRC for demonstration and community use.
  6. Gentoo documentation or function inside ebuild to guide end user to deploy OpenRC.

5.2.1 Timeline (dates as deadlines) to achieve that

  • 2012-04-08 Sun Investigate the difference between baselayout-{2,prefix}
  • 2012-04-10 Tue Join Gentoo OpenRC herd and get familiar with the source tree.
  • 2012-04-15 Sun Make a git branch out of OpenRC main and develop with it
  • 2012-04-30 Mon Make it run with a directory prefix.
  • 2012-05-15 TueMake necessary changes to test cases where OpenRC is invoked by host rc system, manual invoking, or cron.
  • 2012-05-22 Tue Introduce a mechanism to separate host rc only tasks from Prefix OpenRC, e.g. kernel module.
  • 2012-05-31 Thu Patch baselayout-prefix to integrate OpenRC prefix branch.
  • 2012-06-07 Thu Reuse the mechanism to separate (or modify) super user only tasks from Prefix OpenRC, e.g. tuning kernel runtime parameters, binding TCP port less than 1024.
  • 2012-06-15 Fri merge baselayout-prefix with baselayout-2. This is a by-product, in fact including OpenRC into Prefix requires modification of baselayout-prefix.

    If the porting OpenRC is done in a direction of making baselayout-prefix with baselayout-2 more similar, they can be merge into a Prefix-aware baselayout-2.

  • 2012-07-01 Sun Use new baselayout and openrc ebuilds to build the demo system, provide access accounts for those who are interested. Document the build procedure as tutorial. If the deploying process needs manual tuning, compose Gentoo documentation to explain the details.

5.3 final

an extra sub project for investigating and evaluating the advertised cool features of systemd, launchd and upstart. Integrate the modern feature as extensions of openrc.

  1. a report of evaluation on launchd, systemd and upstart from a gentoo point of view
  2. (optional) A mechanism by which init scripts can configure OpenRC to detect runtime failures, log them and respond to them. The key response we want to enable is to give regular init scripts respawn functionality like we have in /etc/inittab
  3. (optional) Oom-killer protection via /proc/*/oomadj
  4. (optional) The ability to perform some sort of maintenance action on a timer (e.g. restart)

5.3.1 Timeline (dates as deadlines) to achieve that

  • 2012-07-21 Sat install reference and develop systems for launchd: MacOSX and FreeBSD10; for systemd: Fedora 15, Mandriva 2011, synchronize with systemd subproject of Gentoo Base Project; for upstart: Ubuntu; for Service Management Facility: Illumos.
  • 2012-08-01 Wed compare systems against openrc and sysvinit. Find what's missing and what's valuable to be implemented. Figure out a schedule to make balance of time limit and valuable features.
  • 2012-08-20 Mon Carry out the schedule and report the new features to Gentoo community, the majority of openrc user.

6 Biography

I am born in China and now studying in particle physics in Japan as a graduate student. I like tweaking electronic devices and computer programs. Right now I am really fond of travelling around the world and learning different languages.

As a GNU/Linux user for 8 years since 2003, I use Debian for desktop and Gentoo Prefix for servers. I live in Emacs and stumpwm. I started to love Gentoo Prefix in 2010 and joined gentoo four months ago 11.

6.1 experiences

2005translated Debian Sarge Release Note into Simplified Chinese12
2007–2009system administrator for student associations and dormitory in Tsinghua University, China
2009intern in Lava Inc at Beijing, video streaming
2011short intern at Intel China
2011–nowConsultant for Tsinghua University student group of campus network administrators

6.2 toys at hand

  1. mips architecture
    • Planex MZK-W04NU running OpenWrt13
    • TP-Link WR1043ND running OpenWrt13
  2. arm architecture
    • Buffalo LS-VL running stock system with Gentoo Prefix
  3. powerpc architecture
    • Xilinx Virtex II PRO evaluation board, minimal Debian14
    • SONY PlayStation 3, jailbroken, planning to deploy Gentoo
  4. microblaze architecture
    • Xilinx Spartan 3 Starter Kit, minimal busybox

Date: 2012-04-20 12:13:58 JST

Author: XU Benda

Org version 7.8.02 with Emacs version 23

Validate XHTML 1.0