Additional Configuration
Desktop setup
The procedure described in
Migration (removal of systemd, installation of openrc, system-wide setup, configuration of user groups / networking / consolekit / polkit / rc.conf / display manager) is what most people should do to get a fully working system. However, not all setups are alike and there might be some cases where some functionality is lost after the migration. This is not a fault of sysvinit or openrc but rather of systemd's propensity to take over functionality of other system components. We'll elaborate here on some key configuration steps.
I use
Mate as a desktop environment and I'll use this as an example for the last steps of configuration.
All packages mentioned here can either be found in the
AUR or in
[openrc-eudev] and
[pfkernel].
Adjust the following to suit your setup.
Prerequisites
What you'll need (and why):
An application-level toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes; that's techspeak for polkit. It must be compiled with support for consolekit or it won't work on systemd-free setups.
A framework for defining and tracking users, login sessions, and seats. Fancy words for multi-user setups, handled by consolekit.
Abstraction for enumerating power devices, listening to device events and querying history and statistics. That's the definition of upower, again with consolekit support.
Some rules to glue the aforementioned components together.
A graphical authentication agent to authenticate the user of the session as the user or as an administrative user. Cinnamon, Gnome, KDE, LXDE, LXQt, Mate and Xfce have an authentication agent already. If you're with Gnome (hard-dependent on systemd? really?) you'd better ditch it for Cinnamon or Mate. For other desktops or to make sure you have yours installed (and autostarted on login), read the relevant Arch wiki Polkit section.
Group membership for controlling who can do what.
All of the above were mentioned in step 15 of
Migration but are covered more elaborately here for clarification and future reference. What's left is:
A display manager that can initiate a proper session under polkit / consolekit. I use the MDM display manager for my graphical environment startup needs. It's a fork of the last GDM 2 version by Linux Mint and supports GTK, GDM and HTML themes. According to the Arch Wiki ConsoleKit page, display managers like KDM, GDM, LXDM and SLiM start ConsoleKit automatically with each X session.
A session manager that's aware of upower<0.99, as the latter dropped support for non-systemd suspend and hibernate. For MATE this is mate-session-manager-upower and respectively for XFCE4 xfce4-session-consolekit. These will also enable user switching instead of just logout. We also provide kdebase-workspace-consolekit in the repo for KDE users, although I haven't tested it myself.
Note: reportedly, MATE and LXQT session managers need upower-pm-utils. Other desktop environments work satisfactorily with upower, so if you're missing the Suspend / Hibernate buttons from your exit menus, you should switch packages.
Luckily, implementing the above steps is easier done than said. Just issue as root (the '--needed' pacman option is to avoid re-installing packages already installed, if you've followed the
migration steps; omit what you've already performed), reading the notice about the input and audio groups in
Migration and editing accordingly for your setup:
# pacman -S --needed mate-session-manager-upower polkit-consolekit consolekit mate-polkit desktop-privileges consolekit-openrc mdm-nosystemd displaymanager-openrc xorg-xwrapper upower|upower-pm-utils
# usermod -a -G video,audio,input,power,storage,optical,lp,scanner $USER
# rc-update add consolekit default
# sed -i 's/"xdm"/"mdm"/' /etc/conf.d/xdm
# rc-update add xdm default
Troubleshooting
Rootless X
If your X server tries to run rootless it may not even start (
"Cannot open /dev/ttyN" error). You must give it root rights by installing
xorg-xwrapper (if you omitted it from the commands above) or by creating
/etc/X11/Xwrapper.config:
# pacman -S xorg-xwrapper OR # echo "needs_root_rights = yes" > /etc/X11/Xwrapper.config
Inactive session when launching X on same TTY
Specify the keeptty flag to startx or xinit, for example:
startx -- -keeptty
Testing consolekit
The old ConsoleKit is no longer maintained. The ConsoleKit2 project is the fork which is used in our repositories and is actively developed (thanks, Eric Koegel!).
Issue
ck-list-sessions in a terminal under X. You should see something like the following:
% ck-list-sessions
Session1:
unix-user = '31337'
realname = 'systemdfree'
seat = 'Seat1'
session-type = ''
active = TRUE
x11-display = ':0'
x11-display-device = '/dev/tty7'
display-device = ''
remote-host-name = ''
is-local = TRUE
on-since = '2015-04-15T11:42:32.034726Z'
login-session-id = '42943454293'
Consolekit blocks the active TTY
If you see 'active = FALSE' above, then your consolekit blocks the active TTY and you must configure init to start ConsoleKit on an unused TTY:
/usr/bin/openvt -c 63 -f -- /usr/sbin/console-kit-daemon --no-daemon &
Cinnamon power options (shutdown / restart) missing
Cinnamon has consolekit support, but uses logind by default for privilege escalation. You must disable logind in the org.cinnamon.desktop.session schema using dconf-editor. Additionally,
it seems that power management in Cinnamon needs upower + pm-utils instead of upower-pm-utils to work. YMMV.
Replacement packages
There are some -nosystemd packages in the unofficial repositories that you can try if the official ones don't work as expected; for example, procps-ng-nosystemd is needed if you've removed libsystemd without replacing it, because most procps-ng binaries are linked against libsystemd.so through libprocps.so (yes, whiskey-tango-foxtrot). However, most packages depending on systemd/libsystemd (but
not on systemd as PID 1) should not give any trouble since eudev-systemdcompat provides libsystemd dependencies.
Running several applications from ~/.xinitrc
If you don't use a display manager but rather use
startx and/or
~/.xinitrc and cannot get all children processes to properly use ConsoleKit, you must create a second (executable) script with the entire session which ~/.xinitrc will launch:
~/.xinitrc
exec ck-launch-session dbus-launch ~/.xstart
~/.xstart
xterm &
thunar &
compiz ccp
If a problem persists
There
is was a thread in the Arch forums with valuable information:
OpenRC & eudev in Arch. It was closed after some "disagreements" with a FUD-spreading individual, but you can always open a new topic with the [OpenRC] tag. However you'll find better support in the
Manjaro OpenRC subforum, where a helpful community is active. For more prompt help you can visit Freenode IRC, channels #openrc, #manjaro-openrc and #arch-openrc where you
might stumble upon some of them.
Some problems related to key system components have already been addressed in the following articles of the Arch Linux Wiki:
Init
Eudev
ConsoleKit
Polkit
Udisks
OpenRC
Tips and tricks
In /etc/rc.conf set rc_parallel="YES" to instruct OpenRC start daemons in parallel.
If you have more than one network interfaces you might also want to set rc_depend_strict="NO"; this will permit network-dependent daemons (sshd, openvpn, squid etc) to launch if at least one network interface is successfully set up.