OpenRC keeps a Gentoo system service's startup configuration separate from its live state. Adding a service to a runlevel enables future startup, while starting and checking it requires the installed Gentoo OpenRC system to be booted.

OpenRC stores runlevel membership as service links under /etc/runlevels and manages those links with rc-update. The default runlevel is where ordinary long-running services normally belong after the early sysinit and boot runlevels have prepared the system.

System services use scripts in /etc/init.d and are managed as root. OpenRC user services have separate scripts, runlevels, and login-session setup; adding a system service to default does not configure a per-user service.

Steps to enable a service on Gentoo with OpenRC:

  1. Use a root shell in the target Gentoo OpenRC installation.

    From installation media, enter the installed system's chroot first.
    Related: How to enter a Gentoo chroot

  2. Confirm that the service script exists.
    # ls -l /etc/init.d/sshd
    -rwxr-xr-x 1 root root 2028 Oct 13 07:53 /etc/init.d/sshd

    The service name here is sshd, matching its script in /etc/init.d rather than a systemd unit name. If the script is missing, install the service's package first or check its documentation for the OpenRC service name.
    Related: How to install a package on Gentoo with emerge

  3. Enable the service in the default runlevel.
    # rc-update add sshd default
     * service sshd added to runlevel default

    default is the normal runlevel for services that should start during a regular multi-user boot. Do not move low-level boot or sysinit services unless Gentoo or package documentation explicitly requires it.
    rc-update add saves the boot-time runlevel entry only. It does not start the service in the current session.

  4. Confirm that the service is listed in the default runlevel.
    # rc-update show default
    ##### snipped #####
                     sshd | default

    In an installation chroot, stop here. The service starts when the installed system boots, and the remaining steps need that booted system.

  5. Start the service on the booted Gentoo OpenRC installation.

    Starting sshd opens its configured SSH listening sockets. Its authentication settings and firewall rules must already match who should be allowed to connect.

    # rc-service sshd start
     * Starting sshd ... [ ok ]

    A first sshd start may generate missing host keys before the final ok message.

  6. Check that the service is running.
    # rc-service sshd status
     * status: started

    If the service reports stopped, crashed, or a failed start, inspect that service's configuration and log path before relying on the runlevel entry. A service can be enabled for boot and still fail at runtime.

Share this guide