How to remove systemd on Debian Buster distros and switch to sysvinit, the good way

This is a generic howto that explains how to get rid of systemd in a distro based on Debian Buster, like the beta version of Elive 3.8.xx

Feel free to edit and improve this howto in order to make the final system more compatible for all

First things to know

  • removing systemd will save you some RAM, around ~60 MB of it
  • removing systemd can make things broken, not working as expected, etc (but we try to solve them all on this howto so that you can have a final working system)
  • it is suggested to backup your entire system, this is a major change in your OS :slight_smile:
  • there's known issues, read them before

Known Issues / TODO's:

  • none yet

Let's do it ! :happy_dance:

  • First you need to access to a shell in the machine where you want to remove systemd and using sysvinit instead, we strongly suggest to be logged on console mode or via ssh, you must logout from your graphical session first too, and its strongly suggested to be connected to internet via LAN cable instead of wifi. Finally, is suggested also to run your users-manager tool to disable user autologin during this process.

  • You need now to get the Devuan gpg key in order to use their repositories, copy and paste this to your terminal:

cd /tmp
wget "http://deb.devuan.org/devuan/pool/main/d/devuan-keyring/$( curl -sL http://deb.devuan.org/devuan/pool/main/d/devuan-keyring/ | grep "href.*devuan-keyring_.*all.deb" | sed -e 's|^.*href="||g' -e 's|".*$||g' )"
sudo dpkg -i devuan-keyring*deb
  • Now add the repositories as:
echo "# Devuan repos:
deb http://deb.devuan.org/merged beowulf          main contrib non-free
deb http://deb.devuan.org/merged beowulf-updates  main contrib non-free
deb http://deb.devuan.org/merged beowulf-security main contrib non-free
deb http://deb.devuan.org/merged beowulf-backports main contrib non-free
" | sudo tee /etc/apt/sources.list.d/bbb-devuan.list
  • Let's do the things in the correct way and add a little higher priority to the Devuan repos against the Debian ones:
echo "Package: *
Pin: release o=Devuan
Pin-Priority: 600" | sudo tee /etc/apt/preferences.d/devuan.pref
  • Now, update your packages lists and upgrade your system to updated packages from Devuan:

sudo apt-get update
sudo apt-get upgrade

note: don't use dist-upgrade on this step, we need a soft upgrade first

Now this is an important step, you will install a needed package and you will need to note somewhere the list of what is going to be removed, because you need to install it later (or their replacements), we will continue the howto with a list based on Elive 3.8.14 as an example of this list

  • Remove dependencies that won't work later:
sudo apt-get remove network-manager\* wpasupplicant
  • Install required packages and write a list of the things that is going to be removed from your system, for example:

sudo apt-get install eudev
sudo apt-get install eudev
sudo apt-get -f install

yes, you probably need to install eudev twice, due to a systemd error you need to be insistent.

Now, make a look to the packages it wants to remove:

...
Suggested packages:
bootlogd
Recommended packages:
libpam-ck-connector
The following packages will be REMOVED:
cairo-dock dbus-user-session eltrans gdebi gksu gnome-settings-daemon libpam-systemd plymouth plymouth-label policykit-1 policykit-1-gnome synaptic systemd systemd-sysv usb-bootable-elive lightdm

Make sure that it correctly uninstalled systemd and it regenerated your initramfs, otherwise you may need to try the step again after to reboot

  • Now its time to reboot your machine, in order to boot with sysvinit and not using systemd. 1WARNING: after to reboot you may not have internet available and maybe not the graphical system running too!

  • You may need to reconnect later to internet via LAN cable, which your interface can be similar to enp0s3, so you can do:

 sudo dhclient -v en<TAB>
 sudo dhclient -v eth0
  • Its suggested also to logout again from your graphical system to continue configuring your new system

  • Now, install the remaining needed things for your new system:

sudo apt-get install elogind libpam-elogind

  • Now, continue your change to sysvinit by upgrading fully your system:

sudo apt-get dist-upgrade
sudo apt-get remove systemd libnss-systemd

Install back all the needed software (or alternatives)

This step is a bit delicated and may need to you try the steps one to one:

If you want to use again network-manager, which fortunately stills supported and its suggested if you had it before:

sudo apt-get install network-manager network-manager-gnome network-manager-openvpn-gnome network-manager-pptp-gnome network-manager-vpnc-gnome network-manager-fortisslvpn-gnome network-manager-l2tp-gnome network-manager-openconnect-gnome network-manager-ssh-gnome network-manager-strongswan dnsmasq gnome-keyring

Cairo-dock seems to compatible too, but you need to reinstall it entirely in order to use all the modified packages from the Devuan repos, removing the ones from debian first, so:

sudo apt-get remove cairo-dock\*
sudo apt-get clean
sudo apt-get install cairo-dock libexo-1-0 cairo-dock-gnome-integration-plug-in cairo-dock-dbus-plug-in-interface-python

Login manager, if you used Lightdm:

sudo apt-get install lightdm lightdm-gtk-greeter

Plymouth (boot splash) doesn't seems to be compatible, but is not a big issue if we don't have it :slight_smile:

Some specific packages / dependencies by Elive you may want to have back:

sudo apt-get install gdebi gksu eltrans synaptic usb-bootable-elive gnome-settings-daemon policykit-1 policykit-1-gnome

Note: If you use an experimental version of the enlightenment desktop (so, not customized by Elive yet), you need to make sure that all the autostart applications needed are included in the init of the destkop, otherwise you may have features not working like dbus or mounts

Cleanups

After you have installed the needed software or reinstalled the previous one, its a good thing to cleanup your system:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo apt-get autoclean

Post configurations

Shutdown / reboot privileges

Your user won't have shutdown and similar privileges, so its recommended to add it your sudo settings:

echo "# give admin privileges to user $USER to be able to shutdown / reboot / suspend the computer
$USER    ALL=(ALL) NOPASSWD:    /sbin/halt
$USER    ALL=(ALL) NOPASSWD:    /sbin/shutdown
$USER    ALL=(ALL) NOPASSWD:    /sbin/poweroff
$USER    ALL=(ALL) NOPASSWD:    /sbin/reboot
$USER    ALL=(ALL) NOPASSWD:    /usr/sbin/pm-hibernate
$USER    ALL=(ALL) NOPASSWD:    /usr/sbin/pm-suspend
$USER    ALL=(ALL) NOPASSWD:    /usr/sbin/pm-suspend-hybrid
" | sudo tee /etc/sudoers.d/sudo_nopasswd_power_$USER

note: is important to run this command as user and not root, otherwise you must change the USER variable to the static user to use

This may or may not work on other systems, in an updated Elive will directly work from your window manager

Stability improvements

As you have seen, we needed to remove first all the cairo-dock packages that we had previously installed in order to force-download them again but from the devuan repos instead, otherwise they wont install or could mess the entire system (that's just an example of how mixing repos is a very delicated thing that can mess your entire system).

Your system is ready and usable now, but if you want to work from it as a stable system I would recommend to force-reinstall all the packages in your system that there's a version available on devuan, don't worry, our apt configurations set to devuan will make your system select the correct ones automatically.

Warning: this step can take up to 1 hour and can use at least 1GB of your network bandwith

unset list
export DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical DEBCONF_NONINTERACTIVE_SEEN=true DEBCONF_NOWARNINGS=true
sudo apt-get clean
for package in $( dpkg -l | grep "^ii" | awk '{print $2}' ) ; do if apt-cache madison "$package" | grep -qs "devuan.org" ; then echo "including: $package" ; list="$package $list" ; fi ; done 
sudo apt-get install --reinstall $list
# fixes:
sed -i -e 's|^set -e|#set -e|g' /var/lib/dpkg/info/firmware-b43-installer.prerm /var/lib/dpkg/info/firmware-b43*installer*
sudo apt-get -f install

You may have some broken packages, like the b43 firmwares (which we have already included hte fix in the previous command) so its up to you to fix them

Optionally, this step could have been done before to start installing back the wanted packages, but the result should be the same, you can do it especially if you have difficulties with broken dependencies

note: this option has not been very tested but is meant to stability your system to not have issues in the future with your repositories


Notes:

  • Since you reinstalled so many packages in your system, a last reboot is suggested even if should be not needed :slight_smile:
  • An installed 3.8.14 (32bit) system with the default preselected options (which means: you can install it even lighter), that resulted in 221 MB of RAM used with all the desktop featured running, turned to use only 175 MB uses only after to switch from systemd to sysvinit, plus:
    • 150 MB with pulseaudio removed
    • 121 MB without using cairo-dock :eyepopping:
    • 170 MB switching to E24 (without pulseaudio and without cairo-dock too)

Note: Seems like Bullseye has a better support for switching to other init systems: Init - Debian Wiki


Please improve this howto to make it better, after to betatest the resulting system you may see things that must be improved, fixes, or compatibility things

2 Likes

Lordy, I think I'll maybe try this on a VM first. :shocked:

1 Like

Are you going to roll it out with sysvinit?

I don't know yet, but what is needed for sure is betatesters to compare systemd VS sysvinit :slight_smile:

For now the shutdown / reboot / suspend / hibernation needs a better integration, but is the only issue that i know for now... (not much more tested than that)

If anybody wants to betatest it, are welcome, the worse is to simply reinstall elive automatically lol

Same. I’ll give it a go when I get a spare couple of hours :slightly_smiling_face:

better in a real machine, which has real hardware, real usage, etc :wink:

maybe i should implement this on the installer :thinking: :thinking:

fixes included in the howto and now everything should work, including shutdown / reboot / suspend (make sure your system is updated with apug)

so yes, it is a good alternative for those who wants to switch to sysvinit and remove systemd :slight_smile:

Yeah, I don’t want to screw my install up as it’s my main production machine, and I can’t be arsed setting up again if I do a screw it up. So I’ll do a dry run in a vm first and once I’m familiar with the process, I’ll install it on bare metal. I’ll probably use timeshift or something to do a snapshot. :thinking:

Yeah, is better to do it in non-production machines, so testing machines or just less-important ones (elive should be enough secure and enough easy/fast to reinstall to this won't be a bigger issue :slight_smile: )

Are there any alternatives?

Pfft...on a bad day with plenty of schoolwork — 1GB can take like two hours, but you probably dont want to add this, because most people dont share 3mbps with four other people :wink:

25MB for pulseaudio?! :eyepopping:

So that's...let's see...29MB that cairo-dock uses..not surprised, seeing as it's such an advanced dock

Thats still pretty good, we can use computers with 256MB ram with the latest E! Nice job @Thanatermesis!

Tho...what would we do w/o pulseaudio, most programs R E Q U I R E it

Well, we already know the answer... :madness:

Do you mean remove it from the world, so that its a better place? ...Or...

A snapshot of the VM? AFAIK VMware and VirtualBox both offer builtin snapshot support

nope :slight_smile:

elive 3.0 has been released entirely without pulseaudio (when it was already a monopol), and recently the installer of elive included the possibility to remove it (keeping everything perfectly working), the only issue is that the actual graphical mixer uses pulseaudio and you cannot connect an external bluetooth so easily

only a few programs really require it (like skype), one of them was e16 but it was recently featured with an alternative to pulseaudio and is the one that is actually using :wink: , some other programs may require to configure it to select to use pulseaudio or alsa, but in short, 95% of your elive should directly work

if you want to give it a try, install the package pulseaudio-compat-notinstalled and reboot, you will see :slight_smile:

6 posts were merged into an existing topic: Don't do this at home

Did not @stoppy98 create a Bluetooth Speaker Connection Thingy? In this repo?

If im not wrong there is PlayMusicOverBluetooth.sh. If you modify to your needs would it work?

mmh not sure, in recent versions of elive you can use a bluetooth speaker really easy (dependencies and confs included), using pulseaudio. With Alsa is also possible but i dont think there's an easy tool to do it, so its much more complex to set up and may require root privileges

oh, just seen the script, its a good one :slight_smile: and yes it uses pulseaudio too, but should be not difficult to do it directly on elive since the needed confs / dependencies was added some versions ago

Chicken..
:hatched_chick::chicken:

(teasing you, no worries)

:laugh:
.
:madness:
.
:rofl2: :rofl2:

2 Likes

Well i just did this on my laptop and the guide seemed to do the job quite well! Took about 30 minutes to do all that except for the last one (reinstalling all of the packages again). This was on a Lenovo T450 laptop with i5/12GB RAM/ssd.

I'm going to test some stuff out now and hope that nothing is broken, but since i'm typing this on the same machine i think all is well :slight_smile:

I'm a bit happier now!

4 Likes

Note: Seems like Bullseye has a better support for switching to other init systems: Init - Debian Wiki

Spoiler: The next version of Elive is going to include full (optional) support of removing systemd and use sysvinit :sunglasses:

Isn't that going to muck with gnome integration and stuff like network-manager?
Never Mind .... not an issue. :smiley14:

Actually NM didn't worked but it works now, from my (very small) test everything seems to work correctly (except plymouth, which is deinstalled by not compatibility), so more tests are welcome

I'm also surprised by the boot up speed too :thinking: which was something we "obtained" thanks to systemd, but with sysvinit seems to be very fast too!