Enjoy the Holiday season!

Welcome to the Slackware Documentation Project

This is an old revision of the document!


Thanks for this clear explanation.

Reading this article trigger some questions:

  • Do I need that stuff?
  • In other words, what do I miss if I don't have it?
  • For what purpose(s) could I use it?
  • Does it replace some components and/or provide new or better features than existing components, then which ones?

Maybe giving a few practical use cases and examples of utilization could help answering these questions.

Didier Spaier 2015/05/15 10:06

Hi Didier,

Sorry, I did not notice your questions before.

For me, the primary reason for using OpenRC is that it provides standardization. Yes, it does offer some superior features, like dependency handling of services, cgroups support, service supervision, etc.

It does not replace any components that I know of, sysvinit is used for booting and then handles control to OpenRC, and the services provided by Slackware in /etc/rc.d can also be used.

It can also provide a faster boot experience and supports parallel starting of services as well.

Aaditya Bagga 2015/05/18 10:50

Migrating to OpenRC 0.39+ from previous versions

OpenRC 0.39, as shipped via SBo, features 2 main changes:

  • openrc-init is being used as init instead of /sbin/init
  • Service and configuration directory has been changed to /etc/openrc instead of /etc

Both these changes were done to have a clean{er} OpenRC install which can co-exist with other init systems like sysvinit (default), runit, etc, just by changing a boot parameter.

To change from /etc/init.d to /etc/openrc/init.d:

# migrate existing services
for service in /etc/init.d/*; do
  svcname=$(basename "$service")
  if [ ! -e "/etc/openrc/init.d/${svcname}" ]; then
    if [ -f "/etc/init.d/${svcname}" ] && grep -q openrc "/etc/init.d/${svcname}"; then
      cp -v "/etc/init.d/${svcname}" "/etc/openrc/init.d/${svcname}"
    elif [ -L "/etc/init.d/${svcname}" ]; then
      # check if symlink is of a service
      service_target=$(readlink -f "$service")
      service_target_name=$(basename "$service_target")
      if [ $(dirname "$service_target") = "/etc/init.d" ]; then
        ln -sv "/etc/openrc/init.d/${service_target_name}" "/etc/openrc/init.d/${svcname}"
      fi
    fi
  fi
done

# enable existing services
for runlevel in /etc/runlevels/*; do
  for service in ${runlevel}/*; do
    svcname=$(basename "$service")
    rvlname=$(basename "$runlevel")
    if [ ! -e /etc/openrc/runlevels/${rvlname}/${svcname} ] && [ -e /etc/openrc/init.d/${svcname} ]; then
      ln -sv /etc/openrc/init.d/${svcname} /etc/openrc/runlevels/${rvlname}/${svcname}
    fi
  done
done

# check config changes
for file in /etc/conf.d/*; do
  filename=$(basename "$file")
  extension="${filename##*.}"
  if [ "$extension" = orig ] || [ "$extension" == new ]; then
    continue  # dont need to check extra
  fi
  if [ -e "/etc/conf.d/${filename}" ] && [ -e "/etc/openrc/conf.d/${filename}" ]; then
    diff -Nupr "/etc/conf.d/${filename}" "/etc/openrc/conf.d/${filename}"
  fi
done

Config changes found above can be updated by hand or copy pasted in new location.

After checking that things are working expected, old files and folders can be renamed (or removed).

mv /etc/init.d /etc/init.d-openrc-bkp
mv /etc/conf.d /etc/conf.d-openrc-bkp
mv /etc/rc.conf /etc/rc.conf-openrc.bkp
mv /etc/inittab /etc/inittab-openrc.bkp

Finally initial changes done by us can be reverted:

mv /etc/init.d-bkp /etc/init.d
mv /etc/inittab.sysvinit /etc/inittab

In Other Languages
Translations of this page?:
QR Code
QR Code talk:howtos:general_admin:openrc (generated for current page)