Commit graph

29798 commits

Author SHA1 Message Date
NeilBrown 655f2da079 tmpfiles: silently ignore any path that passes through autofs (#6506)
If a path passes though an autofs filesystem, then accessing
the path might trigger and automount.  As systemd-tmpfiles is run before
the network is up, and as automounts are often used for networked
filesystems, this can cause a deadlock.

So chase_symlinks is enhance to accept a new flag which tells it
to check for autofs, and return -EREMOTE if autofs is found.

tmpfiles is changed to check just before acting on a path so that it
can avoid autofs even if a symlink was created earlier by tmpfiles
that would send this path through an autofs.

This fixes a deadlock that happens when /home is listed in /etc/fstab as
x-systemd.automount for an NFS directory.
2017-09-04 15:35:07 +02:00
Jakub Wilk ee905de0d6 man: fix typos (#6739) 2017-09-04 22:25:59 +09:00
iplayinsun c792ec2e35 core: merge the second CapabilityBoundingSet= lines by AND when it is prefixed with tilde (#6724)
If a unit file contains multiple CapabilityBoundingSet= or
AmbientCapabilities= lines, e.g.,
===
CapabilityBoundingSet=CAP_A CAP_B
CapabilityBoundingSet=~CAP_B CAP_C
===
before this commit, it results all capabilities except CAP_C are set to
CapabilityBoundingSet=, as each lines are always merged by OR.
This commit makes lines prefixed with ~ are merged by AND. So, for the
above example only CAP_A is set.
This makes easier to drop capabilities with drop-in config files.
2017-09-04 12:12:27 +09:00
Jörg Thalheim 6b3c9ead19 NEWS: fix typo in v235 (#6731) 2017-09-04 03:12:12 +09:00
Yu Watanabe e8d85bc062 man: LockPersonality= takes a boolean argument (#6718)
Follow-up for 78e864e5b3.
2017-09-01 09:38:41 +02:00
Lennart Poettering d9ada1e4e1 Merge pull request #6715 from sourcejedi/kbrequest-jobmode2
Fix #6484 "4 or 5 out of 7 targets triggered by SIGRTMIN+X use the wrong job mode"
2017-09-01 09:38:04 +02:00
Lennart Poettering c83f349c5f terminal: unify code for resetting kbd utf8 mode a bit (#6692)
We have the same code at two places, let's unify that at one place.

Follow-up for #6606
2017-09-01 09:09:32 +09:00
Lennart Poettering aac8c0c382 execute: minor ExecOutput handling beautification (#6711)
Let's clean up the checking for the various ExecOutput values a bit,
let's use IN_SET everywhere, and the same concepts for all three bools
we pass to dprintf().
2017-09-01 09:04:27 +09:00
Alan Jenkins 78ca909980 systemctl: remove compiler warning (#6717)
913c1916 changed _ACTION_INVALID to negative, changing the enum to a
signed type.  Take care to avoid comparing it with an unsigned type.

../src/systemctl/systemctl.c: In function ‘start_unit’:
../src/systemctl/systemctl.c:3107:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 assert(arg_action < ELEMENTSOF(action_table));
2017-09-01 09:02:32 +09:00
Lennart Poettering dfff69bfc4 Merge pull request #6637 from sourcejedi/systemctl_cleanup
systemctl: improve readability of start_unit()
2017-08-31 18:51:25 +02:00
Susant Sahani 4d7fa6de3b networkd: Allow tunnels to be created without .network (#6701)
Now we don't support tunnels to be created without a .network file
that is we need a interface index.

This work allows tunnel to be created without a ifindex.

Closes #6695
2017-08-31 18:51:03 +02:00
Lennart Poettering 99f5f8e256 Merge pull request #6708 from poettering/job-result-fixes
minor fixes, in particular to job state display in systemctl
2017-08-31 18:50:11 +02:00
Lennart Poettering e8deb9486f update TODO 2017-08-31 18:30:16 +02:00
Alan Jenkins d60cb656fc manager: fix job mode when signalled to shutdown etc
The irreversible job mode is required to ensure that shutdown is not
interrupted by the activation of a unit with a conflict.

We already used the correct job mode for `ctrl-alt-del.target`.  But not
for `exit.target` (SIGINT of user manager).  The SIGRT shutdown signals
also needed fixing.

Also change SIGRTMIN+0 to isolate default.target, instead of starting
it.  The previous behaviour was documented.  However there was no reason
given for it, nor can we provide one.  The problem that isolate is too
aggressive anywhere outside of emergency.target (#2607) is orthogonal.
This feature is "accessible by different means and only really a safety
net"; it is confusing for it to differ from `systemctl default` without
explanation.

`AllowIsolate=yes` is retained on poweroff.target etc. for backwards
compatibility.

`sigpwr.target` is also an obvious candidate for linking to a shutdown
target.  Unforunately it is also a possible hook for implementing some
logic like system V init did, reading `/etc/powerstatus`.  If we switched
to starting `sigpwr.target` with REPLACE_IRREVERSIBLY, attempts to run
`systemctl shutdown` from it would fail, if they had not thought to set
`DefaultDependencies=no`.  We had provided no examples for `sigpwr`, and
the whole idea is cruft to keep legacy people happy.  For the moment, I
leave `sigpwr` alone, with no risk of disrupting anyone's
previously-working, half-working, or untested setup.

Fixes #6484.  See also #6471
2017-08-31 16:17:42 +01:00
Alan Jenkins c75fbadac6 manager: remove fallback for user/exit.target
The comment here was misleading: the job can fail to enqueue for reasons
other than the target not existing.

The fallback caused an error to be logged, and dates back to when the
"user" directory was named "session".  units/session/exit.target was added
later the same year.

This is consistent with the documentation (man systemd), and the handling
of similar signals.  It's also consistent with `systemctl exit`, which is
what most people would expect.
2017-08-31 16:17:41 +01:00
Alan Jenkins dcb1468861 man: dbus method Manager.Exit() does not start exit.target
It's like Manager.PowerOff(), which does not start poweroff.target.
Instead, the dbus methods are used for `systemctl --force exit`
or `systemctl --force poweroff`.  They shut down the system without
processing individual unit's ExecStop or TimeoutStopSec.
2017-08-31 16:17:41 +01:00
Alan Jenkins f480777623 units: do not install rescue.target for alt-↑
rescue.target does not work well for this.  It is not meant to be started,
only isolated.

Fixes #6493
2017-08-31 16:17:41 +01:00
Lennart Poettering ae835bc75f bus-unit-util: use STR_IN_SET() where appropriate 2017-08-31 15:45:04 +02:00
Lennart Poettering bd5a1c91da bus-unit-util: don't request result property from non-service units 2017-08-31 15:45:04 +02:00
Lennart Poettering ee043777be tree-wide: use pid_is_valid() at more places 2017-08-31 15:45:04 +02:00
Harald Hoyer 6c1f72f626 Load virtio_rng early in the game (#6710)
If true randomness is needed before udev is triggered, which would load
virtio_rng, reading /dev/random takes forever and the boot stalls for a
long time.
2017-08-31 15:33:33 +02:00
Alan Jenkins 913c19161a systemctl: improve readability of start_unit()
start_unit() is a little tangled.  There's an easy part we can untangle,
then readers can concentrate on the more necessary complexity.

* Derive (method, action, mode) more clearly, as disjoint cases based on
  the command.  Don't rely on action_table[_ACTION_INVALID].target being
  implicitly initialized to NULL.

  verb_to_method() is now only used on one case, but not because I strongly
  object to the implicit "StartUnit" cases.  It's more a syntax problem.
  I think the old code takes me longer to understand, because the call
  comes just above a similar-looking call to verb_to_action(), but the
  results of the two functions are used in different ways.  It also helps
  that the new code ends up having a more regular form, for the 4 different
  cases.

  These changes cost 6 extra lines.

* Add an assertion to confirm that we do not pass mode=NULL.
2017-08-31 14:05:28 +01:00
Lennart Poettering 702b64846e Merge pull request #6704 from andir/fix_vrf_table_identifier
VRF documentation, parameter renames & parsing of RT names
2017-08-31 13:46:25 +02:00
Lennart Poettering d7542c46d6 Merge pull request #6709 from yuwata/imply-requires-mounts
core: StateDirectory= and friends imply RequiresMountsFor=
2017-08-31 13:30:26 +02:00
Lennart Poettering deee5c648f Merge pull request #6707 from yuwata/systemctl-show-caps
systemctl: show capabilities in human readable format
2017-08-31 12:46:03 +02:00
Michal Sekletar 780e2ee187 tmpfiles: with "e" don't attempt to set permissions when file doesn't exist (#6682)
tmpfiles.d option "e" when run through systemd-tmpfiles --create should
apply configured permissions (uid,gid) only to already existing
files. When file doesn't exist we bail out with error. Instead we should
silently ignore non-existing files.

$ useradd test
$ cat /etc/tmpfiles.d/foobar.conf
e /tmp/test - test test 1d
$ ls -l /tmp/test
ls: cannot access '/tmp/test': No such file or directory

Before:
$ systemd-tmpfiles --create /etc/tmpfiles.d/foobar.conf
Adjusting owner and mode for /tmp/test failed: No such file or directory
$ echo $?
1

After:
$ systemd-tmpfiles --create /etc/tmpfiles.d/foobar.conf
$ echo $?
0
2017-08-31 12:45:25 +02:00
Susant Sahani 617da14cfd systemd-link: ethtool add support for more Wake up Lan setting (#6331)
This works supports to configure nicast, multicast, broadcast, arp and SecureOn.
2017-08-31 12:44:43 +02:00
Lennart Poettering ec9d3a7e1d Merge pull request #6666 from sourcejedi/suspend-initiate-failure
logind: add missing resume signal when we fail to initiate sleep (and shutdown)
2017-08-31 12:24:18 +02:00
Andreas Rammhold b13049c765 networkd: Added deprecation warning to VRF.TableId 2017-08-31 12:08:33 +02:00
Yu Watanabe 621a2c804c man: fix path for storing random seed 2017-08-31 18:37:27 +09:00
Yu Watanabe d7bdedae87 TODO: update 2017-08-31 18:37:22 +09:00
Yu Watanabe 181b4f56e7 unit: use StateDirectory= instead of RequiresMountsFor= 2017-08-31 18:37:11 +09:00
Yu Watanabe 96f9f6aca7 unit: drop redundant options 2017-08-31 18:29:41 +09:00
Michal Sekletar 1759025418 units: introduce getty-pre.target (#6667)
This new target is a passive unit, hence it is supposed to be pulled in
to the transaction by the service that wants to block login on the
console (e.g. text version of initial-setup). Now both getty and
serial-getty are ordered after this target.

https://lists.freedesktop.org/archives/systemd-devel/2015-July/033754.html
2017-08-31 11:20:14 +02:00
Yu Watanabe ada5e27657 core: StateDirectory= and friends imply RequiresMountsFor= 2017-08-31 18:19:35 +09:00
Lennart Poettering ef965ed2e1 Merge pull request #6431 from keszybz/hwdb-trivial-rows
hwdb: disallow acceleration matrices with trivial rows
2017-08-31 11:08:41 +02:00
Andrew Jeddeloh 0c9b15a38a networkd: dont crash when mtu changes (#6594)
Prevent networkd from crashing when UseMTU is used. Many drivers will
bring the link down and then back up to configure a new MTU. Networkd
will also asynchonously send rtnl messages to configure the link and may
receive responses after the link has gone down and come back up (which
networkd will handle and set the lease and network to NULL.

This changes the behavior to instead return if this is the case instead
of crashing via assert.
2017-08-31 10:58:39 +02:00
Alan Jenkins 081dc63822 systemctl: clarify code - some actions never appear in arg_action (#6638)
ACTION_EMERGENCY and ACTION_DEFAULT would be handled correctly by
start_with_fallback().  However there is no fallback available for
them, and they would never be set in `arg_action` in the first
place.  Remove the unused cases from the switch statement.

@poettering suggested this makes a good place to clarify the point,
explicitly listing all the `arg_action` values which would never be
set.
2017-08-31 10:54:12 +02:00
Evgeny Vereshchagin 58c6e4a2c0 sd-bus: use -- when passing arguments to ssh (#6706)
This prevents `systemctl` from runnning /bin/touch when the following
command is used:
```
systemctl -H '-oProxyCommand=/bin/touch i-shouldnt-be-here' show-environment
```
2017-08-31 10:38:30 +02:00
Topi Miettinen ea89a119cd log: reopen log for failed assertions (#6703)
Reopen log so that failed and aborting assertions can be written to log.

Closes: #6658
2017-08-31 10:37:32 +02:00
Yu Watanabe ae978b9f6c bus-util: remove unnecessary initializations 2017-08-31 17:08:30 +09:00
Yu Watanabe 52610b020c systemctl: show capabilities in human readable format
Follow-up for 21771f338d.
2017-08-31 17:07:28 +09:00
Andreas Rammhold 362f6336df networkd: Updated documentation to refer to new Table= parameter 2017-08-31 01:44:29 +02:00
Andreas Rammhold 62b83cf664 networkd: Renamed table_id field to table
Other parts of the code do just use `table` as identifier for the actual
routing table id. This change should make it easier to read through the
code since the meaning or rather the name stays the same.
2017-08-31 01:14:05 +02:00
Andreas Rammhold f98dd1e707 networkd: Add VRF.Table to support parsing of table names
Previously there was only `VRF.TableId` which only supported numeric
identifiers for routing table. With the additiona of
`config_parse_route_table` also names can be used as identifiers.
2017-08-31 01:11:16 +02:00
Ivan Shapovalov e9ea4526a3 cryptsetup-generator: do not bind to the decrypted device unit (#6538)
This breaks things when the decrypted device is not immediately
`SYSTEMD_READY=1` (e. g. when a multi-device btrfs system is placed on
multiple cryptsetup devices).

Fixes #6537.
2017-08-30 18:49:07 +02:00
NeilBrown 9cbc454770 shutdown: don't remount,ro network filesystems. (#6588)
systemd-shutdown is run after the network is stopped,
so remounting a network filesystem read-only can hang.
A simple umount is the most useful thing that can
be done for a network filesystem once the network is down.
2017-08-30 18:48:25 +02:00
Alan Jenkins 1d82e6b3ed man: fix note for systemctl enable --global (#6592)
The last sentence in the paragraph described the behaviour of `--global`.  But "the last case" we listed was "only this boot", which does not match...  This was the fifth case described, but there are only _four_ different option names.  Fix it.
2017-08-30 18:47:40 +02:00
Alan Jenkins 64a36ae4b1 units: starting suspend.target should not fail when suspend is successful (#6678)
and the same for hibernate.target and hybrid-sleep.target.

Tested with both sucessful and unsuccessful suspends.  The result of the
start job was correct in both cases.  Closes #6419 (a regression in v233
and v234).

> suspend is unsual for a target, because it has to stop itself once it's
> started. Otherwise you couldn't start it again, so you could only suspend
> once! Currently that's implemented using BindsTo=systemd-sleep.service.
> Meaning it pulls in systemd-sleep.service to do the actual suspend, and
> then de-activates afterwards. But the behaviour of BindsTo was changed
> recently (not without some issues during development) - maybe this bug
> is caused by poettering/systemd@631b676 which I think was added in
> release v233.
>
> sleep.target (see man systemd.special) has the same need, but it
> implements it differently. It simply has StopWhenUnneeded=yes.

This commit switches suspend.target etc. to the approach used by
sleep.target.
2017-08-30 18:20:23 +02:00
Alan Jenkins 3f1a3d4ac5 sulogin-shell: remove ineffective job mode option from systemctl isolate (#6627)
`systemctl default` uses job mode `isolate` (see `action_table`).
The job mode option is ignored.

Note that exiting the emergency shell service by using e.g.
`systemctl isolate multi-user` or `systemctl start multi-user.target`
already kills `emergency.service`.  There's only a potential conflict
between your command and the command in systemd-sulogin-shell if you run
something like `systemctl start --no-block multi-user.target; exit`.
Which is nothing like what we told them to do :).
2017-08-30 18:11:31 +02:00