[Mageia-dev] Migrating systemd units. Be careful and please test

Colin Guthrie mageia at colin.guthr.ie
Sat Apr 21 17:23:13 CEST 2012


Hello,

I've been trying to review the LSB initscript headers and systemd unit
migration.

It's really great to see packagers helping out here and I'd like to
thank everyone for their effort, but sadly there have been a couple of
errors cropping up in the process. So to help people out I'm including
some advice in this mail. I'll also include the same advice on the
systemd wiki page once I get around to updating it (trying to
consolidate the list of packages there with a Google docs spreadsheet I
have which is more detailed and easier to work with than the wiki page -
when done with that, this info will be on the wiki).


Be careful when copying Fedora units
====================================

Fedora use /run for .pid files. On Fedora /var/run is just a symlink to
/run. We don't do that yet, but we will will likely do this for mga3 as
it solves a few problems we've had to hackily work around. In the mean
time, we should in most cases use /var/run as the PID file path. The
only time when using /run for the PID file is when the ExecStart command
itself has an argument for the pidfile name passed in. If these two
match up then all is well.

Also Fedora often has different syntax in /etc/sysconfig files. During
the migration to systemd they have likely simplified a few of them too.
Again, do not blindly assume the files are the same format. You have to
double check what we do in our initscript with the files and take
appropriate action. You may have to edit the initscript too if you
simplfy the syntax and you may also want to add default values for some
environment variables inside the unit itself.


Be careful of naming differences to sysvinit script
===================================================

If a native systemd unit has a different name to the sysvinit script
(ignoring the .service suffix) make sure to include a masking symlink
such that we know the two services are the same.

e.g. in dhcp-forwarder, the sysvinit script name is dhcp-fwd, but the
systemd service is dhcp-forwarder.service. It's essential that you
include a symlink to dhcp-forwarder.service with the name
dhcp-fwd.service in order for both the upgrade migration and general
running of the system to work.


Please test the result or do not migrate for now
================================================

Some of the problems above are quite obvious when testing. Please make
sure to test things fully.

If you are in any doubt, it's probably best to NOT migrate to a native
unit over a sysvinit script at this stage of the cycle as it could
introduce new problems quite easily. An exception would be if the
initscript does not have LSB headers. In this case I'm happy for either
a native systemd unit to be added or for the sysvinit script to simply
have LSB headers inserted.

Cheers!

Col

-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the Mageia-dev mailing list