Commit Graph

20 Commits

Author SHA1 Message Date
João Paulo Rechi Vita 5c86583cf8 tmpfiles: Order tmpfiles-setup after journald
systemd-tmpfiles-setup.service needs to be ordered after
systemd-journald.service, so entries in /run/log/journal are already
created when systemd-tmpfiles tries to adjust its permissions.

This is specially problematic for setups using a volatile journal where
the initrd does not ship a machine-id (i.e. OSTree-based systems), where
logs from the initrd will be inaccessible for users in the
systemd-journal group. It also has a side effect of `journalctl --user`
failing with "No journal files were opened due to insufficient
permissions".

Fixes #10128.
2018-09-20 13:20:41 +02:00
Zbigniew Jędrzejewski-Szmek c79b89e6eb tmpfiles: ignore "operational" errors during setup
We still get the errors logged, but we don't fail the service. This
is better for users because rerunning tmpfiles-setup.service a second
time is dangerous (c.f. cd9f5b68ce).
Note that this only touches sd-tmpfiles-setup.service and
sd-tmpfiles-setup-dev.service. sd-tmpfiles-clean.service is as before.

https://bugzilla.redhat.com/show_bug.cgi?id=1539341
2018-04-05 08:13:53 +02:00
Zbigniew Jędrzejewski-Szmek cd9f5b68ce units: use SuccessExitStatus to ignore syntax errors in tmpfiles
This makes sense from the point of view of the whole distribution:
if there are some specific files that have syntax problems, or unknown
users or groups, or use unsupported features, failing the whole service
is not useful.

In particular, services with tmpfiles --boot should not be started after boot.
The premise of --boot is that there are actions which are only safe to do once
during boot, because the state evolves later through other means and re-running
the boot-time setup would destroy it. If services with --boot fail in the
initial transaction, they would be re-run later on when a unit which
(indirectly) depends on them is started, causing problems.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1507501.

(If we had a mode where a service would at most run once, and would not be
started in subsequent transactions, that'd be a good additional safeguard.
Using ExecStart=-... is a bit like that, but it causes all failure to be
ignored, which is too big of a hammer.)
2017-12-01 18:58:54 +01:00
Zbigniew Jędrzejewski-Szmek a7df2d1e43 Add SPDX license headers to unit files 2017-11-19 19:08:15 +01:00
Daniel Buch d6bc8348d5 readahead: wipe out readahead 2014-09-25 16:39:18 +02:00
Zbigniew Jędrzejewski-Szmek 0fdeb6e011 units: remove RefuseManualStart from units which are always around
In a normal running system, non-passive targets and units used during
early bootup are always started. So refusing "manual start" for them
doesn't make any difference, because a "start" command doesn't cause
any action.

In early boot however, the administrator might want to start on
of those targets or services by hand. We shouldn't interfere with that.

Note: in case of systemd-tmpfiles-setup.service, really running the
unit after system is up would break the system. So e.g. restarting
should not be allowed. The unit has "RefuseManualStop=yes", which
prevents restart too.
2014-06-28 00:06:30 -04:00
Lennart Poettering ecde7065f7 units: rebuild /etc/passwd, the udev hwdb and the journal catalog files on boot
Only when necessary of course, nicely guarded with the new
ConditionNeedsUpdate= condition we added.
2014-06-13 13:26:32 +02:00
Lennart Poettering db62b5b37e units: remove conditions from systemd-tmpfiles-setup
There's no point in conditionalizing systemd-tmpfiles at boot, since we
ship tmpfiles snippets ourselves, hence they will always trigger anyway.

Also, there's no reason to pull in local-fs.target from the service,
hence drop that.
2014-06-13 13:26:32 +02:00
Zbigniew Jędrzejewski-Szmek 8181565124 tmpfiles: rename --unsafe to --boot
As suggested by Kay, it is better to describe what is done,
not what might happen.
2013-12-30 13:01:27 -05:00
Zbigniew Jędrzejewski-Szmek c4708f1323 tmpfiles: introduce the concept of unsafe operations
Various operations done by systemd-tmpfiles may only be safely done at
boot (e.g. removal of X lockfiles in /tmp, creation of /run/nologin).
Other operations may be done at any point in time (e.g. setting the
ownership on /{run,var}/log/journal). This distinction is largely
orthogonal to the type of operation.

A new switch --unsafe is added, and operations which should only be
executed during bootup are marked with an exclamation mark in the
configuration files. systemd-tmpfiles.service is modified to use this
switch, and guards are added so it is hard to re-start it by mistake.

If we install a new version of systemd, we actually want to enforce
some changes to tmpfiles configuration immediately. This should now be
possible to do safely, so distribution packages can be modified to
execute the "safe" subset at package installation time.

/run/nologin creation is split out into a separate service, to make it
easy to override.

https://bugzilla.redhat.com/show_bug.cgi?id=1043212
https://bugzilla.redhat.com/show_bug.cgi?id=1045849
2013-12-24 15:48:06 -05:00
Zbigniew Jędrzejewski-Szmek ef72c1f06e man,units: tmpfiles.d(5) cleanup
Condition for /lib (necessary for split /usr) was missing from the unit.

Some changes which were done in tmpfiles.d(5) were not carried over to
systemd-tmpfiles(1).

Also use markup where possible.
2013-12-24 15:48:06 -05:00
Dave Reisner ec99834cb0 tmpfiles-setup: exclude /dev prefixes files
Fixes Arch Linux bug: https://bugs.archlinux.org/task/36259
2013-07-24 12:04:00 -04:00
Lennart Poettering c35b956d34 units: rework systemd-random-seed-{load,save}.service to be a single service
That way ordering it with MountsRequiredFor= works properly, as this no
longer results in mount units start requests to be added to the shutdown
transaction that conflict with stop requests for the same unit.
2013-05-15 22:38:51 +02:00
Umut Tezduyar 195f8e3612 man: link systemd-tmpfiles-setup-dev.service 2013-04-23 12:55:44 +02:00
Lennart Poettering 49dbfa7b2b units: introduce new Documentation= field and make use of it everywhere
This should help making the boot process a bit easier to explore and
understand for the administrator. The simple idea is that "systemctl
status" now shows a link to documentation alongside the other status and
decriptionary information of a service.

This patch adds the necessary fields to all our shipped units if we have
proper documentation for them.
2012-05-21 15:14:51 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Kay Sievers adf70c5e4e binfmt, modules-load, sysctl, tmpfiles: add missing ConditionDirectoryNotEmpty= 2011-04-30 23:08:15 +02:00
Lennart Poettering 74ce487daf tmpfiles: move binary to /bin to make it publicly available 2011-02-13 14:04:57 +01:00
Lennart Poettering e096bf2f95 units: move a couple of units from base.target to sysinit.target 2010-11-19 16:24:21 +01:00
Lennart Poettering 3b63d2d31d tmpfiles: integrate kay's directory cleanup code and otherwise beef up tmpfiles quite a bit 2010-10-18 22:38:41 +02:00
Renamed from units/systemd-tmpfiles.service.in (Browse further)