1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-27 10:25:06 +03:00
Commit Graph

29400 Commits

Author SHA1 Message Date
Yu Watanabe
3747daa2e5 systemd-mount: support unmounting devices on remote host
The commit 9017f5d88d prohibits
to unmount devices on remote host. This makes reenable such feature.
2017-07-05 21:55:39 +09:00
Yu Watanabe
f0aac575fc systemd-mount: support discovery of loop backing file
```
$ suro systemd-mount /path/to/disk.img
Started unit run-media-system-disk.img.mount for mount point: /run/media/system/disk.img
```

Closes #6226.
2017-07-05 21:54:40 +09:00
Giedrius Statkevičius
601b08420d systemctl: print next timer trigger time with the status verb (#6242)
It is useful to know when a timer will trigger next when looking at a
timer status message so calculate and print that information.

Closes #5738.

Example output:
$ systemctl status dnf-makecache.timer
● dnf-makecache.timer - dnf makecache timer
   Loaded: loaded (/usr/lib/systemd/system/dnf-makecache.timer; enabled; vendor preset: enabled)
   Active: active (waiting) since Tue 2017-07-04 17:24:02 EDT; 24min ago
  Trigger: Tue 2017-07-04 18:15:56 EDT; 27min left
2017-07-04 17:51:02 -04:00
Benjamin Robin
218f467111 basic: Fix build warning in random-util (#6284) 2017-07-04 17:42:20 -04:00
Franck Bui
1a680ae367 gpt-auto-generator: fix the handling of the value returned by fstab_has_fstype() in add_swap() (#6280)
fstab_has_fstype() returns '1' if fstab contains the passed fstype, not '0'.
2017-07-04 11:41:09 -04:00
NeilBrown
65e1dee7dc fstab-generator: handle NFS "bg" mounts correctly. (#6103)
When "bg" is specified for NFS mounts, and if the server is
not accessible, two behaviors are possible depending on networking
details.
If a definitive error is received, such a EHOSTUNREACH or ECONNREFUSED,
mount.nfs will fork and continue in the background, while /bin/mount
will report success.
If no definitive error is reported but the connection times out
instead, then the mount.nfs timeout will normally be longer than the
systemd.mount timeout, so mount.nfs will be killed by systemd.

In the first case the mount has appeared to succeed even though
it hasn't.  This can be confusing.  Also the background mount.nfs
will never get cleaned up, even if the mount unit is stopped.

In the second case, mount.nfs is killed early and so the mount will
not complete when the server comes back.

Neither of these are ideal.

This patch modifies the options when an NFS bg mount is detected to
force an "fg" mount, but retain the default "retry" time of 10000
minutes that applies to "bg" mounts.
It also imposes "nofail" behaviour and sets the TimeoutSec for the
mount to "infinity" so the retry= time is allowed to complete.
This provides near-identical behaviour to an NFS bg mount started directly
by "mount -a".  The only difference is that systemd will not wait for
the first mount attempt, while "mount -a" will.

Fixes #6046
2017-07-04 09:47:40 +02:00
Lennart Poettering
45d1ffd51d Merge pull request #6274 from keszybz/etags-ctags
meson: ctags support
2017-07-04 09:43:07 +02:00
Peter Hutterer
ea7a562a69 udev: move the KEY_* defines to missing.h (#6278) 2017-07-04 09:41:46 +02:00
Дамјан Георгиевски
39b6a511e0 fix add_esp() in the gpt-auto-generator.c (#6251)
b9088048b1 seems to have broke it

fstab_is_mount_point() returns `true` (1) if the mount point exists and `false` (0) if it doesn't exist.

the change in b9088048 considered that if fstab_is_mount_point() returns 0
the mount point exists.
2017-07-04 09:40:59 +02:00
Lennart Poettering
7c141f6b3d Merge pull request #6255 from keszybz/property-escaping
Proper property escaping
2017-07-04 09:39:56 +02:00
Christian Hesse
437a85112e core: link user keyring to session keyring (#6275)
Commit  74dd6b515f (core: run each system
service with a fresh session keyring) broke adding keys to user keyring.
Added keys could not be accessed with error message:

keyctl_read_alloc: Permission denied

So link the user keyring to our session keyring.
2017-07-04 09:38:31 +02:00
Zbigniew Jędrzejewski-Szmek
2240fc54e9 Merge pull request #6258 from vcaputo/overflow
fix strxcpyx null termination overflows
2017-07-03 21:29:14 -04:00
Zbigniew Jędrzejewski-Szmek
54d46a789e test-strxcpyx: add test for strpcpyf overflow
This fails before 'strxcpyx: don't overflow dest on strpcpyf truncate'.
2017-07-03 20:50:14 -04:00
Thomas H. P. Andersen
38d9338588 NEWS: typo fixes (#6276) 2017-07-03 17:35:05 -04:00
Lennart Poettering
4ee949aac0 build-sys: fix automake build
Lennart broke the automake build in
d4cbada2a9. Let's fix that again, to
unfuck the CIs.
2017-07-03 20:14:35 +02:00
Zbigniew Jędrzejewski-Szmek
60de7ab5d5 Merge pull request #6271 from poettering/resolved-switching
downgrade DNS server switching log messages + NEWS fixes
2017-07-03 12:52:25 -04:00
Zbigniew Jędrzejewski-Szmek
0700e8ba71 meson: add support for ctags
This is a squash of casync commits
02fbbdb2b9
(by Silvio Fricke)
and b687a94b1e.

Instead of checking during every meson config whether etags are
available, just try to call them and error out if not. This has
the advantage that the target is always available (if git is installed),
and the error message gives a hint what needs to be installed.

The naming is confusing, but etags(1) is pretty clear:
- emacs expects TAGS file in etags format
- vi expects tags file in ctags format
and automake docs are pretty clear too:
- tags target generates TAGS file
- ctags target generates tags file
2017-07-03 12:42:29 -04:00
Michal Soltys
1142bed25e vconsole: search for usable source console (#6180)
When vconsole-setup is called without arguments, search for a usable
console instead of using /dev/tty0.

/dev/tty0 — pointing to the current active console — it not necessarily
usable and in such case vconsole-setup would exit with failure. In particular
when systemd-vconsole-setup.service was restarted from within an X
session, it always failed.

If the function searching for a usable source terminal fails, the first
encountered error is returned to the caller.

Closes #5367.

Additional changes:

- true/false functions with 'is_ prefix are renamed to functions with
  'verify_vc_' prefix and return 0 on success and negative error on
  failure
- O_NOCTTY flag is used when opening terminals
2017-07-03 12:38:13 -04:00
Matthew Garrett
d4cbada2a9 sd-boot: stub: Obtain PE section offsets from RAM, not disk (#6250)
In a Secure Boot scenario the stub loader will have been validated
before execution. A malicious drive could then change the data returned
in future reads, resulting in the loader obtaining incorrect section
offsets and (for instance) allowing the command line to be modified.
Pull that information out of the in-RAM representation of the loader
instead in order to avoid this.

Fixes: #6230

(Lennart did some minor coding style fixes, and renamed pefile.c → pe.c,
as suggested by Kay, given that the file now contains a function whose
name doesn't match the filename as prefix anymore.)
2017-07-03 18:14:09 +02:00
Zbigniew Jędrzejewski-Szmek
9db307820e units: use Requires in systemd-networkd-wait-online.service (#6065)
In the initial design, foobar-wait-online.service would have
Requisite=foobar.service, so that foobar-wait-online.service could be enabled
unconditionally, irrespective of whether foobar.service itself is enabled.
Unfortunately this doesn't work too well:

1. the message about foobar-wait-online.service being skipped because of a
   "missing dependency" *looks* like an is problem. This is mostly cosmetic,
   but it also quite confusing. We generally don't want any messages of this
   type during default boot.

2. it is impossible to start and wait for the network in an
   implementation-agnostic way: systemctl start network-online.target, or
   Wants/After=network-online.target in a unit don't work because pulling in
   network-online.target pulls in foobar-wait-online.service, but it in turn
   does not pull in foobar.service. During startup, foobar.service is pulled in
   by multi-user.target, but not in a smaller transaction which does not
   include multi-user.target.

This change means that *-wait-online.service should be installed through
presets, so that it can be enabled/disabled at will by the administrator.
Our own systemd-networkd-wait-online.service does this already, and
similar change has been requested for NetworkManager-wait-online.service
(https://bugzilla.redhat.com/show_bug.cgi?id=1455704).

This change should by mostly backwards-compatible, unless somebody has some
wait-online.service enabled, without having the corresponding network
implementation enabled, and they are relying on it not being started.  I think
that's relatively unlikely because of issue 1. above, and I'm not aware of this
being the default in any distro. And being able to start the network in an
implementation-agnostic way is pretty important, see
https://bugzilla.redhat.com/show_bug.cgi?id=1452866.
2017-07-03 17:05:20 +02:00
Zbigniew Jędrzejewski-Szmek
25fb19da67 man: remove unnecessary "the" 2017-07-03 10:33:42 -04:00
Lennart Poettering
939ae460cd Merge pull request #6231 from keszybz/man-nss-resolved
man: describe the relationship between nss-myhostname and nss-resolved
2017-07-03 16:11:16 +02:00
Vito Caputo
f91049d5d7 strxcpyx: assert throughout on non-NULL src/dest 2017-07-03 06:46:34 -07:00
Vito Caputo
9e5bd85a5f strxcpyx: don't overflow dest on strpcpyf truncate
When vsnprintf() truncated output, dest was advanced by the entire
size of dest leaving it just past the end.  Then the fall-through \0
termination scribbled one past the end.  The explicit null termination
is not necessary since vsnprintf() always includes the terminator even
when truncated.

Additionally these functions encourage calling with zero-length sizes,
while assuming non-zero sizes with potential buffer overflows.

Simply short-circuit the relevant functions when size == 0.

Fixes https://github.com/systemd/systemd/issues/6252
2017-07-03 06:45:53 -07:00
Zbigniew Jędrzejewski-Szmek
5993d46a1a bus-util: replace non-printable values with [unprintable]
Like I said in the previous commit, such values do not seem to appear in normal
use, but it's pretty hard to prove that all paths to assign values properly
check that they contain no spaces. So just in case some slip through, replace
values with spaces (in case of single-valued properties) or spaces and newlines
(in case of array proprties) with "[unprintable]". We were already doing it
in case of properties which we didn't know how to print, so this fits in well.
The advantage is the previous code which used escaping that a) this is easier
to spot, b) does not mess up printing of properties which were properly escaped
already.

v2:
- add comments
2017-07-03 09:30:57 -04:00
Franck Bui
9e7bc4dc3a automount: don't lstat(2) upon umount request (#6086)
When umounting an NFS filesystem, it is not safe to lstat(2) the mountpoint at
all as that can block indefinitely if the NFS server is down.

umount() will not block, but lstat() will.

This patch therefore removes the call to lstat(2) and defers the handling of
any error to the child process which will issue the umount call.
2017-07-03 14:48:21 +02:00
Zbigniew Jędrzejewski-Szmek
0004f698df Parse "timeout=0" as infinity in various generators (#6264)
This extends 2d79a0bbb9 to the kernel
command line parsing.

The parsing is changed a bit to only understand "0" as infinity. If units are
specified, parse normally, e.g. "0s" is just 0. This makes it possible to
provide a zero timeout if necessary.

Simple test is added.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1462378.
2017-07-03 14:29:32 +02:00
Lennart Poettering
131d5e148e Merge pull request #6235 from mbiebl/var-log-lastlog
tmpfiles: create /var/log/lastlog if it does not exist
2017-07-03 11:47:30 +02:00
Lennart Poettering
e634bca681 Merge pull request #6233 from keszybz/man-locale-vconsole
Small doc updates for 00-keyboard.conf, vconsole.conf, locale.conf
2017-07-03 11:40:42 +02:00
Lennart Poettering
7c34a0a306 git-contrib: drop weird non-breaking spaces
For some reason git shortlog spits out non-breaking spaces, let's remove
that, as for our purposes (inclusion in NEWS) we really want breaking
(i.e. normal) spaces.
2017-07-03 11:22:38 +02:00
Lennart Poettering
db8e1324b8 resolved: downgrade log messages about switching DNS servers
As suggested in:

496ae8c84b (commitcomment-22819483)

Let's drop some noise from the logs, as switching between DNS servers is
definitely useful for debugging, but shouldn't get more attention that
that.
2017-07-03 11:20:04 +02:00
Lennart Poettering
184d2c1576 NEWS: tweak contributors list a bit
Let's add more .mailmap entries to clean up GitHub's mess.
2017-07-03 11:19:20 +02:00
Lennart Poettering
3dad4f0666 Merge pull request #6257 from keszybz/unnecessary-job-log
core: do not print color console message about gc-ed jobs
2017-07-03 10:48:28 +02:00
Lennart Poettering
323318a496 Merge pull request #6218 from poettering/v234-pre
preparation for v234
2017-07-03 10:43:00 +02:00
Peter Hutterer
0e4959973f udev: define BTN_DPAD_RIGHT if not present (#6267)
Regression introduced in commit b876bc0 when building on systemds with a pre
3.11 headers (RHEL7 and derivatives).

All the DPAD defines were introduced in the same kernel commit
d09bbfd2a8408a9954, we don't need a separate ifdef check for right.

Fixes #6240
2017-07-03 10:03:22 +02:00
Zbigniew Jędrzejewski-Szmek
0a5706d143 nspawn: wait for the scope to be created (#6261)
Fixes #6253.
2017-07-03 07:59:49 +02:00
Zbigniew Jędrzejewski-Szmek
f518ee04d7 man: add zypper instructions for systemd-nspawn
v2:
- add -c and update the list of packages
v3:
- link to a man page on mankier.com
2017-07-02 19:11:48 -04:00
hadess
ff434e21f2 hwdb: Add SNES Mouse plugged through Retrode 2 (#6263)
Note that this will only work with the new "hid-retrode" driver in the
upcoming 4.12 kernel as otherwise the mouse events and the 4 joypad
ports are bundled into a single event node.
2017-07-03 06:59:44 +10:00
Zbigniew Jędrzejewski-Szmek
bd68e99bd0 Be slightly more verbose in error message
Including the full path is always useful.

Also use PID_FMT in one more place.
2017-07-02 12:03:56 -04:00
Zbigniew Jędrzejewski-Szmek
c23218ae25 core/loopback-setup: make log messages nicer
Under nspawn, systemd would print:

Got address error code: Operation not permitted
Got address error code: Operation not permitted
Got start error code: Operation not permitted

which is quite unclear out of context. Change that to:

Failed to add address 127.0.0.1 to loopback interface: Operation not permitted
Failed to add address ::1 to loopback interface: Operation not permitted
Failed to bring loopback interface up: Operation not permitted
2017-07-02 12:03:56 -04:00
Zbigniew Jędrzejewski-Szmek
047d7219fd core: do not print color console message about gc-ed jobs
This is just a cosmetic issue.

Garbage collection of jobs (especially the ones that we create automatically)
is something of an internal implementation detail and should not be made
visible to the users. But it's probably still useful to log this in the
journal, so the code is rearranged to skip one of the messages if we log to the
console and the journal separately, and to keep the message if we log
everything to the console.

Fixes #6254.
2017-07-01 19:10:48 -04:00
Zbigniew Jędrzejewski-Szmek
3dfbc968e8 Revert "bus: when dumping string property values escape the chars we use as end-of-line and end-of-item marks"
This reverts commit 27e9c5af81.

Property values already use escaping, so escaping them a second time is
confusing. It also should be mostly unnecessary: we take care to make property
values only contains strings which (after the initial escaping) are printable
and parseable without any futher escaping.

Before revert:
$ systemctl list-dependencies 'dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device'
dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device
● ├─dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.swap
● └─systemd-cryptsetup@luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.service
$ systemctl show -p Wants,Requires 'dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device'
Requires=systemd-cryptsetup@luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.service
Wants=dev-mapper-luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.swap

Difference between systemctl show before revert and now:
-Slice=system-systemd\x5cx2dcryptsetup.slice
+Slice=system-systemd\x2dcryptsetup.slice

-Id=systemd-cryptsetup@luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.service
+Id=systemd-cryptsetup@luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.service

-Names=systemd-cryptsetup@luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.service
+Names=systemd-cryptsetup@luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.service

-Requires=system-systemd\x5cx2dcryptsetup.slice
+Requires=system-systemd\x2dcryptsetup.slice

-BindsTo=dev-mapper-luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device dev-disk-by\x5cx2duuid-8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device
+BindsTo=dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device dev-disk-by\x2duuid-8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device

-RequiredBy=dev-mapper-luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device cryptsetup.target
+RequiredBy=dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device cryptsetup.target

-WantedBy=dev-disk-by\x5cx2duuid-8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device
+WantedBy=dev-disk-by\x2duuid-8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device
2017-07-01 16:54:25 -04:00
Zbigniew Jędrzejewski-Szmek
9f09a95a7e NEWS: mention that logind is restartable 2017-06-30 13:36:42 -04:00
Zbigniew Jędrzejewski-Szmek
44abc32307 mailmap: some additions for recent commits 2017-06-30 13:23:32 -04:00
Zbigniew Jędrzejewski-Szmek
74d8f1c55b Merge pull request #6194 from keszybz/urandom-magic
Fall back to /dev/urandom less and other random number improvements.
2017-06-30 13:05:56 -04:00
Susant Sahani
9432a05c54 ethtool: fix half-duplex / full-duplex confusion (#6209)
The values that we used for half-duplex and full-duplex in ethtool_set_glinksettings were
reversed wrt. what the kernel uses.
2017-06-30 12:55:21 -04:00
NeilBrown
ca5b440aa7 core/automount: revise the "fun fact" comments. (#6245)
Fun fact 1 suggests that a "close()" is needed, but that close() has long since been
removed.  So the comment in now meaningless and possibly confusing.

Fun fact 2 refers to a bug that has been fixed in Linux prior to v4.12

Commit: 9fa4eb8e490a ("autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL")

so revise the comment so that no-one goes pointlessly looking for the bug.
2017-06-30 12:51:33 -04:00
Zbigniew Jędrzejewski-Szmek
fa0c9e6315 man: add more detail about quoting in ExecStart lines
Fixes #624.
2017-06-30 10:00:13 -04:00
Lars Karlitski
78c1edd1ef man: fix spelling error of sd_bus_error_set_const (#6246) 2017-06-30 11:57:13 +02:00
hramrach
b876bc09b1 Include dpad buttons in joystick detection (#6240)
Since f472d466ec ("Remove BTN_DPAD_* keys from ID_INPUT_KEY test
    (#5701)") dpad buttons are excluded from keyboard keys for keyboard
detection.

Include them in joystick buttons for joystick detection.
2017-06-30 10:23:58 +10:00