]> www.opopop.net Git - reminder/blob - Avoid_systemd_on_Debian_Jessie_with_Mate.mdwn
attachment upload
[reminder] / Avoid_systemd_on_Debian_Jessie_with_Mate.mdwn
1 # Debian Jessie with Mate and without systemd
2
3 ## Rationale
4
5 I am a Debian user and there are packages I don't like to be installed
6 on my computers.
7
8 The most visible one I skip is
9 [Gnome3](https://www.gnome.org/gnome-3/). I really tried to use it on
10 Wheezy. After a month of use, I expected a minimal "get it" moment
11 about that new system. Didn't happen. My workflow doesn't fit at all
12 with Gnome3, and it's a ressource hog on your computer. I am now a
13 [Mate](http://mate-desktop.org/) user.
14
15 I also remove routinely [Avahi](http://www.avahi.org/) (which only
16 merit seems to bring noise on your LAN) and
17 [PulseAudio](http://www.freedesktop.org/wiki/Software/PulseAudio/). This
18 last one is installed by default with Mate, but often gave me no sound
19 after a fresh install [^1]. When I replace it with Gstreamer, I get
20 sound automagically, and there is one less daemon filling my process
21 table.
22
23 [^1]: And yes, I did the obvious verifications: unmuting, chosing the
24 correct audio device...
25
26 On Jessie I tried also
27 [systemd](http://www.freedesktop.org/wiki/Software/systemd/) for a
28 while, read a bit of all the flamewars going on about it and here also
29 I decided it's not for me.
30
31 My arguments are the following:
32
33 1. The existing documentation about systemd is not usable to
34 understand how it works internally; and that is a precondition to be
35 able to debug problems confortably.
36 2. The claim at modularity from systemd proponents is
37 completely false: as all the various daemons and executables
38 comprising systemd share a huge common codebase, what you have in
39 reality is a monolitic system.
40
41 The above two facts are enough to stay away from systemd, whose main
42 programmer, surprise, was also the one involved in coding Avahi and
43 PulseAudio.
44
45 But my main grief about systemd is that it's actually less and less an
46 init system, so it may contaminate too much of your software in the
47 future. I would not object much to systemd if it was only a SysV init
48 replacement.
49
50 But Debian give it's users the choice to skip the init part of systemd
51 while keeping the problematic non-init part mandatory. 
52
53 So the topic of that article is to explain what you can do to limit
54 the use of systemd on your Jessie system, including the non-init
55 part. As I said above, I use Mate on Debian, so I will cover the use
56 of that desktop on that distribution.
57
58 ## Debian Jessie with Mate and systemd init
59
60 So, let's start with a fresh Jessie install. To avoid cluttering my
61 computers with packages I probably won't use, I chose to install only
62 the "standard system" from tasksel before the first reboot.
63
64 At that point, you will have systemd running, with the following
65 daemons:
66
67 * systemd (this is the process with PID 1)
68 * systemd-journal
69 * systemd-logind
70 * systemd-udevd (previously called "udevd")
71
72 For good measure, even it is only "recommended" by systemd, there is
73 also dbus-daemon running. We will need it anyway for a desktop GUI.
74
75 After the first reboot, I uncheck the "download recommended packages"
76 in [aptitude](https://wiki.debian.org/Aptitude) options, then proceed
77 to install Mate as a task [^2].
78
79 [^2]: And if Avahi-daemon is no more installed, the default for Mate
80 is still to use PulseAudio. You can get rid of the PulseAudio daemon
81 by replacing package *mate-settings-daemon-pulse* by package
82 *mate-settings-daemon-gstream*, then suppressing package *pulseaudio*.
83
84 The installed systemd related packages are then the following:
85
86 | Package          |  Installed size |  Number of files     | Mandatory dependencies | Remark |
87 | :-----------     | :-----------:   | :------------------: | :---: | -----: | 
88 | *systemd*        |     12MB        | 700                  |  20   |        |
89 | *libpam-systemd* |    300KB        | 15                   |  10   | Was installed by Mate |
90 | *systemd-sysv*   |     50KB        | 25                   |  10   |        |
91 | *libsystemd0*    |    200KB        | 10                   |  70   |        |
92 | *udev*           |      6MB        | 120                  |  85   |        |
93 | *libudev1*       |    100KB        | 10                   |  90   |        |
94
95 The mandatory dependencies figure is especially important for
96 *libsystemd0*, *libudev1* and *udev*. *libsystemd0* is mostly used to
97 ensure systemd is present, and the additional functionality offered in
98 that case is (for now...) limited. 
99
100 We have been living with *udev* since a long time and it is needed by 
101 *initramfs-tools* and several desktop packages, so it is difficult to 
102 get rid of it. The fact that *udev* development was taken over by 
103 systemd is the real trouble here; but more about that in the conclusion.
104
105 ## Debian Jessie with Mate and SysV init
106
107 Now let's try to replace systemd init by SysV init; this is done by
108 replacing *systemd-sysv* with package *sysvinit-core*. At reboot, from the
109 4 systemd related daemons present initially, there is only
110 systemd-logind left, and process with PID 1 is now the traditional
111 init.
112
113 But the 5 other packages related to systemd are still there! So you
114 can still execute commands like "journalctl" or "systemctl", just
115 these are now mostly empty operations. Only "systemd-cgls" and
116 "systemd-cgtop" still provide useful information.
117
118 So systemd is still sitting on your system, waiting for an upgrade to
119 pull in again *systemd-sysv* and recover its full functionality. At
120 this point, you can put *sysvinit-core* on hold in aptitude.
121
122 In addition, new packages *systemd-shim*, *cgmanager* (it launches a
123 daemon) and some dependencies have been installed on your system.
124
125 The following figure shows the dependencies between some packages in
126 our new configuration. *mate-power-manager* may not be an installed
127 package on a desktop machine.
128
129 [[!img dep-systemd.png size=600x]]
130
131 ## Debian Jessie with Mate, SysV init and a modified *libpam-systemd*
132
133 As *libpam-systemd* is the only package left depending on *systemd*,
134 the idea is here to modify *libpam-systemd* to get rid of it.
135
136 To do that, I took the Debian systemd source, which I modified to
137 build a new package *libpam-systemd*. The main steps were the
138 following:
139
140 1. In debian/control file, I only allow building of *libpam-systemd*,
141    and added that it breaks and replaces *systemd*
142 2. I deleted all source files not needed in the compilation of
143    the PAM module and the daemon "systemd-logind"
144 3. Some other tidying up was done (debian/rules, documentation...)
145
146 This results in a smaller source package (but not so much, which
147 contradicts the claim to systemd "modularity"). 
148
149 For your convenience, all of the source files and the .deb package
150 (for i386) are here:
151
152 [[systemd_215-17+deb8u7bu1.dsc]]
153
154 [[systemd_215-17+deb8u7bu1.tar.gz]]
155
156 [[systemd_215-17+deb8u7bu1_i386.changes]]
157
158 [[libpam-systemd_215-17+deb8u7bu1_i386.deb]]
159
160 If you have installed the needed development packages, it's easy to
161 rebuild file "libpam-systemd_215-17+deb8u7bu1_i386.deb" with these
162 simple commands:
163
164     # the 2 source files have to be downloaded in your current working directory
165     dpkg-source -x systemd_215-17+deb8u7bu1.dsc
166     cd systemd-215
167     dpkg-buildpackage -rfakeroot
168     cd ..
169
170 To install it, you will need some local package repository. An easy
171 method to do it is to run:
172
173     mkdir -p ~/my-repo/dists/jessie/main/binary-i386
174     mv libpam-systemd_215-17+deb8u7bu1_i386.deb ~/my-repo/
175     (cd ~/my-repo; dpkg-scanpackages . /dev/null | gzip > dists/jessie/main/binary-i386/Packages.gz)
176
177 Notice that "dpkg-scanpackages" is available through package
178 *dpkg-dev*.
179
180 Then add line (if you are user "joe"):
181
182     deb file:/home/joe/my-repo/ jessie main 
183
184 to /etc/apt/sources.list and update the available packages in aptitude
185 to take the content of your local repository into account.
186
187 You can then try to upgrade to the new *libpam-systemd*
188 with aptitude. You will get a conflict. Choose to solve it by
189 suppressing *systemd*, proceed with the upgrade and you are done!
190
191 Some people may ask why I haven't changed the name of the new package
192 replacing *libpam-systemd* and suppressed in it any reference to
193 systemd. First, its source code is still pure systemd at that
194 point. And secondly: not having string "systemd" in your computer will
195 not make that software vanish from the universe, like not saying
196 "Voldemort" doesn't make that guy disappear as by magic.
197
198 ## Final remarks
199
200 Installing the modified package *libpam-systemd* proposed above will
201 allow you to get rid of package *systemd*, while keeping your Mate
202 desktop fully functional.
203
204 On your computer there will be only packages *libpam-systemd*,
205 *libsystemd0* and *udev*.
206
207 As said above, there is (for now...) no more harm to continue using
208 packages dependent on *libsystemd0*, as there is to use packages
209 dependent on *libpulse0* (to access PulseAudio) or *libavahi-client3*
210 (to use Avahi), even if you don't have PulseAudio or Avahi daemons
211 running.
212
213 *udev* is a bit more annoying as its functionality has been used for a
214 long time, so it has penetrated deep in our Debian systems. Someone is
215 working on an independent replacement for *udev* called
216 [*vdev*](https://github.com/jcnelson/vdev). The work seems promising,
217 and I will at one point experience his work.
218
219 For a more organized solution to avoid systemd in Debian, you can also 
220 look at the [Devuan distribution](https://devuan.org/), a fork of Debian; 
221 *vdev* is here also a candidate for *udev* replacement.
222
223 Meanwhile, the last Devuan release has shipped with [*eudev*](https://wiki.gentoo.org/wiki/Eudev), 
224 a *udev* fork pushed mainly by Gentoo.