Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo dual init openrc/systemd
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 23 Mar 2019
Posts: 557

PostPosted: Thu May 21, 2020 1:36 pm    Post subject: Gentoo dual init openrc/systemd Reply with quote

Hi Guys,

Recently I experimented with creating a dual init Gentoo using both systemd and/or openrc for init system.
I was moderately successful and was amazed at how easy it was.

In my case it is working smoothly.
But please proceed on your own risk.
IMPORTANT:While starting this task from an already installed openrc system works flawlessly I recently found out that the opposite namely sytemd->openrc/systemd dual has glitches while booting openrc.Namely errors about no permissions to set cgroup something something.I am still searching as to why this is happening in this case...Probably some missing package or disabled openrc service...

These are the steps I took:

1. IMPORTANT: Have a system you can afford to spare and shed tears for if something goes sour.
2. If you start from an openrc system edit make.conf and add

USE="....systemd -consolekit -elogind warmstarts"

Then run

emerge -uDNav @world
emerge -a --depclean

This will pull systemd and dependencies and HOPEFULLY it will run smoothly.
If not then you might need some manual emerge intervention according to
Please read and apply carefully all the steps with the most important being:

gpasswd --add <user> systemd-journal
systemctl preset-all

3. After having run --depclean as shown above openrc and some dependencies were removed.
Now its time to reinstall openrc:

emerge -av openrc opentmpfiles consolekit

You will get an error about

sys-apps/systemd is blocking sys-apps/sysvinit

To overcome this add the following in



and rerun emerge.
It will work this time.
The reason sys-auth/consolekit is included is to have a smooth desktop experience.
Since "elogind" was removed and can not be reinstalled because systemd is now blocking it,there might be some "permission denied" errors when running a desktop in openrc.
Consolekit will create the /run/user/<user-id> directory and make it available to running apps.
Please enable consolekit.

rc-update add consolekit default

Now when it comes to choosing your next boot init system(openrc or systemd) you could theoretically add in /etc/default/grub

GRUB_CMDLINE_LINUX="...init=/sbin/opentc-init OR init=/lib/systemd/systemd"  AND
grub-mkconfig -o /boot/grub/grub.cfg

BUT systemd is arrogant and it will override grub settings to boot into itself no matter what.
The only way to prevent it from doing so is to make the /lib/systemd/systemd binary unavailable by renaming it.
So this is a quick and easy script to do precisesly this:


case $1 in
   [ ! -f /lib/systemd/systemd.bak ] && mv /lib/systemd/systemd /lib/systemd/systemd.bak
   ln -sf /lib/systemd/systemd.bak /lib/systemd/systemd
   ln -sf /lib/systemd/systemd /sbin/init

   [ ! -f /lib/systemd/systemd.bak ] && mv /lib/systemd/systemd /lib/systemd/systemd.bak
   rm /lib/systemd/systemd 2> /dev/null
   ln -sf /sbin/openrc-init /sbin/init

   if pidof /sbin/init > /dev/null 2>&1
   then echo "CURRENT INIT OPENRC"
   if ls -l /sbin/init | grep openrc > /dev/null
   then echo "NEXT INIT OPENRC"
   else echo "NEXT INIT SYSTEMD"

   echo "USAGE:<myinit systemd|openrc|status>"

Please make it executable and move it to /usr/local/bin/myinit.
4. Please modify your .xinitrc to work with consolekit.In my case

exec ck-launch-session dbus-launch --sh-syntax --exit-with-session xfce4-session

5. If you are starting this transformation from a systemd system then please omit steps 1.and 2. and start from 3.
6. Please run "myinit <openrc|systemd|status>" to choose the init of your next boot.
7.commnet out any uncommented lines in


This is meant to supress some trivial error messages when booting into openrc.
8. If you are booting into openrc you will find that "poweroff" and "reboot" commands do NOT work because there is no "sys-apps/sysvinit" installed in your system now.Instead please use

openrc-shutdown -r now ### for REBOOTing and
openrc-shutdown -p now ### for POWEROFF

9. Next time that there is an update of "sys-apps/sysvinit" append this in "/etc/portage/profile/package.provided" as shown in step 3.

That's it really!!
Very easy.

I would love to have your feedback insights or suggestions about this.And also any caveats I failed to foresee..

Thanks a lot

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum