platform/upstream/systemd.git
7 years agosd-bus: socket - only transmit auxillary FDs once (#6603)
Tom Gundersen [Wed, 30 Aug 2017 11:09:03 +0000 (13:09 +0200)]
sd-bus: socket - only transmit auxillary FDs once (#6603)

If a message is too large to fit into the output buffer, it will be
transmitted to the kernel in several chunks. However, the FDs must
only ever be transmitted once or they will bereceived by the remote
end repeatedly.

The D-Bus specification disallows several sets of FDs attached to
one message, however, the reference implementation of D-Bus will
not reject such a message, rather it will reassign the duplicate
FDs to subsequent FD-carrying messages.

This attaches the FD array only to the first byte of the message.

7 years agoREADME: note that installing valgrind-devel maybe useful to developers (#6502)
Michal Sekletar [Wed, 30 Aug 2017 11:07:43 +0000 (13:07 +0200)]
README: note that installing valgrind-devel maybe useful to developers (#6502)

Commit also mentions that when running under valgrind we actually don't
execve() systemd-shutdown. We have a comment about this in the code, but
being upfront about this change in behavior doesn't hurt.

7 years agoupdate TODO
Lennart Poettering [Wed, 30 Aug 2017 10:21:37 +0000 (12:21 +0200)]
update TODO

7 years agoMerge pull request #6659 from yuwata/econnrefused
Lennart Poettering [Wed, 30 Aug 2017 10:17:53 +0000 (12:17 +0200)]
Merge pull request #6659 from yuwata/econnrefused

networkd: do not fail manager_connect_bus() if dbus is not active yet

7 years agonetworkd: Honor configured DHCP ClientIdentifier on link_update (#6622)
Jon Ringle [Wed, 30 Aug 2017 09:38:00 +0000 (05:38 -0400)]
networkd: Honor configured DHCP ClientIdentifier on link_update (#6622)

We have an embedded board with a couple of ethernet ports. From the kernel
log, I can see that the ethernet drivers are obtaining their correct MAC
address, but for some reason, at first systemd-networkd doesn't see the
mac address for the ethernet port at the time that it looks at
dhcp_client_identifier configuration (it has 00:00:00:00:00:00 for mac).

Later on, systemd-networkd gets a link_update() call, and at this time, it
has the correct mac address for the ethernet port. However, in link_update()
the dhcp_client_identifier configuration is not being considered, and a call
to sd_dhcp_client_set_iaid_duid() is being done always

7 years agoMerge pull request #6691 from yuwata/man-journal-remote2
Lennart Poettering [Wed, 30 Aug 2017 09:31:37 +0000 (11:31 +0200)]
Merge pull request #6691 from yuwata/man-journal-remote2

journal-remote: small fixes

7 years agoupdate TODO
Lennart Poettering [Wed, 30 Aug 2017 08:50:01 +0000 (10:50 +0200)]
update TODO

7 years agoMerge pull request #6672 from yuwata/drop-priv
Lennart Poettering [Wed, 30 Aug 2017 08:45:24 +0000 (10:45 +0200)]
Merge pull request #6672 from yuwata/drop-priv

use !! prefix in networkd and timesyncd

7 years agoman: journal-remote: add detailed condition when SplitMode=none must be used
Yu Watanabe [Wed, 30 Aug 2017 08:03:37 +0000 (17:03 +0900)]
man: journal-remote: add detailed condition when SplitMode=none must be used

7 years agoterminal reset should honour default_utf8 kernel setting (#6606)
g0tar [Wed, 30 Aug 2017 08:00:44 +0000 (10:00 +0200)]
terminal reset should honour default_utf8 kernel setting (#6606)

terminal reset should honour default_utf8 kernel setting

7 years agojournal-remote: show error if SplitMode=host with 'active' source is specified
Yu Watanabe [Wed, 30 Aug 2017 07:56:41 +0000 (16:56 +0900)]
journal-remote: show error if SplitMode=host with 'active' source is specified

7 years agotest: drop Exec* prefixes to obtain paths of executables
Yu Watanabe [Sat, 26 Aug 2017 16:48:23 +0000 (01:48 +0900)]
test: drop Exec* prefixes to obtain paths of executables

7 years agotimesync: move stamp file to /var/lib/systemd/timesync/clock
Yu Watanabe [Wed, 30 Aug 2017 06:59:57 +0000 (15:59 +0900)]
timesync: move stamp file to /var/lib/systemd/timesync/clock

7 years agoMerge pull request #6585 from poettering/seccomp-lock-personality
Lennart Poettering [Tue, 29 Aug 2017 16:58:56 +0000 (18:58 +0200)]
Merge pull request #6585 from poettering/seccomp-lock-personality

Seccomp lock personality

7 years agoMerge pull request #6677 from yuwata/man-journal-remote
Lennart Poettering [Tue, 29 Aug 2017 16:04:50 +0000 (18:04 +0200)]
Merge pull request #6677 from yuwata/man-journal-remote

journal-remote: improve man page and error message

7 years agonamespace: avoid assertion failure (#6649)
Topi Miettinen [Tue, 29 Aug 2017 15:31:24 +0000 (15:31 +0000)]
namespace: avoid assertion failure (#6649)

If the root image is not decrypted, it must not be relinquished.

7 years agoMerge pull request #6670 from fsateler/disable-networkd
Lennart Poettering [Tue, 29 Aug 2017 15:28:06 +0000 (17:28 +0200)]
Merge pull request #6670 from fsateler/disable-networkd

build-sys: don't build networkctl if networkd is disabled

7 years agocore: open up LockPersonality= for transient units
Lennart Poettering [Wed, 9 Aug 2017 18:52:54 +0000 (20:52 +0200)]
core: open up LockPersonality= for transient units

Let's make "systemd-run -p LockPersonality=1 -t /bin/sh" work.

7 years agoseccomp: rework seccomp_lock_personality() to apply filter to all archs
Lennart Poettering [Wed, 9 Aug 2017 18:43:35 +0000 (20:43 +0200)]
seccomp: rework seccomp_lock_personality() to apply filter to all archs

7 years agoseccomp: default to something resembling the current personality when locking it
Lennart Poettering [Wed, 9 Aug 2017 18:40:26 +0000 (20:40 +0200)]
seccomp: default to something resembling the current personality when locking it

Let's lock the personality to the currently set one, if nothing is
specifically specified. But do so with a grain of salt, and never
default to any exotic personality here, but only PER_LINUX or
PER_LINUX32.

7 years agoseccomp: LockPersonality boolean (#6193)
Topi Miettinen [Tue, 4 Jul 2017 12:48:18 +0000 (15:48 +0300)]
seccomp: LockPersonality boolean (#6193)

Add LockPersonality boolean to allow locking down personality(2)
system call so that the execution domain can't be changed.
This may be useful to improve security because odd emulations
may be poorly tested and source of vulnerabilities, while
system services shouldn't need any weird personalities.

7 years agoMerge pull request #6636 from sourcejedi/fsync
Lennart Poettering [Tue, 29 Aug 2017 13:19:44 +0000 (15:19 +0200)]
Merge pull request #6636 from sourcejedi/fsync

"Don't fear the fsync()"

7 years agofileio: rename function parameter to avoid masking global symbol
Alan Jenkins [Tue, 29 Aug 2017 09:56:32 +0000 (10:56 +0100)]
fileio: rename function parameter to avoid masking global symbol

> glibc exports a function called sync(), we should probably avoid
> overloading that as a variable here locally (gcc even used to warn about
> that, not sure why it doesn't anymore), to avoid confusion around what
> "if (sync)" actually means

7 years agohwdb: Add various USB mice (#6676)
Jonathan Teh [Mon, 28 Aug 2017 22:32:59 +0000 (23:32 +0100)]
hwdb: Add various USB mice (#6676)

7 years agoMerge pull request #6653 from yuwata/man-link
Lennart Poettering [Mon, 28 Aug 2017 17:12:35 +0000 (19:12 +0200)]
Merge pull request #6653 from yuwata/man-link

Small fixes

7 years agoshared: Add a linker script so that all functions are tagget @SD_SHARED instead of...
Felipe Sateler [Mon, 28 Aug 2017 16:49:03 +0000 (13:49 -0300)]
shared: Add a linker script so that all functions are tagget @SD_SHARED instead of @Base (#6669)

This helps prevent symbol collisions with other programs and libraries. In particular,
because PAM modules are loaded into the process that is creating the session, and
systemd creates PAM sessions, the potential for collisions is high.

Disambiguate all systemd calls by tagging a 'version' SD_SHARED.

Fixes #6624

7 years agoRevert "mount-setup: mount xenfs filesystem (#6491)" (#6662)
vliaskov [Mon, 28 Aug 2017 16:46:01 +0000 (18:46 +0200)]
Revert "mount-setup: mount xenfs filesystem (#6491)" (#6662)

This reverts commit b305bd3aab0446095bf28ffc28b3d908a7ace6b9.

7 years agoFix typo in man/systemd.exec.xml (#6683)
Diogo Pereira [Mon, 28 Aug 2017 16:38:29 +0000 (17:38 +0100)]
Fix typo in man/systemd.exec.xml (#6683)

7 years agoAdded Romanian Translation (#6674)
dasj19 [Mon, 28 Aug 2017 16:24:09 +0000 (18:24 +0200)]
Added Romanian Translation (#6674)

7 years agoSupport 'rdma' as a ListenNetlink= argument (#6626)
Jason Gunthorpe [Mon, 28 Aug 2017 15:22:10 +0000 (09:22 -0600)]
Support 'rdma' as a ListenNetlink= argument (#6626)

NETLINK_RDMA has been in the kernel since v3.0.

7 years agoeditorconfig: add rule for meson.build files (#6671)
Felipe Sateler [Mon, 28 Aug 2017 14:37:23 +0000 (11:37 -0300)]
editorconfig: add rule for meson.build files (#6671)

7 years agonetworkd: do not install the socket when networkd is not enabled
Felipe Sateler [Sun, 27 Aug 2017 13:49:10 +0000 (10:49 -0300)]
networkd: do not install the socket when networkd is not enabled

7 years agojournal-remote: show error message if output file name does not end with .journal
Yu Watanabe [Sun, 27 Aug 2017 07:34:53 +0000 (16:34 +0900)]
journal-remote: show error message if output file name does not end with .journal

`journalctl -o export | systemd-journal-remote -o /tmp/dir -`
gives the following error messages.
```
Failed to open output journal /tmp/dir: Invalid argument
Failed to get writer for source stdin: Invalid argument
Failed to create source for fd:0 (stdin): Invalid argument
```
And these are hard to understand what is the problem.
This commit makes journal-remote check whether the output file name
ends with .journal suffix or not, and if not, output error message.

7 years agoman: journal-remote: active mode without --url option requires output filename
Yu Watanabe [Sun, 27 Aug 2017 07:20:12 +0000 (16:20 +0900)]
man: journal-remote: active mode without --url option requires output filename

Closes #6675.

7 years agounits: make use of !! ExecStart= prefix in systemd-timesyncd.service
Yu Watanabe [Thu, 10 Aug 2017 07:07:08 +0000 (16:07 +0900)]
units: make use of !! ExecStart= prefix in systemd-timesyncd.service

Let's make use of !! to run timesyncd with ambient capabilities on
systems supporting them.

7 years agounits: make use of !! ExecStart= prefix in systemd-networkd.service
Yu Watanabe [Sat, 26 Aug 2017 16:40:47 +0000 (01:40 +0900)]
units: make use of !! ExecStart= prefix in systemd-networkd.service

Let's make use of !! to run networkd with ambient capabilities on
systems supporting them.

7 years agobuild-sys: fix the script used for generating load_fragment_gperf_nulstr (#6646)
Evgeny Vereshchagin [Sat, 26 Aug 2017 14:21:23 +0000 (17:21 +0300)]
build-sys: fix the script used for generating load_fragment_gperf_nulstr (#6646)

This prevents `systemd --dump-configuration-items` from crashing.
Closes #6596.

7 years agoNetworkd Bond DOC: Move ActiveSlave and PrimarySlave to [Network] (#6610)
Susant Sahani [Sat, 26 Aug 2017 13:37:46 +0000 (19:07 +0530)]
Networkd Bond DOC: Move ActiveSlave and PrimarySlave to [Network] (#6610)

Fixes #6545

7 years agologind: make sure we don't process the same method call twice (#6583)
Lennart Poettering [Sat, 26 Aug 2017 13:19:26 +0000 (15:19 +0200)]
logind: make sure we don't process the same method call twice (#6583)

Tiny mistake, big effect.

Fixes: #6375

7 years agoMerge pull request #6582 from poettering/logind-tty
Yu Watanabe [Sat, 26 Aug 2017 13:12:48 +0000 (22:12 +0900)]
Merge pull request #6582 from poettering/logind-tty

various tty path parsing fixes

7 years agocore: disable the effect of Restart= if there's a stop job pending for a service...
Lennart Poettering [Sat, 26 Aug 2017 13:07:23 +0000 (15:07 +0200)]
core: disable the effect of Restart= if there's a stop job pending for a service (#6581)

We shouldn't undo the job already enqueued, under any circumstances.

Fixes: #6504

7 years agoman: fix example indentation in tmpfiles.d(5) (#6578)
Lennart Poettering [Sat, 26 Aug 2017 12:59:21 +0000 (14:59 +0200)]
man: fix example indentation in tmpfiles.d(5) (#6578)

docboc actually copies the indentation 1:1 into the final man page and
that makes the example really weirdly aligned. Let's fix that.

7 years agoMerge pull request #6577 from poettering/more-exec-flags
Yu Watanabe [Sat, 26 Aug 2017 12:49:05 +0000 (21:49 +0900)]
Merge pull request #6577 from poettering/more-exec-flags

add ! and !! ExecStart= flags to make ambient caps useful

7 years agoservice: attempt to execute next main command only for oneshot services (#6619)
Michal Sekletar [Fri, 25 Aug 2017 13:36:10 +0000 (15:36 +0200)]
service: attempt to execute next main command only for oneshot services (#6619)

This commit fixes crash described in
https://github.com/systemd/systemd/issues/6533

Multiple ExecStart lines are allowed only for oneshot services
anyway so it doesn't make sense to call service_run_next_main() with
services of type other than SERVICE_ONESHOT.

Referring back to reproducer from the issue, previously we didn't observe
this problem because s->main_command was reset after daemon-reload hence
we never reached the assert statement in service_run_next_main().

Fixes #6533

7 years agobuild-sys: don't build networkctl if networkd is disabled
Felipe Sateler [Mon, 21 Aug 2017 12:48:41 +0000 (09:48 -0300)]
build-sys: don't build networkctl if networkd is disabled

7 years agonetwork,resolve: remove comments related to kdbus
Yu Watanabe [Wed, 23 Aug 2017 03:38:56 +0000 (12:38 +0900)]
network,resolve: remove comments related to kdbus

7 years agonetworkd: do not fail manager_connect_bus() if dbus is not active yet
Yu Watanabe [Wed, 23 Aug 2017 03:36:36 +0000 (12:36 +0900)]
networkd: do not fail manager_connect_bus() if dbus is not active yet

Fixes #6618.

7 years agoman: mention configuration directories to sysusers.d
Yu Watanabe [Tue, 22 Aug 2017 04:27:21 +0000 (13:27 +0900)]
man: mention configuration directories to sysusers.d

7 years agoMerge pull request #6615 from ssahani/client-id
Yu Watanabe [Tue, 22 Aug 2017 11:19:19 +0000 (20:19 +0900)]
Merge pull request #6615 from ssahani/client-id

networkd: fix spell DCHPClientIdentifier (DCHP => DHCP)

7 years agoman: fix wrong citation in systemd-sysctl.service.xml
Yu Watanabe [Tue, 22 Aug 2017 04:26:09 +0000 (13:26 +0900)]
man: fix wrong citation in systemd-sysctl.service.xml

7 years agoCONTRIBUTING: stop mentioning "make check"
Michael Biebl [Mon, 21 Aug 2017 07:47:07 +0000 (09:47 +0200)]
CONTRIBUTING: stop mentioning "make check"

Since the switch to meson this information is no longer valid. HACKING already documents how to run the test suite.

See #6642

7 years agohwdb: Add Logitech G100s Optical Gaming Mouse (#6570)
Charles Huber [Thu, 17 Aug 2017 19:53:25 +0000 (14:53 -0500)]
hwdb: Add Logitech G100s Optical Gaming Mouse (#6570)

7 years ago"Don't fear the fsync()"
Alan Jenkins [Thu, 17 Aug 2017 16:09:44 +0000 (17:09 +0100)]
"Don't fear the fsync()"

For files which are vital to boot

1. Avoid opening any window where power loss will zero them out or worse.
   I know app developers all coded to the ext3 implementation, but
   the only formal documentation we have says we're broken if we actually
   rely on it.  E.g.

   * `man mount`, search for `auto_da_alloc`.
   * http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
   * https://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/

2. If we tell the kernel we're interested in writing them to disk, it will
   tell us if that fails.  So at minimum, this means we play our part in
   notifying the user about errors.

I refactored error-handling in `udevadm-hwdb` a little.  It turns out I did
exactly the same as had already been done in the `systemd-hwdb` version,
i.e. commit d702dcd.

7 years agolocaled: don't remove xorg.conf.d/00-keyboard.conf on failures
Alan Jenkins [Thu, 17 Aug 2017 16:21:34 +0000 (17:21 +0100)]
localed: don't remove xorg.conf.d/00-keyboard.conf on failures

One of the benefits of updating a file "atomically", is to avoid losing the
old version.  For example, if we run out of disk space half-way through.

Fix localed to enjoy this benefit.

7 years agonetworkd: fix spell DCHPClientIdentifier (DCHP => DHCP)
Susant Sahani [Tue, 15 Aug 2017 04:50:25 +0000 (10:20 +0530)]
networkd: fix spell DCHPClientIdentifier (DCHP => DHCP)

7 years agoMerge pull request #6475 from martinpitt/test-set-e
Evgeny Vereshchagin [Fri, 11 Aug 2017 04:02:02 +0000 (07:02 +0300)]
Merge pull request #6475 from martinpitt/test-set-e

test: Run qemu/nspawn tests with "set -e"

7 years agounits: make use of the new !! ExecStart= prefix in systemd-resolved.service
Lennart Poettering [Wed, 9 Aug 2017 14:15:07 +0000 (16:15 +0200)]
units: make use of the new !! ExecStart= prefix in systemd-resolved.service

Let's make use of !! to run resolved with ambient capabilities on
systems supporting them.

7 years agocore: add two new special ExecStart= character prefixes
Lennart Poettering [Wed, 9 Aug 2017 14:09:04 +0000 (16:09 +0200)]
core: add two new special ExecStart= character prefixes

This patch adds two new special character prefixes to ExecStart= and
friends, in addition to the existing "-", "@" and "+":

"!"  → much like "+", except with a much reduced effect as it only
       disables the actual setresuid()/setresgid()/setgroups() calls, but
       leaves all other security features on, including namespace
       options. This is very useful in combination with
       RuntimeDirectory= or DynamicUser= and similar option, as a user
       is still allocated and used for the runtime directory, but the
       actual UID/GID dropping is left to the daemon process itself.
       This should make RuntimeDirectory= a lot more useful for daemons
       which insist on doing their own privilege dropping.

"!!" → Similar to "!", but on systems supporting ambient caps this
       becomes a NOP. This makes it relatively straightforward to write
       unit files that make use of ambient capabilities to let systemd
       drop all privs while retaining compatibility with systems that
       lack ambient caps, where priv dropping is the left to the daemon
       codes themselves.

This is an alternative approach to #6564 and related PRs.

7 years agocapability: add new ambient_capabilities_supported() helper
Lennart Poettering [Wed, 9 Aug 2017 13:07:15 +0000 (15:07 +0200)]
capability: add new ambient_capabilities_supported() helper

This new function reports whether ambient caps are available, and should
be quick because the result is cached.

7 years agocapability: change capability_bounding_set_drop() to be work without privileges when...
Lennart Poettering [Wed, 9 Aug 2017 13:05:36 +0000 (15:05 +0200)]
capability: change capability_bounding_set_drop() to be work without privileges when executing a NOP

This way daemons which already dropped all caps may use the call to
drop priviliges again, which becomes a non-failing NOP.

7 years agoseccomp: add new @setuid seccomp group
Lennart Poettering [Wed, 9 Aug 2017 13:04:05 +0000 (15:04 +0200)]
seccomp: add new @setuid seccomp group

This new group lists all UID/GID credential changing syscalls (which are
quite a number these days). This will become particularly useful in a
later commit, which uses this group to optionally permit user credential
changing to daemons in case ambient capabilities are not available.

7 years agomkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself
Lennart Poettering [Wed, 9 Aug 2017 10:46:09 +0000 (12:46 +0200)]
mkdir: chmod_and_chown() returns errors as "return -errno", not in errno itself

7 years agoexecute: needs_{selinux,apparmor,smack} → use_{selinux,apparmor,smack}
Lennart Poettering [Tue, 8 Aug 2017 17:49:04 +0000 (19:49 +0200)]
execute: needs_{selinux,apparmor,smack} → use_{selinux,apparmor,smack}

These booleans simply store whether selinux/apparmor/smack are supposed
ot be used, and chache the various mac_xyz_use() calls before we
transition into the namespace, hence let's use the same verb for the
variables and the functions: "use"

7 years agoexecute: make use of IN_SET() where we can
Lennart Poettering [Tue, 1 Aug 2017 09:52:36 +0000 (11:52 +0200)]
execute: make use of IN_SET() where we can

7 years agoexecute: simplify needs_sandboxing checking
Lennart Poettering [Tue, 1 Aug 2017 09:44:37 +0000 (11:44 +0200)]
execute: simplify needs_sandboxing checking

Let's merge three if blocks that shall only run when sandboxing is applied
into one.

Note that this changes behaviour in one corner case: PrivateUsers=1 is
now honours both PermissionsStartOnly= and the "+" modifier in
ExecStart=, and not just the former, as before. This was an oversight,
so let's fix this now, at a point in time the option isn't used much
yet.

7 years agocore: rename EXEC_APPLY_PERMISSIONS → EXEC_APPLY_SANDBOXING
Lennart Poettering [Tue, 1 Aug 2017 09:30:44 +0000 (11:30 +0200)]
core: rename EXEC_APPLY_PERMISSIONS → EXEC_APPLY_SANDBOXING

"Permissions" was a bit of a misnomer, as it suggests that UNIX file
permission bits are adjusted, which aren't really changed here. Instead,
this is about UNIX credentials such as users or groups, as well as
namespacing, hence let's use a more generic term here, without any
misleading reference to UNIX file permissions: "sandboxing", which shall
refer to all kinds of sandboxing technologies, including UID/GID
dropping, selinux relabelling, namespacing, seccomp, and so on.

7 years agocore: introduce unit_set_exec_params()
Lennart Poettering [Tue, 1 Aug 2017 09:02:30 +0000 (11:02 +0200)]
core: introduce unit_set_exec_params()

The new unit_set_exec_params() call is to units what
manager_set_exec_params() is to the manager object: it initializes the
various fields from the relevant generic properties set.

7 years agocore: manager_set_exec_params() cannot fail, hence make it void
Lennart Poettering [Tue, 1 Aug 2017 08:53:46 +0000 (10:53 +0200)]
core: manager_set_exec_params() cannot fail, hence make it void

Let's simplify things a bit.

7 years agoexecute: also fold the cgroup delegate bit into ExecFlags
Lennart Poettering [Tue, 1 Aug 2017 08:51:18 +0000 (10:51 +0200)]
execute: also fold the cgroup delegate bit into ExecFlags

7 years agoexecute: also control the SYSTEMD_NSS_BYPASS_BUS through an ExecFlags field
Lennart Poettering [Tue, 1 Aug 2017 08:43:04 +0000 (10:43 +0200)]
execute: also control the SYSTEMD_NSS_BYPASS_BUS through an ExecFlags field

Also, correct the logic while we are at it: the variable is only
required for system services, not user services.

7 years agoservice: let's set EXEC_NEW_KEYRING through SET_FLAG()
Lennart Poettering [Tue, 1 Aug 2017 08:37:17 +0000 (10:37 +0200)]
service: let's set EXEC_NEW_KEYRING through SET_FLAG()

Not that it really matters, but it matches how we set the flags in
manager_set_exec_params() too.

7 years agocore: don't chown() the configuration directory
Lennart Poettering [Tue, 1 Aug 2017 08:36:33 +0000 (10:36 +0200)]
core: don't chown() the configuration directory

The configuration directory is commonly not owned by a service, but
remains root-owned, hence don't change the owner automatically for it.

7 years agoexecute: add one more ExecFlags flag, for controlling unconditional directory chowning
Lennart Poettering [Tue, 1 Aug 2017 08:35:10 +0000 (10:35 +0200)]
execute: add one more ExecFlags flag, for controlling unconditional directory chowning

Let's decouple the Manager object from the execution logic a bit more
here too, and simply pass along the fact whether we should
unconditionally chown the runtime/... directories via the ExecFlags
field too.

7 years agoexecute: let's decouple execute.c a bit from the unit logic
Lennart Poettering [Tue, 1 Aug 2017 08:28:20 +0000 (10:28 +0200)]
execute: let's decouple execute.c a bit from the unit logic

Let's try to decouple the execution engine a bit from the Unit/Manager
concept, and hence pass one more flag as part of the ExecParameters flags
field.

7 years agoexecute: replace command flag bools by a flags field
Lennart Poettering [Tue, 1 Aug 2017 08:16:42 +0000 (10:16 +0200)]
execute: replace command flag bools by a flags field

This way, we can extend it later on in an easier way, and can pass it
along nicely.

7 years agoAdd hwdb fix for Lenovo Flex 3 15 inch touchpad resolution (#6558)
Justin Michaud [Thu, 10 Aug 2017 10:24:34 +0000 (06:24 -0400)]
Add hwdb fix for Lenovo Flex 3 15 inch touchpad resolution (#6558)

add hwdb fix for Lenovo Flex 3 1580

7 years agoMerge pull request #6579 from sourcejedi/getty
Lennart Poettering [Thu, 10 Aug 2017 10:05:21 +0000 (12:05 +0200)]
Merge pull request #6579 from sourcejedi/getty

getty nitpicks

7 years agotest: Run qemu/nspawn tests with "set -e"
Martin Pitt [Mon, 7 Aug 2017 19:09:21 +0000 (21:09 +0200)]
test: Run qemu/nspawn tests with "set -e"

This catches errors like "ninja not found", missing programs etc. early,
instead of silently ignoring them and trying to boot a broken VM.

In install_config_files(), allow some distro specific files to be absent
(such as /etc/sysconfig/init).

7 years agotest: Write state and log files into $BUILD_DIR
Martin Pitt [Mon, 7 Aug 2017 15:30:11 +0000 (17:30 +0200)]
test: Write state and log files into $BUILD_DIR

This avoids clobbering the source tree with .testdir/test.log files and
makes the tests work in situations where the source tree is read-only.

7 years agocore: introduce a restart counter (#6495)
Lennart Poettering [Wed, 9 Aug 2017 19:12:55 +0000 (21:12 +0200)]
core: introduce a restart counter (#6495)

This adds a per-service restart counter. Each time an automatic
restart is scheduled (due to Restart=) it is increased by one. Its
current value is exposed over the bus as NRestarts=. It is also logged
(in a structured, recognizable way) on each restart.

Note that this really only counts automatic starts triggered by Restart=
(which it nicely complements). Manual restarts will reset the counter,
as will explicit calls to "systemctl reset-failed". It's supposed to be
a tool for measure the automatic restart feature, and nothing else.

Fixes: #4126

7 years agoMerge pull request #6467 from yuwata/journal-remote-units
Lennart Poettering [Wed, 9 Aug 2017 19:09:13 +0000 (21:09 +0200)]
Merge pull request #6467 from yuwata/journal-remote-units

units: use {State,Logs}Directory= if they are applicable

7 years agounits: console-getty.service: use the default RestartSec
Alan Jenkins [Wed, 9 Aug 2017 17:56:26 +0000 (18:56 +0100)]
units: console-getty.service: use the default RestartSec

> Note that console-getty.service as more uses than just containers. The
> idea is that it may be used as alternative to the whole VC/logind stuff,
> if all you need is a console on /dev/console, even on physical devices.

This means we want to remove RestartSec=0, for serial systems.
See 4bf0432 "units/serial-getty@.service: use the default RestartSec".

7 years agounits: add Conflicts=rescue.service to container-getty@.service
Alan Jenkins [Mon, 7 Aug 2017 18:24:32 +0000 (19:24 +0100)]
units: add Conflicts=rescue.service to container-getty@.service

The traditional runlevel 1 is "single user mode", and shuts down all but
the main console.  In systemd, rescue.target provides runlevel1.target.
But it did not shut down logins on secondary consoles... if systemd was
running in a container.

I don't think we strictly need to change this.  But when you look at both
container-getty@.service and getty@.service, you see that both have
IgnoreOnIsolate, but only the latter has Conflicts=rescue.service.

This also makes rescue.target in a container consistent with
emergency.target.  In the latter case, the gettys were already stopped,
because they have a Requires dependency on sysinit.target.

7 years agounits/console-getty.service: comment reason for ConditionPathExists
Alan Jenkins [Wed, 9 Aug 2017 13:43:41 +0000 (14:43 +0100)]
units/console-getty.service: comment reason for ConditionPathExists

Currently we have 4 getty services.  1 has a BindsTo dependency on a
device unit.  3 have ConditionPathExists, but the reason is different in
every single one.

* Add comment to console-getty@.service (see commit 1b41981d)
* getty@.service is already commented
* container-getty.service is not strictly correct, as I realized while
  trying to compose a comment.  Reported as #6584.

7 years agopam_logind: skip leading /dev/ from PAM_TTY field before passing it on
Lennart Poettering [Wed, 9 Aug 2017 17:04:36 +0000 (19:04 +0200)]
pam_logind: skip leading /dev/ from PAM_TTY field before passing it on

Apparently, PAM documents that the PAM_TTY should come with a /dev
prefix, but we don't expect it so far, except that Wayland ends up
setting it after all, the way the docs suggest. Hence, let's simply drop
the /dev prefix if it is there.

Fixes: #6516

7 years agotree-wide: use path_startswith() rather than startswith() where ever that's appropriate
Lennart Poettering [Wed, 9 Aug 2017 17:03:39 +0000 (19:03 +0200)]
tree-wide: use path_startswith() rather than startswith() where ever that's appropriate

When checking path prefixes we really should use the right APIs, just in
case people add multiple slashes to their paths...

7 years agoutil-lib: add a new skip_dev_prefix() helper
Lennart Poettering [Wed, 9 Aug 2017 17:01:18 +0000 (19:01 +0200)]
util-lib: add a new skip_dev_prefix() helper

This new helper removes a leading /dev if there is one. We have code
doing this all over the place, let's unify this, and correct it while
we are at it, by using path_startswith() rather than startswith() to
drop the prefix.

7 years agotmpfiles: Allow create symlink on directories (#6039)
William Douglas [Wed, 9 Aug 2017 15:53:03 +0000 (08:53 -0700)]
tmpfiles: Allow create symlink on directories (#6039)

Currently if tmpfiles is run with force on symlink creation but there already
exists a directory at that location, the creation will fail. This change
updates the behavior to remove the directory with rm_fr and then attempts to
create the symlink again.

7 years agoMerge pull request #6497 from yuwata/bus-prop
Lennart Poettering [Wed, 9 Aug 2017 15:06:26 +0000 (17:06 +0200)]
Merge pull request #6497 from yuwata/bus-prop

core: add missing properties in bus_exec_context_set_transient_property()

7 years agoman/systemd-getty-generator fix/update
Alan Jenkins [Mon, 7 Aug 2017 17:30:56 +0000 (18:30 +0100)]
man/systemd-getty-generator fix/update

* Containers don't use serial-getty@console.service,
  they use console-getty.service instead, and suppress
  scanning for kernel or virtualizer consoles.

* Nowadays gettys are started on *all* configured kernel consoles.

* except for the line printer console, because that's not a tty.
  (Seriously.  Search CONFIG_LP_CONSOLE).

7 years agotests: when running a manager object in a test, migrate to private cgroup subroot...
Lennart Poettering [Wed, 9 Aug 2017 13:42:49 +0000 (15:42 +0200)]
tests: when running a manager object in a test, migrate to private cgroup subroot first (#6576)

Without this "meson test" will end up running all tests in the same
cgroup root, and they all will try to manage it. Which usually isn't too
bad, except when they end up clearing up each other's cgroups. This race
is hard to trigger but has caused various CI runs to fail spuriously.

With this change we simply move every test that runs a manager object
into their own private cgroup. Note that we don't clean up the cgroup at
the end, we leave that to the cgroup manager around it.

This fixes races that become visible by test runs throwing out errors
like this:

```
exec-systemcallfilter-failing.service: Passing 0 fds to service
exec-systemcallfilter-failing.service: About to execute: /bin/echo 'This should not be seen'
exec-systemcallfilter-failing.service: Forked /bin/echo as 5693
exec-systemcallfilter-failing.service: Changed dead -> start
exec-systemcallfilter-failing.service: Failed to attach to cgroup /exec-systemcallfilter-failing.service: No such file or directory
Received SIGCHLD from PID 5693 ((echo)).
Child 5693 ((echo)) died (code=exited, status=219/CGROUP)
exec-systemcallfilter-failing.service: Child 5693 belongs to exec-systemcallfilter-failing.service
exec-systemcallfilter-failing.service: Main process exited, code=exited, status=219/CGROUP
exec-systemcallfilter-failing.service: Changed start -> failed
exec-systemcallfilter-failing.service: Unit entered failed state.
exec-systemcallfilter-failing.service: Failed with result 'exit-code'.
exec-systemcallfilter-failing.service: cgroup is empty
Assertion 'service->main_exec_status.status == status_expected' failed at ../src/src/test/test-execute.c:71, function check(). Aborting.
```

BTW, I tracked this race down by using perf:

```
        # perf record -e cgroup:cgroup_mkdir,cgroup_rmdir
        …
        # perf script
```

Thanks a lot @iaguis, @alban for helping me how to use perf for this.

Fixes #5895.

7 years agobuild-sys: fix invalid args detected by meson 0.42 (#6561)
userwithuid [Wed, 9 Aug 2017 13:41:44 +0000 (13:41 +0000)]
build-sys: fix invalid args detected by meson 0.42 (#6561)

some run_target() calls were using params from custom_target()

example message:
WARNING: Passed invalid keyword argument "input". This will become a hard error in the future.

New way to call targets:
ninja man/man
ninja man/html
ninja man/update-man-rules

7 years agounits: do not perform m4 if not necessary (#6575)
Yu Watanabe [Wed, 9 Aug 2017 13:13:41 +0000 (22:13 +0900)]
units: do not perform m4 if not necessary (#6575)

7 years agorfkill: fix typo (#6574)
Xiang Fan [Wed, 9 Aug 2017 10:51:53 +0000 (05:51 -0500)]
rfkill: fix typo (#6574)

7 years agoMerge pull request #6568 from sourcejedi/test
Lennart Poettering [Wed, 9 Aug 2017 07:47:33 +0000 (09:47 +0200)]
Merge pull request #6568 from sourcejedi/test

sd-login: test - fix failure when run from non-graphical seat

7 years agoAdd rpm macro %_userpresetdir (#6571)
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2017 07:45:02 +0000 (03:45 -0400)]
Add rpm macro %_userpresetdir (#6571)

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

7 years agodhcp-network: adjust sockaddr length for addresses longer than 8 bytes (#6527)
bengal [Tue, 8 Aug 2017 16:55:31 +0000 (18:55 +0200)]
dhcp-network: adjust sockaddr length for addresses longer than 8 bytes (#6527)

An infiniband hardware address is 20 bytes, but sockaddr_ll.sll_addr is only 8
bytes. Explicitly ensure that sockaddr_union has enough space for infiniband
addresses, even if they run over sockaddr_ll and add a macro to compute the
proper size to pass to kernel.

7 years agosd-login: test - fix failure when run from non-graphical seat
Alan Jenkins [Tue, 8 Aug 2017 15:13:52 +0000 (16:13 +0100)]
sd-login: test - fix failure when run from non-graphical seat

Observed when running from the console of a systemd nspawn container
(see failure below).

The value of r was tested, when r was last set by
sd_session_can_graphical().  This did not correspond to the value expected.

Fix the code, so we compare relevant values now.  Hopefully :).

Test failure
------------

/* Information printed is from the live system */
sd_pid_get_unit(0, …) → "session-13.scope"
sd_pid_get_user_unit(0, …) → "n/a"
sd_pid_get_slice(0, …) → "user-1000.slice"
sd_pid_get_session(0, …) → "13"
sd_pid_get_owner_uid(0, …) → 1000
sd_pid_get_cgroup(0, …) → "/user.slice/user-1000.slice/session-13.scope"
sd_uid_get_display(1000, …) → "13"
sd_uid_get_sessions(1000, …) → [2] "15 13"
sd_uid_get_seats(1000, …) → [1] "seat0"
sd_session_is_active("13") → yes
sd_session_is_remote("13") → no
sd_session_get_state("13") → "active"
sd_session_get_uid("13") → 1000
sd_session_get_type("13") → "tty"
sd_session_get_class("13") → "user"
sd_session_get_display("13") → "n/a"
sd_session_get_remote_user("13") → "n/a"
sd_session_get_remote_host("13") → "n/a"
sd_session_get_seat("13") → "seat0"
sd_session_can_multi_seat("seat0") → no
sd_session_can_tty("seat0") → no
sd_session_can_graphical("seat0") → no
sd_uid_get_state(1000, …) → active
Assertion '!!k == !!r' failed at ../src/libsystemd/sd-login/test-login.c:191, function test_login(). Aborting.

7 years agosd-login: test - fix function name in output
Alan Jenkins [Tue, 8 Aug 2017 14:54:15 +0000 (15:54 +0100)]
sd-login: test - fix function name in output

7 years agotreewide: fix typos (#6566)
Torstein Husebø [Tue, 8 Aug 2017 14:05:29 +0000 (16:05 +0200)]
treewide: fix typos (#6566)