How to remove systemd from a Debian jessie/sid installation

From Without Systemd
(Difference between revisions)
Jump to: navigation, search
('sysvinit' is not really needed, as it's a transitional package only; formatting fixes)
(relocated link: debian.org wiki page describing a "preseed" command)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= SysV init =
+
= Sysvinit =
   
  +
== Installing Sysvinit ==
 
First install the SysV init packages:
 
First install the SysV init packages:
   
Line 6: Line 7:
 
cp /usr/share/sysvinit/inittab /etc/inittab
 
cp /usr/share/sysvinit/inittab /etc/inittab
   
Then reboot your machine and remove all of the systemd packages.
+
== Grub Configuration ==
  +
'''This section on grub may only apply to Debian Jessie 8.3+'''
  +
  +
Next, change the <code>GRUB_CMDLINE_LINUX_DEFAULT</code> line in <code>/etc/default/grub</code> from:
  +
GRUB_CMDLINE_LINUX_DEFAULT="init=/bin/systemd console=hvc0 console=ttyS0"
  +
to
  +
GRUB_CMDLINE_LINUX_DEFAULT="init=/lib/sysvinit/init console=hvc0 console=ttyS0"
  +
  +
After changing the configuration, execute <code>update-grub</code> as sudo or root.
  +
  +
== Purge Systemd ==
  +
Reboot your machine, then remove all of the systemd packages.
 
<span style="color:red;">BE AWARE</span> that the following command removes packages that depend on systemd itself or things like libpam-systemd!
 
<span style="color:red;">BE AWARE</span> that the following command removes packages that depend on systemd itself or things like libpam-systemd!
   
 
apt-get remove --purge --auto-remove systemd
 
apt-get remove --purge --auto-remove systemd
   
  +
== Pin Systemd Packages ==
 
Prevent apt from installing systemd packages in the future.
 
Prevent apt from installing systemd packages in the future.
   
echo -e 'Package: systemd\nPin: origin ""\nPin-Priority: -1' > /etc/apt/preferences.d/systemd
+
echo -e 'Package: systemd\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/systemd
   
 
Prevent apt from installing any systemd like packages in the future (note the star before and after systemd)
 
Prevent apt from installing any systemd like packages in the future (note the star before and after systemd)
   
echo -e '\n\nPackage: *systemd*\nPin: origin ""\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
+
echo -e '\n\nPackage: *systemd*\nPin: release *\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
   
 
Note: This prevents the installation of the package [https://packages.debian.org/de/jessie/systemd-shim systemd-shim] as well. However this is a emulation of systemd functions, so you can install software which depends on systemd. So if you get "Package systemd-shim is not available, but is referred to by another package." you might temporary disable the three lines in the <tt>preferences.d/systemd</tt> file.
 
Note: This prevents the installation of the package [https://packages.debian.org/de/jessie/systemd-shim systemd-shim] as well. However this is a emulation of systemd functions, so you can install software which depends on systemd. So if you get "Package systemd-shim is not available, but is referred to by another package." you might temporary disable the three lines in the <tt>preferences.d/systemd</tt> file.
Line 23: Line 25:
 
In the case your system uses multiarch (mixed 32 and 64bit packages), you need to pin the 64bit version of systemd too. Otherwise apt-get could still install it as dependency later.
 
In the case your system uses multiarch (mixed 32 and 64bit packages), you need to pin the 64bit version of systemd too. Otherwise apt-get could still install it as dependency later.
   
echo -e '\nPackage: systemd:amd64\nPin: origin ""\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
+
echo -e '\nPackage: systemd:amd64\nPin: release *\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
   
 
In other multiarch cases where amd64 is the default architecture, you may have to pin the i386 package to prevent APT from installing it:
 
In other multiarch cases where amd64 is the default architecture, you may have to pin the i386 package to prevent APT from installing it:
   
echo -e '\nPackage: systemd:i386\nPin: origin ""\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
+
echo -e '\nPackage: systemd:i386\nPin: release *\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
   
 
= polkit =
 
= polkit =
Line 41: Line 43:
 
Pin essential packages to wheezy:
 
Pin essential packages to wheezy:
   
echo -e '\n\nPackage: policykit-1\nPin: origin "wheezy"\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
+
echo -e '\n\nPackage: policykit-1\nPin: release "wheezy"\nPin-Priority: 990' >> /etc/apt/preferences.d/systemd
echo -e '\n\nPackage: libpolkit-*\nPin: origin "wheezy"\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
+
echo -e '\n\nPackage: libpolkit-*\nPin: release "wheezy"\nPin-Priority: 990' >> /etc/apt/preferences.d/systemd
echo -e '\n\nPackage: upower\nPin: origin "wheezy"\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd
+
echo -e '\n\nPackage: upower\nPin: release "wheezy"\nPin-Priority: 990' >> /etc/apt/preferences.d/systemd
   
 
Note: for multiarch system you may need also to pin 64bit and i386 versions separately as mentioned above.
 
Note: for multiarch system you may need also to pin 64bit and i386 versions separately as mentioned above.
Line 49: Line 51:
 
Install polkit-1 with libs, upower and udisks (not <tt>udisks'''2'''</tt>!)
 
Install polkit-1 with libs, upower and udisks (not <tt>udisks'''2'''</tt>!)
   
apt-get install polkit-1 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 upower udisks
+
apt-get install policykit-1 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 upower udisks
   
 
Install policykit authentication agent depending on what desktop environment you use:
 
Install policykit authentication agent depending on what desktop environment you use:
Line 58: Line 60:
   
 
Reboot or restart your <tt>*dm</tt> service.
 
Reboot or restart your <tt>*dm</tt> service.
  +
  +
  +
= see also =
  +
* debian.org wiki page [https://wiki.debian.org/systemd#Installing_without_systemd Installing Jessie without systemd] describes a preseed command which will remove systemd and install sysvinit-core during post-install

Latest revision as of 19:23, 14 July 2017

Contents

[edit] Sysvinit

[edit] Installing Sysvinit

First install the SysV init packages:

apt-get install sysvinit-core sysvinit-utils
cp /usr/share/sysvinit/inittab /etc/inittab

[edit] Grub Configuration

This section on grub may only apply to Debian Jessie 8.3+

Next, change the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub from:

GRUB_CMDLINE_LINUX_DEFAULT="init=/bin/systemd console=hvc0 console=ttyS0"

to

GRUB_CMDLINE_LINUX_DEFAULT="init=/lib/sysvinit/init console=hvc0 console=ttyS0"

After changing the configuration, execute update-grub as sudo or root.

[edit] Purge Systemd

Reboot your machine, then remove all of the systemd packages. BE AWARE that the following command removes packages that depend on systemd itself or things like libpam-systemd!

apt-get remove --purge --auto-remove systemd

[edit] Pin Systemd Packages

Prevent apt from installing systemd packages in the future.

echo -e 'Package: systemd\nPin: release *\nPin-Priority: -1' > /etc/apt/preferences.d/systemd

Prevent apt from installing any systemd like packages in the future (note the star before and after systemd)

echo -e '\n\nPackage: *systemd*\nPin: release *\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd

Note: This prevents the installation of the package systemd-shim as well. However this is a emulation of systemd functions, so you can install software which depends on systemd. So if you get "Package systemd-shim is not available, but is referred to by another package." you might temporary disable the three lines in the preferences.d/systemd file.

In the case your system uses multiarch (mixed 32 and 64bit packages), you need to pin the 64bit version of systemd too. Otherwise apt-get could still install it as dependency later.

echo -e '\nPackage: systemd:amd64\nPin: release *\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd

In other multiarch cases where amd64 is the default architecture, you may have to pin the i386 package to prevent APT from installing it:

echo -e '\nPackage: systemd:i386\nPin: release *\nPin-Priority: -1' >> /etc/apt/preferences.d/systemd

[edit] polkit

To enable polkit based stuff (suspend, hibernate, mount via gvfs etc.), the following procedure can be used.

Warning: tested with lightdm on jessie only!

Add wheezy repo to apt lists:

echo deb http://ftp.debian.org/debian/ wheezy main contrib non-free >/etc/apt/sources.list.d/wheezy.list

Pin essential packages to wheezy:

echo -e '\n\nPackage: policykit-1\nPin: release "wheezy"\nPin-Priority: 990' >> /etc/apt/preferences.d/systemd
echo -e '\n\nPackage: libpolkit-*\nPin: release "wheezy"\nPin-Priority: 990' >> /etc/apt/preferences.d/systemd
echo -e '\n\nPackage: upower\nPin: release "wheezy"\nPin-Priority: 990' >> /etc/apt/preferences.d/systemd

Note: for multiarch system you may need also to pin 64bit and i386 versions separately as mentioned above.

Install polkit-1 with libs, upower and udisks (not udisks2!)

apt-get install policykit-1 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 upower udisks

Install policykit authentication agent depending on what desktop environment you use:

apt-get install policykit-1-gnome                                   # For GNOME or XFCE4
apt-get install mate-polkit                                         # For MATE
apt-get install lxsession                                           # For LXDE

Reboot or restart your *dm service.


[edit] see also

Personal tools