Page MenuHomePhabricator

port Whonix's init.d scripts to systemd
Closed, ResolvedPublic

Description

(To find them...)

find . -type f | grep init.d

Comments on roughly guessed difficulty.

Forum thread:
https://www.whonix.org/forum/index.php/topic,707

Details

Impact
High

Event Timeline

Patrick raised the priority of this task from to Normal.
Patrick updated the task description. (Show Details)
Patrick added a subscriber: Patrick.
Patrick raised the priority of this task from Normal to High.Apr 2 2015, 5:31 PM
Patrick set Impact to Needs Triage.
Patrick added a subscriber: HulaHoop.

I won't do create a systemd unit as replacement for ./packages/ksm/etc/init.d/ksm myself, because the package does not get installed by default and because there is now https://packages.debian.org/sid/ksmtuned. Patches welcome. @HulaHoop

May be helpful for systems configuration. Debian directory structure could be different:

https://access.redhat.com/articles/754933

Paths of the ksm/ksmtuned services on RHEL family:
/usr/lib/systemd/system/ksmtuned.service 
/usr/lib/systemd/system/ksm.service 

Is adding this for ksmtuned a matter of emulating your commit?

In T106#3482, @HulaHoop wrote:

May be helpful for systems configuration. Debian directory structure could be different:

https://access.redhat.com/articles/754933

Paths of the ksm/ksmtuned services on RHEL family:
/usr/lib/systemd/system/ksmtuned.service 
/usr/lib/systemd/system/ksm.service 

Is adding this for ksmtuned a matter of emulating your commit?

Debian systemd layout is same as fedora.

If you plan on overriding an upstream packages unit files, there are a few options:

  1. If you just adding a path or something, add a snippet
  2. place overridden unit file in /etc/system/systemd (This is wehre local modifications go). If you are using another name than the original systemd file, add an Alias in the install section
[Install]
WantedBy=multi-user.target
Alias=qubes-network.service

Then you would need to disable and enable the service to take effect.

add a snippet

Can you please elaborate?

I am not sure if we should remove old sysvinit scripts from packages once systemd units are available. They don't conflict. And someone might wish to use/port the package on systems without systemd. Mailed Paul Wise from Debian what the best practice about this is.

In T106#3814, @Patrick wrote:

add a snippet

Can you please elaborate?

From https://lwn.net/Articles/542609/

Configuration of unit files may now be extended via drop-in
files without having to edit/override the unit files
themselves. More specifically, if the administrator wants to
change one value for a service file foobar.service he can
now do so by dropping in a configuration snippet into
/etc/systemd/systemd/foobar.service.d/*.conf. The unit logic
will load all these snippets and apply them on top of the
main unit configuration file, possibly extending or
overriding its settings. Using these drop-in snippets is
generally nicer than the two earlier options for changing
unit files locally: copying the files from
/usr/lib/systemd/system/ to /etc/systemd/system/ and editing
them there; or creating a new file in /etc/systemd/system/
that incorporates the original one via ".include". Drop-in
snippets into these .d/ directories can be placed in any
directory systemd looks for units in, and the usual
overriding semantics between /usr/lib, /etc and /run apply
for them too.

Great stuff. Needless to say I am a huge fan of drop-in snippets.

In T106#3920, @Patrick wrote:

I am not sure if we should remove old sysvinit scripts from packages once systemd units are available. They don't conflict. And someone might wish to use/port the package on systems without systemd. Mailed Paul Wise from Debian what the best practice about this is.

They can confilct and it is a PITA to debug. You can keep the sysv init scripts in your Debian package but don't install them. I just went though that with network-manager; was wondering why 2 of them were popping up.

Also in order for a systemd unit file to override the sysv init one, you have to first disable it, then re-enable it and they should be both of the same name or you may need to set an alias

Patrick changed Impact from Needs Triage to High.

vbox-disable-timesync, no port to systemd, because upstream does not provide a systemd unit, diverting it, more robust implementation that is compatible with systemd:
https://github.com/Whonix/vbox-disable-timesync/commit/958086eb0d55e0669492ab16ec15d810a533f597

Patrick updated the task description. (Show Details)

TODO: most should use SuccessExitStatus.

Patrick claimed this task.
Patrick updated the task description. (Show Details)

So far everything done here. Created follow up tasks for remaining work.

fix, renamed lib/systemd/system/timesanitycheck to lib/systemd/system/timesanitycheck.service:
https://github.com/Whonix/timesanitycheck/commit/fee20a038d26f281fbbcfe904ece3bd11f556bf9

fix, lib/systemd/msgcollector.service -> lib/systemd/system/msgcollector.service - https://phabricator.whonix.org/T106:
https://github.com/Whonix/msgcollector/commit/a708e9180eb22038aad68e5fb0990a4122eb9daa

systemd unit: added 'KillMode = process', because the daemon handles terminating child processes itself - https://phabricator.whonix.org/T106:
https://github.com/Whonix/sdwdate/commit/3a14c5ecc0649c66df43a396a20a47da4b27383d

systemd unit: added 'KillMode = process', because the daemon handles terminating child processes itself - https://phabricator.whonix.org/T106
https://github.com/Whonix/whonixcheck/commit/7cb379710c081a3e14a68b41d1f30c68ca5f1b0e

systemd unit: added 'Before=rads.service' to prevent output by rads mixing up with output by whonix-initializer and to prevent the login manager from starting before whonix-initializer rebooted the system:
https://github.com/Whonix/whonix-initializer/commit/80dbb25732d58cab3a3abbe7634345d42848d4a5

when timesync (sdwdate gui plugin) is installed, then the sdwdate.service needs an additional 'Requires = msgcollector.service' - https://phabricator.whonix.org/T106:
https://github.com/Whonix/timesync/commit/e1e88c84c07697825a4aea14ac1c723192a58075

systemd unit: added 'StandardOutput=tty' for better look and feel. - https://phabricator.whonix.org/T106
https://github.com/Whonix/swap-file-creator/commit/f49f572e5a06ed33eeacc5647f0f85751cc611b9

systemd unit: added 'Before=tor.service' and 'After=swap-file-creator.service' for better look and feel. - https://phabricator.whonix.org/T106:
https://github.com/Whonix/whonix-initializer/commit/0c1490942edd4c58207980785bb658afa163cb15

systemd unit: added 'Before=graphical.target' and 'Before=getty.target' - https://phabricator.whonix.org/T106:
https://github.com/Whonix/msgcollector/commit/ab24bd261d8ac2027f6a3ad85da4b4a3d416b044