Control Centre: The systemd Linux init system (The H)
The unit files that are associated with systemd and the services are located in the /lib/systemd/system/ directory; if an identically named file exists in /etc/systemd/system/, systemd will ignore the one in the lib directory. This allows administrators to copy and customise a systemd unit file without running the risk that it could be overwritten during the next update – this can happen in SysVinit distributions if one of the init scripts stored in /etc/rc.d/init.d/ has been modified."
Posted May 8, 2012 21:13 UTC (Tue)
by geuder (subscriber, #62854)
[Link] (18 responses)
Myself I like etckeeper (with git) for that purpose. Works perfectly with SysV init scripts (and of course everything else under /etc). Unfortunately it would no longer identify lost update situations with systemd's half solution. Maybe use the right exisiting tool for the purpose, instead of trying to solve a problem of versioning once more. Admittedly git is not 100% the right tool for /etc, but close enough.
Posted May 8, 2012 21:33 UTC (Tue)
by Cyberax (✭ supporter ✭, #52523)
[Link] (9 responses)
With systemd it's all very clear - if you have a file in /etc/init then it's an override and you are responsible for it. That said, I had to override only one unit in my pretty complicated setup.
Posted May 8, 2012 22:23 UTC (Tue)
by geuder (subscriber, #62854)
[Link] (6 responses)
On OpenSUSE there are no hooks (or I failed to find them), so it depends wether the admin remembered to make a commit and how good the cooments are.
Posted May 8, 2012 23:50 UTC (Tue)
by ldo (guest, #40946)
[Link] (5 responses)
My usual, distro-independent way of customizing files in /etc is first to make a copy of the files (or, in some cases, the whole directory), with a -orig suffix. Then I can find my changes quickly with
and of course see what I changed with
or, for directories,
If I’m feeling really brave, I might pipe the output through patch(1) to apply the same changes to another system. :)
Posted May 9, 2012 8:36 UTC (Wed)
by dgm (subscriber, #49227)
[Link] (4 responses)
And, btw, does anybody now why distributions are not doing this by default? I mean, having configuration files versioned. The rcs package is just a few KB, and would make things so much easier.
Posted May 9, 2012 11:19 UTC (Wed)
by cortana (subscriber, #24596)
[Link] (3 responses)
I have always been put off using tools like rcs or git to manage /etc because they don't preserve file metadata such as ownership, permissions, ACLs, xattrs, etc. Some day I'll check out etckeeper.
Posted May 9, 2012 12:36 UTC (Wed)
by drag (guest, #31333)
[Link] (1 responses)
Posted May 9, 2012 17:17 UTC (Wed)
by dgm (subscriber, #49227)
[Link]
Posted May 9, 2012 17:21 UTC (Wed)
by dgm (subscriber, #49227)
[Link]
Posted May 9, 2012 7:30 UTC (Wed)
by jezuch (subscriber, #52988)
[Link] (1 responses)
Debian's dpkg can tell that. If an upgrade wants to install a new version of a config file (in /etc) which was also modified by the user, it will present a choice to keep the modified version or install the one from the package or even try to merge the changes together.
Posted May 9, 2012 7:53 UTC (Wed)
by niner (subscriber, #26151)
[Link]
Posted May 8, 2012 22:09 UTC (Tue)
by johannbg (guest, #65743)
[Link] (2 responses)
That will ensure that your custom unit will inherit all "updates" security or otherwise made by the distribution relevant package maintainer to the relevant unit to his package while giving you the flexibility to have your own modifications.
For example let's say you want systemd to automatically restart the apache service should the apache daemon exits with an exit code not equaling 0,when it is terminated by a signal,when an operation times out or when the configured watchdog timeout is triggered.
You would create a new unit in the /etc/systemd/system directory called httpd.service and it would contain...
.include /usr/lib/systemd/system/httpd.service
[Service]
That's it...
Posted May 8, 2012 22:34 UTC (Tue)
by geuder (subscriber, #62854)
[Link] (1 responses)
(No I haven't real production experience with systemd yet. Just played a bit with F16, but there were no tricky requrements for playing)
Posted May 9, 2012 18:14 UTC (Wed)
by zlynx (guest, #2285)
[Link]
That would mean you could override lines in the middle of the configuration too.
Posted May 8, 2012 23:26 UTC (Tue)
by skitching (guest, #36856)
[Link] (3 responses)
Posted May 9, 2012 16:07 UTC (Wed)
by jspaleta (subscriber, #50639)
[Link]
-jef
Posted May 11, 2012 7:48 UTC (Fri)
by jschrod (subscriber, #1646)
[Link] (1 responses)
Posted May 11, 2012 16:14 UTC (Fri)
by jimparis (guest, #38647)
[Link]
Why not? You'd still get the warning that /lib/systemd/foo was newer than /etc/systemd/foo. And that would let you know to double-check that things are still OK, and to touch /etc/systemd/foo when you're satisfied.
The case where a timestamp check _would_ fail is if the /lib files retain their upstream timestamps rather than the installation timestamps -- then upgrading systemd might install a "new to you" config file that's still older than the last time you touched the corresponding file in /etc.
Posted May 18, 2012 12:04 UTC (Fri)
by wookey (guest, #5501)
[Link]
It's a fascinating subject and there is clearly room for improvement even in the distros that do this relatively well currently: dpkg's tech was clever in 1996, it's rather less impressive these days (oh how I long to be given a 3-way merge to do rather than get a choice of 'current' or 'new'). ucf is much smarter but not used everywhere yet.
Rather than repeat it all I suggest you go read the thread. I _think_ the relevant part starts here:
Posted May 9, 2012 0:18 UTC (Wed)
by clugstj (subscriber, #4020)
[Link] (2 responses)
Posted May 9, 2012 1:59 UTC (Wed)
by ewan (guest, #5533)
[Link]
I'm not sure that untrammelled creativity is really what I'd look for in an init system. A clean implementation that bundles up a lot of existing good ideas, is.
Posted May 9, 2012 15:52 UTC (Wed)
by JoeBuck (subscriber, #2330)
[Link]
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
In most cases I might recognize my modifications (as you say, rarely needed) from somebody elses changes even with not so perfect commit history.
Modifying Files In /etc
find /etc -name \*-orig
diff -u file{-orig,}
diff -ur dir{-orig,}
Modifying Files In /etc
Modifying Files In /etc
Modifying Files In /etc
Modifying Files In /etc
Modifying Files In /etc
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Restart=on-failure
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
http://lists.debian.org/debian-devel/2012/05/msg00349.html
Control Centre: The systemd Linux init system (The H)
Control Centre: The systemd Linux init system (The H)
Finding out whether there is something else interesting about systemd might require clicking the link and reading the article, but it's so much easier to start Slashdot-like threads based on a sentence in the summary.
Control Centre: The systemd Linux init system (The H)