[ Tutorial ] Parrot without Systemd

I used the Parrot Project for years, so now i plan to give something back

Guide: Replace Systemd with OpenRC

Requirements:

  • Backups!!!
  • Live-USB

Steps:
1: Preparation
2: Replace Systemd with OpenRC
3: Restore GUI
4: Repairing Damage
5: Frankenstein

Step 1: Preparation

BACKUP YOU PC!
If you plan to remove Systemd, backup first.
It is exceedingly easy to break your system while removing systemd.
“We’re off to a good start…”

Prepare the live USB:

Not strictly required, but makes it way easier to restore your Backups - you will likely need them!
Download your preferred parrot flavor. I chose XFCE for this guide.
Open your favorite browser and go to the Parrot OS download page: Download Parrot OS
If you can’t find a current xfce image, search here instead: Index of /parrot/iso/
Further Instruction on how to burn your live-USB in my earlier Guide: “Installing Parrot on ZFS”

Step 2: Replace Systemd with OpenRC

This guide assumes a fresh Parrot XFCE 4-10 Installation, but used systems have worked before.

Open your terminal. In order To avoid any unexpected surprises, first upgrade your packages and then reboot to apply any changes:

sudo parrot-upgrade;
sudo reboot;

Once your system has restarted, open the terminal again. Make sure it is expanded (more on that later) and shows no previous output, otherwise reset it using:

reset;

Once you have done so, enter the following line, and DO NOT REMOVE -s!!!, which stands for simulate. We don’t want to start just yet.

sudo apt-get install -s openrc sysvinit-core policycoreutils;

You will get many lines of output, don’t remove them!
You will have to save your terminal output to disk, to allow for later restoration of deleted packages.

The default XFCE terminal contains a button under the tab terminal to do just that.
You could also copy and paste or screenshot it, but do make a copy!.

Many applications require systemd or one of the packages that rely on it, and you will likely forget about some of those without checklist.

Now reset your terminal again:

reset;

Before you continue, a few more warnings:
DO NOT INSTALL ELOGIND OR CLOSE YOUR TERMINAL AFTER COMPLETION!!!
ALSO DO NOT PERFORM AN APT AUTOREMOVE UNTIL STATED OTHERWISE!!!

With that said, lets run the install command without -s option.
WARNING - THERE IS NO TURNING BACK!!!

sudo apt-get install openrc sysvinit-core policycoreutils;

Wait patiently for its completion, this might take some time. once it has completed however, scroll up to find the following warning:


*** WARNING: if you are replacing sysv-rc by OpenRC, then you must ***
*** reboot immediately using the following command ***
for file in /etc/rc0.d/K*; do s=basename $(readlink "$file") ; /etc/init.d/$s stop; done;


I highly recommend copy-pasting the code from your terminal, to avoid errors while tipping.
Note that the terminal adds backspaces if it is too small, causing the line to fail.
Make sure that doesn’t happen!

Now open a Root-Terminal to get sufficient privileges for the code mentioned above.
This is not strictly required, but removes the need to edit it by hand.
ONLY IF you lack such terminal, add sudo to this → sudo /etc/init.d/

Warning for the next line!
SHUTDOWN WILL HANG, USE REBOOT!!!
As the warning states, immediately execute the following lines

for file in /etc/rc0.d/K*; do s=`basename $(readlink "$file")` ; /etc/init.d/$s stop; done;
reboot

Step 3: Restore GUI

Your PC will now reboot. You have to be quick, because one of the removed packages ended up being your display manager!

Your PC will hang upon boot, forcing you to restart the machine.
Solve this by pressing ESC after leaving grub, in order to enter terminal mode.
Note that this disables all graphical elements, so no GUI!

This mode luckily continues, allowing you login and restore the display manager.
Or it would, had you not just removed your Network Manager, causing apt to fail!
That’s an easy fix though, just enter the following line to reconnect to the internet:

sudo dhclient;

Now that internet is restored, install the package elogind, the extracted login backend from systemd, without actually relying on systemd.

sudo apt-get install elogind;

Then reinstall lightdm, granting you a correct Login screen, albeit still somewhat ugly:

sudo apt-get install lightdm;

Reboot again:

sudo reboot;

This should restore your graphical user interface, making the following steps way easier.
Congratulation! You have restored basic functionality to your system!

Step 4: Repairing Damage

Open a terminal and restore your internet:

sudo dhclient;

Run lightdm-gtk-greeter-settings, as you can use it to fix the black login screen that you might have detected earlier.

then remove all remaining systemd packages:

sudo apt-get purge *systemd*;

following that, execute the empty command:

sudo apt install;

to see what packages are still about to be removed.

Try to restore them if necessary, for example (in case of a clean install):
xfce4-goodies (or individual xfce4 plugins), mate-system-monitor, gparted, ufw, …

Be aware that many packages rely on systemd, so don’t be hasty when restoring them.
You might even wish to add lightdm- to your apt commands, to avoid reinstalling it.
Also note that we will increase the number of possible packages later on.

You can ignore compiler, lib’s or network-manager packages for now, they either cannot be installed,
or will be installed as dependency anyway. The same goes for brasero.

Step 5: Frankenstein

Here comes the Frankenstein-like stuff:
Open your browser (Don’t worry, Firefox is likely still installed)
and get the current devuan stable source (yes, you heard that right)

I HIGHLY recommend choosing the stable branch, as it contains older packages than those of parrot,
thus avoiding accidentally installing from the wrong source.

[ @Righttoprivacy edit: As of this post, .onion address below is official Devuan onion. Source: Devuan Package Repositories. For user safety check to make sure it matches my reply below this tutorial. ]

The correct source looks like this:

deb tor+http://devuanfwojg73k6r.onion/merged beowulf main

Add it to the file /etc/apt/sources.list.d/parrot.list using a root-able text editor,
as vscodium will currently fail due to another issue. We will fix that later.
For example: gedit, pluma, neovim, vim, vi etc…

sudo nvim /etc/apt/sources.list.d/parrot.list;

install the package apt-transport-tor to allow apt to listen to that source:

sudo apt-get install apt-transport-tor;

then start tor to allow the connection:

tor &

now perform the update:

sudo apt-get update;

Note: You could also add a normal devuan source, but devuan relies on HTTP sources,
which is less secure than parrots HTTPS.
It is therefore beneficial to security to use the tor transport instead.

With all that said, you will now receive a warning message that the source is not trusted.
This is caused by the fact that parrot misses the authentication keys of devuan which we therefore have to import manually (bad practice!):

sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-keys REQUIRED-KEY

Finally, run the update yet again:

sudo apt-get update;

Why did we do all this?
We needed a few packages to reinstall applications normally relying on systemd.
First install the package wicd, the devuan version of the very systemd dependent network-manager:

sudo apt-get install wicd;

Then the devuan-specific version of the package udisks2.
First list all alternate versions of the package:

apt-cache madison usdisks2;

Why madison? I have no idea…
Anyway, choose the version offered by the recently added devuan source,
which you install using the = operator in apt, like this:

sudo apt-get install udisks2=2.8.1-4+devuan1;

This package is required for many filesystem-packages, like gnome-disk-utility or gvfs.
Gvfs meanwhile is required for most file managers, like caja or thunars advanced abilities (trash etc.).

Note that mixing Package sources like this does create a bug: udisks2 allows the installation
of the aforementioned many different packages, but does not work exactly as intended.

It will glitch when showing currently mounted/available filesystems, causing them to suddenly disappear.
You can test this by running gnome-disk-utility, as its output will disappear upon opening.

Third install policykit, which allows applications to open a separate GUI password prompt.
Affected applications include virt-manager, vscodium, mate-system-monitor, etc.
Those applications cannot gain sudo rights and will fail. Note that this only works upon restart:

sudo apt-get install policykit-1-gnome libpolkit-backend-elogind-1-0;
sudo reboot;

At last try to reinstall the many packages that got lost during your removal of systemd,
including packages like brasero, gufw, virt-daemon-systems and many more.
Your terminal output should now come in handy, as you can finally restore most applications.

You can now also get rid off all remaining packages that are on longer required:

sudo apt autoremove;

That’s it! You are fine to go and use your newly designed system!!!

PS: My next guide talks about compiling amd64 pcsx2

3 Likes

Nice tutorials!

For user safety, (and since this post is by a newly registered user) I verified the .onion repository used in the tutorial above can be found at an Official Devuan address. This can always be self verified here Devuan Packages :

deb tor+http://devuanfwojg73k6r.onion/merged

Moved to Tutorials Forum :slight_smile:

1 Like

It has come to my attention that the combination of both openrc and sysvinit might not be that clever.
http://forums.debian.net/viewtopic.php?f=16&t=134915

OpenRC already possesses an init system, which is replaced with sysvinit.
In fact, Debian actually removes the init elements from openrc, for reasons unknown

This turns my current Tutorial into an even worse “Frankenstein’s Monster” than it already is,
so let us try to fix that, shall we?

Be aware that this has received only minimal testing,
though booting has been confirmed. Also remember:
YOU MUST HAVE COMPLETED THE TUTORIAL!!!

First go to the link in question, and follow the instruction to download the full openrc package.
The required file is named “openrc_0.34-1_amd64.deb”.

It should be noted that you will now install a FOREIGN .deb package, with all that entails!

Open a terminal and replace your current openrc with the following command:

sudo apt-get install --allow-downgrades ./openrc_0.34-1_amd64.deb;

In order to avoid a potential bug during boot, install the sensors package:

sudo apt-get install lm-sensors;

You should also hinder apt from overwriting the package, to avoid later issues:

sudo apt-mark hold openrc;

With all done, edit your grub configuration file to point to the new init:

codium /etc/default/grub;

Make sure to place the following to into the quotation marks at line 9, GRUB_CMDLINE_LINUX_DEFAULT:

init=/sbin/openrc-init;

This addition will cause your grub menu to boot into openrc-init, instead of the existing sysvinit-core.
Make sure NOT to delete sysvinit-core, as openrc uses some of its configs.

Execute a grub-update to transfer the new settings:

sudo update-grub;

Note:
You could do this by hand during every boot, but we will automate it for ease of use.
Just remember that you can always just remove the line per hand, if something goes wrong.

You can see if everything worked by entering the command:

cat /proc/1/comm;

It should return
openrc-init

Congratulations, you now run the hopefully best possible debian init!!!

AnonSurf doesn’t work with sysvinit. I’ll research and make it work on sysvinit.

1 Like

Huh, did not realize that one.

Appears to be related to the tor command failing to start.
I will mention it in the 4.10 Bug Thread.

By the way, does that mean the tutorial worked for you?
If so, great to hear!

Any further recommendations or thoughts?

After some more testing, here a few more notes:

You do not need to install lm-sensors, the bug i found was unrelated.
OpenRC requires sysvinit-utils, but not sysvinit-core - the reference was wrong.

You also might wish to add terminals to the keys strg + alt + f2 - f6,
the way to do so is described in the reference.