[systemd-devel] [PATCH] preset-transient

Dimitri John Ledkov dimitri.j.ledkov at intel.com
Thu Feb 5 08:11:10 PST 2015


Some context for this patch.

I would like to support a new preset model, which has the following properties:

 - distribution shipped defaults are enabled
 - and are applied to each boot/upgrade
 - without overriding any user configuration

In many ways it is very similar to existing functionality but not
quite possible to achieve all of the above.

Thus, I'm introducing a new optional functionality, new unit
configuration directory, and new transient-preset configurations.

On each boot, if TransientPreset=yes, presets from
/usr/lib/systemd/system-preset-transient/*.preset are applied into
configuration path /run/systemd/system-preset-transient/.

An upgrade tool, sysadmin can repeat that action at appropriate points
by also calling: systemctl --runtime preset-all.

If distribution integrates usage of Transient Presets, it gains a few
very nice properties. Fresh installations, much upgrades. User/admin
modifications are preserved. And there is no additional logic required
to maintain separation / diffs between system-defaults and
user-modifications. At the moment distributions like Debian (where
most things are enabled by default) maintain a complex state in /var/
which tracks which things were distro-enabled before/after the
upgrade, as well as whether user/admin has disabled/enabled things
before/after the upgrade and try hard to correctly reconcile the
correct state for all units. However, with this patch, most of this
segregation moves away.

The "transient presets" concept was discussed at the systemd hackfest
in Brussels. I hope this matches at least some expectations and things
we agreed upon there, but face-to-face meetings have a high amount of
details that get lost/misunderstood, so comments & questions & review
are welcomed. I'm starting to integrate and use this concept already,
and I'm hoping it's un-intrusive enough to be included upstream.

The remaining part, which is not addressed in this patch series, yet,
is the ability to override .wants/ symlink from a higher order
configuration directory. That is if the following symlinks are present:
 /etc/systemd/system/foo.service.wants/bar.service -> /dev/null
 /usr/lib/systemd/system/foo.service.wants/bar.service -> ../bar.service
There is no wants dependency added from foo.service -> bar.service.
This bit is discussed in details and agreed upon on the mailing
list. (Unwants thread has urls to the messages)

Regards,

Dimitri.

Dimitri John Ledkov (1):
  Add support for transient presets, applied on every boot.

 man/systemd-system.conf.xml |  1 +
 src/core/main.c             | 30 +++++++++++++++++++++++
 src/core/system.conf        |  1 +
 src/core/unit.c             |  2 +-
 src/shared/install.c        | 59 ++++++++++++++++++++++++++++++---------------
 src/shared/install.h        |  2 +-
 src/shared/path-lookup.c    |  2 ++
 7 files changed, 76 insertions(+), 21 deletions(-)

-- 
2.1.0


More information about the systemd-devel mailing list