platform/upstream/systemd.git
8 years agosd-resolve: use close_many() (#3643)
0xAX [Sat, 2 Jul 2016 15:17:26 +0000 (18:17 +0300)]
sd-resolve: use close_many() (#3643)

8 years agoupdate TODO
Lennart Poettering [Sat, 2 Jul 2016 01:39:26 +0000 (18:39 -0700)]
update TODO

8 years agomanager: Fixing a debug printf formatting mistake (#3640)
Kyle Walker [Fri, 1 Jul 2016 17:03:35 +0000 (13:03 -0400)]
manager: Fixing a debug printf formatting mistake (#3640)

A 'llu' formatting statement was used in a debugging printf statement
instead of a 'PRIu64'. Correcting that mistake here.

8 years agoMerge pull request #3634 from disneyworldguy/v2sigchld
Lennart Poettering [Thu, 30 Jun 2016 22:57:39 +0000 (15:57 -0700)]
Merge pull request #3634 from disneyworldguy/v2sigchld

manager: Only invoke a single sigchld per unit within a cleanup cycle

8 years agoFix #3236 (#3633)
Lennart Poettering [Thu, 30 Jun 2016 22:56:23 +0000 (15:56 -0700)]
Fix #3236 (#3633)

* networkd: condition_test() can return a negative error, handle that

If a condition check fails with an error we should not consider the check
successful. Fix that.

We should probably also improve logging in this case, but for now, let's just
unbreak this breakage.

Fixes: #3236

* condition: handle unrecognized architectures nicer

When we encounter a check for an architecture we don't know we should not
let the condition check fail with an error code, but instead simply return
false. After all the architecture might just be newer than the ones we know, in
which case it's certainly not our local one.

Fixes: #3236

8 years agoMerge pull request #3596 from poettering/machine-clean
Martin Pitt [Thu, 30 Jun 2016 19:30:35 +0000 (21:30 +0200)]
Merge pull request #3596 from poettering/machine-clean

make "machinectl clean" asynchronous, and open it up via PolicyKit

8 years agoman: minor typo "has already has happened" (#3635)
Lukas Lösche [Thu, 30 Jun 2016 19:25:51 +0000 (21:25 +0200)]
man: minor typo "has already has happened" (#3635)

8 years agosd-event: expose the event loop iteration counter via sd_event_get_iteration() (...
Lennart Poettering [Thu, 30 Jun 2016 19:25:07 +0000 (12:25 -0700)]
sd-event: expose the event loop iteration counter via sd_event_get_iteration() (#3631)

This extends the existing event loop iteration counter to 64bit, and exposes it
via a new function sd_event_get_iteration(). This is helpful for cases like
issue #3612. After all, since we maintain the counter anyway, we might as well
expose it.

(This also fixes an unrelated issue in the man page for sd_event_wait() where
micro and milliseconds got mixed up)

8 years agomanager: Only invoke a single sigchld per unit within a cleanup cycle
Kyle Walker [Thu, 30 Jun 2016 19:12:18 +0000 (15:12 -0400)]
manager: Only invoke a single sigchld per unit within a cleanup cycle

By default, each iteration of manager_dispatch_sigchld() results in a unit level
sigchld event being invoked. For scope units, this results in a scope_sigchld_event()
which can seemingly stall for workloads that have a large number of PIDs within the
scope. The stall exhibits itself as a SIG_0 being initiated for each u->pids entry
as a result of pid_is_unwaited().

v2:
This patch resolves this condition by only paying to cost of a sigchld in the underlying
scope unit once per sigchld iteration. A new "sigchldgen" member resides within the
Unit struct. The Manager is incremented via the sd event loop, accessed via
sd_event_get_iteration, and the Unit member is set to the same value as the manager each
time that a sigchld event is invoked. If the Manager iteration value and Unit member
match, the sigchld event is not invoked for that iteration.

8 years agoMerge pull request #3608 from teg/sd-device-driver-id
Lennart Poettering [Thu, 30 Jun 2016 16:47:52 +0000 (09:47 -0700)]
Merge pull request #3608 from teg/sd-device-driver-id

sd-device: handle the 'drivers' pseudo-subsystem correctly

8 years agojournalctl: Make temporary files directory configurable (#3574)
ottopotto [Thu, 30 Jun 2016 14:59:06 +0000 (17:59 +0300)]
journalctl: Make temporary files directory configurable (#3574)

journalctl: Use env variable TMPDIR to save temporary files

8 years agosd-event: expose the event loop iteration counter via sd_event_get_iteration()
Lennart Poettering [Thu, 30 Jun 2016 02:03:26 +0000 (19:03 -0700)]
sd-event: expose the event loop iteration counter via sd_event_get_iteration()

This extends the existing event loop iteration counter to 64bit, and exposes it
via a new function sd_event_get_iteration(). This is helpful for cases like
issue #3612. After all, since we maintain the counter anyway, we might as well
expose it.

(This also fixes an unrelated issue in the man page for sd_event_wait() where
micro and milliseconds got mixed up)

8 years agotest: check resolved generated resolv.conf in networkd-test (#3628)
Martin Pitt [Thu, 30 Jun 2016 13:44:22 +0000 (15:44 +0200)]
test: check resolved generated resolv.conf in networkd-test (#3628)

* test: check resolved generated resolv.conf in networkd-test

Directly verify the contents of /run/systemd/resolve/resolv.conf instead of
/etc/resolv.conf. The latter might be a plain file or a symlink to something
else (like Debian's resolvconf output), and in these cases we cannot make
strong assumptions about the contents.

Drop the "/etc/resolv.conf is a symlink" conditions and the "resolv.conf can
have at most three nameservers" alternatives, as we know that resolved always
adds all nameservers.

Explicitly start resolved at the start of a test to ensure that it is running.

* test: get along with existing system search domains in resolv.conf

The previous change has uncovered a bug in the tests: Existing search domains
can exist in resolv.conf which test_search_domains{,_too_long} didn't take into account.

As existing domains take some of the "max 6 domains" and "max 255 chars" limit,
don't expect that the last items from our test data actually appears in the
output, just the first few.

8 years agoMerge pull request #3516 from fsateler/shared-basic
Lennart Poettering [Wed, 29 Jun 2016 20:38:50 +0000 (22:38 +0200)]
Merge pull request #3516 from fsateler/shared-basic

build-sys: Convert libshared into a private shared library

8 years agoMerge pull request #3622 from keszybz/journalctl-this-boot
Lennart Poettering [Wed, 29 Jun 2016 20:25:08 +0000 (22:25 +0200)]
Merge pull request #3622 from keszybz/journalctl-this-boot

Make `journalctl --directory=... --boot 0` work

8 years agosd-bus: Fix a read after free error in bus-match. (#3624) (#3625)
Weng Xuetian [Wed, 29 Jun 2016 20:22:12 +0000 (13:22 -0700)]
sd-bus: Fix a read after free error in bus-match. (#3624) (#3625)

The loop on bus_match_run should break and return immediately if
bus->match_callbacks_modified is true. Otherwise the loop may access
free'd data.

8 years agosystemctl mask of an non-existent unit should print a warning (#3521)
Susant Sahani [Tue, 28 Jun 2016 20:27:07 +0000 (01:57 +0530)]
systemctl mask of an non-existent unit should print a warning (#3521)

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

8 years agojournalct: allow --boot=0 to DTRT with --file/--directory
Zbigniew Jędrzejewski-Szmek [Tue, 28 Jun 2016 20:12:47 +0000 (16:12 -0400)]
journalct: allow --boot=0 to DTRT with --file/--directory

--boot=0 magically meant "this boot", but when used with --file/--directory it
should simply refer to the last boot found in the specified journal. This way,
--boot and --list-boots are consistent.

Fixes #3603.

8 years agojournalctl: use simpler variable names in get_boots()
Zbigniew Jędrzejewski-Szmek [Tue, 28 Jun 2016 19:49:03 +0000 (15:49 -0400)]
journalctl: use simpler variable names in get_boots()

Those are just local variables and ref_boot_offset is especially
obnoxious.

8 years agojournalct: do no allow --this-boot to take arguments
Zbigniew Jędrzejewski-Szmek [Tue, 28 Jun 2016 19:39:56 +0000 (15:39 -0400)]
journalct: do no allow --this-boot to take arguments

Before --this-boot was deprecated in a331b5e6d47243, it did not take
any arguments.

8 years agojournalctl: allow --file/--directory with --boot or --list-boots
Zbigniew Jędrzejewski-Szmek [Tue, 28 Jun 2016 19:27:07 +0000 (15:27 -0400)]
journalctl: allow --file/--directory with --boot or --list-boots

It works mostly fine, and can be quite useful to examine data from another
system.

OTOH, a single boot id doesn't make sense with --merge, so mixing with --merge
is still not allowed.

8 years agoRemove blank line in the output of “systemctl show” (#3614)
Lénaïc Huard [Tue, 28 Jun 2016 18:15:33 +0000 (20:15 +0200)]
Remove blank line in the output of “systemctl show” (#3614)

“systemctl show” added an extra blank line after the dump of the
EnvironmentFile property of the unit.

8 years agoman: clarify NotifyAccess overriding (#3620)
Luca Bruno [Tue, 28 Jun 2016 18:14:08 +0000 (20:14 +0200)]
man: clarify NotifyAccess overriding (#3620)

Type=notify has a magic overriding case where a NotifyAccess=none
is turned into a NotifyAccess=main for sanity purposes.
This makes docs more clear about such behavior:
https://github.com/systemd/systemd/blob/2787d83c28b7565ea6f80737170514e5e6186917/src/core/service.c#L650:L651

8 years agoresolved: add test for route-only domain filtering (#3609)
Martin Pitt [Tue, 28 Jun 2016 16:18:27 +0000 (18:18 +0200)]
resolved: add test for route-only domain filtering (#3609)

With commit 6f7da49d00 route-only domains do not get put into resolv.conf's
"search" list any more. Add a comment about the tri-state, to clarify its
semantics and why we are passing a bool parameter into an int type. Also add a
test case for it.

8 years agoAdded Indonesian translation (#3615)
Andika Triwidada [Tue, 28 Jun 2016 08:14:27 +0000 (15:14 +0700)]
Added Indonesian translation (#3615)

8 years agobasic/strv: introduce STRV_IGNORE macro (#3601)
0xAX [Mon, 27 Jun 2016 21:26:07 +0000 (00:26 +0300)]
basic/strv: introduce STRV_IGNORE macro (#3601)

to hide casting of '-1' strings and make code cleaner.

8 years agobasic: pass flags to the fnmatch (#3606)
Evgeny Vereshchagin [Mon, 27 Jun 2016 12:47:37 +0000 (15:47 +0300)]
basic: pass flags to the fnmatch (#3606)

Fixes:
```
$ systemctl list-unit-files 'hey\*'

0 unit files listed.

$ systemctl list-unit-files | grep hey
hey\x7eho.service                          static
```

8 years agosd-device: new_from_subsystem_sysnam - support a real subsystem called 'drivers'
Tom Gundersen [Mon, 27 Jun 2016 07:58:59 +0000 (09:58 +0200)]
sd-device: new_from_subsystem_sysnam - support a real subsystem called 'drivers'

We support writing out tags and db files in case a real subsystem called
'drivers' exists, so there is no reason to refuse parsing it.

8 years agosd-device: device_id - set correctly for 'drivers'
Tom Gundersen [Sun, 26 Jun 2016 21:05:27 +0000 (23:05 +0200)]
sd-device: device_id - set correctly for 'drivers'

The 'drivers' pseudo-subsystem needs special treatment. These pseudo-devices are
found under /sys/bus/drivers/, so needs the real subsystem encoded
in the device_id in order to be resolved.

The reader side already assumed this to be the case.

8 years agosd-device: enumerator - do not abort enumeration if a device fails
Tom Gundersen [Sun, 26 Jun 2016 20:36:46 +0000 (22:36 +0200)]
sd-device: enumerator - do not abort enumeration if a device fails

Collect the errors and return to the caller, but continue enumerating all devices.

8 years agoMerge pull request #3572 from poettering/machinectl-shell-fix
Martin Pitt [Sun, 26 Jun 2016 15:46:23 +0000 (17:46 +0200)]
Merge pull request #3572 from poettering/machinectl-shell-fix

machinectl: interpret options placed between "shell" verb and machine name

8 years agocatalog: make support URL to show in shipped catalog entries configurable (#3597)
Lennart Poettering [Sun, 26 Jun 2016 15:43:37 +0000 (17:43 +0200)]
catalog: make support URL to show in shipped catalog entries configurable (#3597)

Let's allow distros to change the support URL to expose in catalog entries by
default. It doesn't make sense to direct end-users to the upstream project for
common errors.

This adds a --with-support-url= switch to configure, which allows overriding
the default at build-time.

Fixes: #2516

8 years agomachinectl: verify image existance on "start" and "enable" (#3579)
Lennart Poettering [Sun, 26 Jun 2016 15:41:33 +0000 (17:41 +0200)]
machinectl: verify image existance on "start" and "enable" (#3579)

Let's make sure we catch early when a machine doesn't exist that is attempted
to be started or enabled as system service.

8 years agonetworkd: use strv_fnmatch() (#3605)
0xAX [Sun, 26 Jun 2016 15:37:24 +0000 (18:37 +0300)]
networkd: use strv_fnmatch() (#3605)

8 years agoman: document what Authenticated: in the systemd-resolve output actually means (...
Lennart Poettering [Sun, 26 Jun 2016 15:35:22 +0000 (17:35 +0200)]
man: document what Authenticated: in the systemd-resolve output actually means (#3571)

My educated guess is that #3561 was filed due to confusion around the
systemd-resolve "Data Authenticated:" output.  Let's try to clean up the
confusion a bit, and document what it means in the man page.

8 years agoMerge pull request #3600 from poettering/fstab-generator-fixes
Martin Pitt [Sun, 26 Jun 2016 10:46:17 +0000 (12:46 +0200)]
Merge pull request #3600 from poettering/fstab-generator-fixes

Fstab generator fixes

8 years agobasic/strv: use SWAP_TWO() macro (#3602)
0xAX [Sun, 26 Jun 2016 10:37:00 +0000 (13:37 +0300)]
basic/strv: use SWAP_TWO() macro (#3602)

8 years agonspawn: fix uid patching logic (#3599)
Lennart Poettering [Sat, 25 Jun 2016 04:04:43 +0000 (06:04 +0200)]
nspawn: fix uid patching logic (#3599)

An incorrectly set if/else chain caused aus to apply the access mode of a
symlink to the directory it is located in. Yuck.

Fixes: #3547

8 years agobuild-sys: Add new libsystemd-shared private library
Felipe Sateler [Sat, 25 Jun 2016 02:14:25 +0000 (22:14 -0400)]
build-sys: Add new libsystemd-shared private library

Link as many binaries as possible with it, to save storage space.

Preserve the static libshared and libbasic for use in libraries, nss
modules and udev.

Libraries need to be static in order to avoid polluting the symbol
namespace.

Udev needs to be static so downstream can avoid strict version dependencies
with the systemd package, and this can complicate upgrade scenarios.

8 years agobuild-sys: do not recompile everything for libsystemd
Felipe Sateler [Sat, 25 Jun 2016 02:10:37 +0000 (22:10 -0400)]
build-sys: do not recompile everything for libsystemd

8 years agofstab-generator: minor simplification
Lennart Poettering [Fri, 24 Jun 2016 19:22:05 +0000 (21:22 +0200)]
fstab-generator: minor simplification

8 years agofstab-generator: skip fsck for /usr on non-device file systems
Lennart Poettering [Fri, 24 Jun 2016 19:07:18 +0000 (21:07 +0200)]
fstab-generator: skip fsck for /usr on non-device file systems

We do the same already for the root device, hence follow the scheme for /usr
too.

(Also add some explanatory comments.)

8 years agofstab-generator: don't skip /usr handling if root handling didn't work correctly
Lennart Poettering [Fri, 24 Jun 2016 19:04:48 +0000 (21:04 +0200)]
fstab-generator: don't skip /usr handling if root handling didn't work correctly

Let's follow the same logic for all mounts here: log errors, and exit the
process uncleanly ultimately, but do not skip further mounts if we encounter a
problem with an earlier one.

Fixes: #2344

8 years agosystemctl: fix an error condition from "-1" to something meaningful
Lennart Poettering [Fri, 24 Jun 2016 19:03:47 +0000 (21:03 +0200)]
systemctl: fix an error condition from "-1" to something meaningful

We really shouldn't make up errors like "-1", but use proper errno definitions.

8 years agofstab-generator: fix checking of fstab_node_to_udev_node() result
Lennart Poettering [Fri, 24 Jun 2016 19:01:22 +0000 (21:01 +0200)]
fstab-generator: fix checking of fstab_node_to_udev_node() result

We have to check for OOM here, let's add that. There's really no point in
checking for path_is_absolute() on the result however, as there's no particular
reason why that should be refused. Also, we don't have similar checks for the
other mount devices the generator deals with, hence don't bother with it here
either. Let's remove that check.

(And it shouldn't return made-up errors like "-1" in this case anyway.)

8 years agofstab-generator: document why we copy the root device into the usr device if unset
Lennart Poettering [Fri, 24 Jun 2016 19:00:11 +0000 (21:00 +0200)]
fstab-generator: document why we copy the root device into the usr device if unset

Let's a comment about this, to avoid questions popping up like in #2344.

8 years agofstab-generator: let's use path_equal() for comparing paths
Lennart Poettering [Fri, 24 Jun 2016 18:59:51 +0000 (20:59 +0200)]
fstab-generator: let's use path_equal() for comparing paths

8 years agoMerge pull request #3587 from martinpitt/master
Evgeny Vereshchagin [Fri, 24 Jun 2016 16:44:18 +0000 (19:44 +0300)]
Merge pull request #3587 from martinpitt/master

Fix some test issues

8 years agotest: merge check_nspawn() into run_nspawn()
Martin Pitt [Fri, 24 Jun 2016 14:23:39 +0000 (16:23 +0200)]
test: merge check_nspawn() into run_nspawn()

This makes nspawn tests symmetric with run_qemu() which also exits with 1 if
QEMU is not available.

8 years agopid1: restore console color support for containers (#3595)
Franck Bui [Fri, 24 Jun 2016 14:08:43 +0000 (16:08 +0200)]
pid1: restore console color support for containers (#3595)

Commit 3a18b60489504056f9b0b1a139439cbfa60a87e1 introduced a regression that
disabled the color mode for container.

This patch fixes this.

8 years agotests: track and check for timeouts
Martin Pitt [Fri, 24 Jun 2016 10:11:19 +0000 (12:11 +0200)]
tests: track and check for timeouts

If run_qemu() exits with non-zero, this either meant that QEMU was not
available (which should be a SKIP) or that QEMU timed out if $QEMU_TIMEOUT was
set (which then should be a FAIL).

Limit the exit code of run_qemu() to QEMU availability only, and track timeouts
separately through the new $TIMED_OUT variable, which is then checked in
check_result_qemu().

Do the same for $NSPAWN_TIMEOUT and run_nspawn() so that nspawn and QEMU work
similarly.

8 years agomachined: make sure CleanPool() method is opened up in the dbus policy
Lennart Poettering [Fri, 24 Jun 2016 14:03:49 +0000 (16:03 +0200)]
machined: make sure CleanPool() method is opened up in the dbus policy

The method is already hooked up to PolicyKit, hence let's open this up via the
bus policy language too.

Fixes: #3585

8 years agomachined: "machinectl clean" can take a while, do it asynchronously from a background...
Lennart Poettering [Fri, 24 Jun 2016 14:01:14 +0000 (16:01 +0200)]
machined: "machinectl clean" can take a while, do it asynchronously from a background process

This is a follow-up to 5d2036b5f3506bd0ff07042aee8d69c26db32298, and also makes
the "machinectl clean" verb asynchronous, after all it's little more than a
series of image removals.

The changes required to make this happen are a bit more comprehensive as we
need to pass information about deleted images back to the client, as well as
information about the image we failed on if we failed on one. Hence, create a
temporary file in /tmp, serialize that data into, and read it from the parent
after the operation is complete.

8 years agomachined: don't bother explicitly closing the errno pipe
Lennart Poettering [Fri, 24 Jun 2016 13:59:42 +0000 (15:59 +0200)]
machined: don't bother explicitly closing the errno pipe

There's no point in explicitly closing the errno pipe, if we exit right after
anyway. It doesn't hurt doing this either, but let's do this the same way for
all cases where we use the "Operation" object right now, and in all other cases
we do not close the pipe explicitly, hence don't do so here either.

8 years agocgroup: minor coding style fix
Lennart Poettering [Fri, 24 Jun 2016 13:59:24 +0000 (15:59 +0200)]
cgroup: minor coding style fix

8 years agotests: make TEST-12-ISSUE-3171 nspawn invocation consistent with other tests
Martin Pitt [Fri, 24 Jun 2016 10:07:18 +0000 (12:07 +0200)]
tests: make TEST-12-ISSUE-3171 nspawn invocation consistent with other tests

The result of check_nspawn does not mean much, and this forgot to ask
check_nspawn() whether nspawn can be used at all. This brings
TEST-12-ISSUE-3171 in line with other nspawn tests.

8 years agoupdate
Lennart Poettering [Fri, 24 Jun 2016 09:45:06 +0000 (11:45 +0200)]
update

8 years agotests: don't fail if QEMU is not available
Martin Pitt [Thu, 23 Jun 2016 08:23:29 +0000 (10:23 +0200)]
tests: don't fail if QEMU is not available

Fix TEST-{08,09,10,11} to properly skip the test if QEMU is not available
instead of failing, like in the other tests.

8 years agotests: force booting the kernel with SELinux
Martin Pitt [Thu, 23 Jun 2016 08:25:44 +0000 (10:25 +0200)]
tests: force booting the kernel with SELinux

selinux=1 is not sufficient when running on a kernel which also has another LSM
(such as AppArmor) enabled and defaults to that.

8 years agoMerge pull request #3594 from poettering/resolved-servfail
Martin Pitt [Fri, 24 Jun 2016 06:01:49 +0000 (08:01 +0200)]
Merge pull request #3594 from poettering/resolved-servfail

resolved fixes for handling SERVFAIL errors from servers

8 years agosystemctl: Create new unit files with "edit --force" (#3584)
Doug Christman [Fri, 24 Jun 2016 06:00:35 +0000 (02:00 -0400)]
systemctl:  Create new unit files with "edit --force" (#3584)

8 years agoresolved: add option to disable caching (#3592)
Martin Pitt [Fri, 24 Jun 2016 05:54:28 +0000 (07:54 +0200)]
resolved: add option to disable caching (#3592)

In some cases, caching DNS results locally is not desirable, a it makes DNS
cache poisoning attacks a tad easier and also allows users on the system to
determine whether or not a particular domain got visited by another user. Thus
provide a new "Cache" resolved.conf option to disable it.

8 years agoMerge pull request #3549 from poettering/resolved-more
Tom Gundersen [Thu, 23 Jun 2016 23:26:25 +0000 (01:26 +0200)]
Merge pull request #3549 from poettering/resolved-more

resolved: more fixes, among them "systemctl-resolve --status" to see DNS configuration in effect, and a local DNS stub listener on 127.0.0.53

8 years agoresolved: when processing auxiliary DNSSEC transactions, accept those with SERVFAIL
Lennart Poettering [Thu, 23 Jun 2016 21:46:56 +0000 (23:46 +0200)]
resolved: when processing auxiliary DNSSEC transactions, accept those with SERVFAIL

Some upstream DNS servers return SERVFAIL if we ask them for DNSSEC RRs, which
some forwarding DNS servers pass on to us as SERVFAIL (other though as
NOERROR...). This is should not be considered a problem, as long as the domain
in question didn't have DNSSEC enabled. Hence: when making use of auxiliary
transactions accept those that return SERVFAIL.

8 years agoresolved: when caching replies, check rcode earlier
Lennart Poettering [Thu, 23 Jun 2016 21:36:10 +0000 (23:36 +0200)]
resolved: when caching replies, check rcode earlier

This way we don't log complaints about packets without SOA in case we are not
caching it anyway because the rcode is not SUCCESS or NXDOMAIN...

8 years agoresolved: rework SERVFAIL handling
Lennart Poettering [Thu, 23 Jun 2016 21:24:38 +0000 (23:24 +0200)]
resolved: rework SERVFAIL handling

There might be two reasons why we get a SERVFAIL response from our selected DNS
server: because this DNS server itself is bad, or because the DNS server
actually serving the zone upstream is bad. So far we immediately downgraded our
server feature level when getting SERVFAIL, under the assumption that the first
case is the only possible case. However, this meant we'd downgrade immediately
even if we encountered the second case described above.

With this commit handling of SERVFAIL is reworked. As soon as we get a SERVFAIL
on a transaction we retry the transaction with a lower feature level, without
changing the feature level tracked for the DNS server itself. If that fails
too, we downgrade further, and so on. If during this downgrading the SERVFAIL
goes away we assume that the DNS server we are talking to is bad, but the zone
is fine and propagate the detected feature level to the information we track
about the DNS server. Should the SERVFAIL not go away this way we let the
transaction fail and accept the SERVFAIL.

8 years agoudev: bump TasksMax to inifinity (#3593)
Franck Bui [Thu, 23 Jun 2016 20:31:01 +0000 (22:31 +0200)]
udev: bump TasksMax to inifinity (#3593)

udevd already limits its number of workers/children: the max number is actually
twice the number of CPUs the system is using.

(The limit can also be raised with udev.children-max= kernel command line
option BTW).

On some servers, this limit can easily exceed the maximum number of tasks that
systemd put on all services, which is 512 by default.

Since udevd has already its limitation logic, simply disable the static
limitation done by TasksMax.

8 years agofstab-generator: ignore root=/dev/nfs (#3591)
Harald Hoyer [Thu, 23 Jun 2016 16:47:03 +0000 (17:47 +0100)]
fstab-generator: ignore root=/dev/nfs (#3591)

root=/dev/nfs is a legacy option for the kernel to handle root on NFS.

Documentation for this kernel command line option
can be found in the kernel source tree:

Documentation/filesystems/nfs/nfsroot.txt

8 years agoMerge pull request #3583 from poettering/restrict-realtime
Ronny Chevalier [Thu, 23 Jun 2016 12:11:58 +0000 (13:11 +0100)]
Merge pull request #3583 from poettering/restrict-realtime

add new RestrictRealtime= option to services (and other fixes)

8 years agoMerge pull request #3581 from dobyrch/master
Ronny Chevalier [Thu, 23 Jun 2016 09:15:40 +0000 (10:15 +0100)]
Merge pull request #3581 from dobyrch/master

systemctl:  Add missing "/" to files created by 'edit --runtime'

8 years agobuild-sys: move fdset.[ch] src/basic → src/shared (#3580)
Lennart Poettering [Thu, 23 Jun 2016 02:10:53 +0000 (04:10 +0200)]
build-sys: move fdset.[ch] src/basic → src/shared (#3580)

It makes use of the sd_listen_fds() call, and as such should live in
src/shared, as the distinction between src/basic and src/shared is that the
latter may use libsystemd APIs, the former does not.

Note that btrfs-util.[ch] and log.[ch] also include header files from
libsystemd, but they only need definitions, they do not invoke any function
from it. Hence they may stay in src/basic.

8 years agoexecute: add a new easy-to-use RestrictRealtime= option to units
Lennart Poettering [Wed, 22 Jun 2016 23:45:45 +0000 (01:45 +0200)]
execute: add a new easy-to-use RestrictRealtime= option to units

It takes a boolean value. If true, access to SCHED_RR, SCHED_FIFO and
SCHED_DEADLINE is blocked, which my be used to lock up the system.

8 years agoexecute: be a little less drastic when MemoryDenyWriteExecute= hits
Lennart Poettering [Wed, 22 Jun 2016 23:35:04 +0000 (01:35 +0200)]
execute: be a little less drastic when MemoryDenyWriteExecute= hits

Let's politely refuse with EPERM rather than kill the whole thing right-away.

8 years agoexecute: set PR_SET_NO_NEW_PRIVS also in case the exec memory protection is used
Lennart Poettering [Wed, 22 Jun 2016 23:33:07 +0000 (01:33 +0200)]
execute: set PR_SET_NO_NEW_PRIVS also in case the exec memory protection is used

This was forgotten when MemoryDenyWriteExecute= was added: we should set NNP in
all cases when we set seccomp filters.

8 years agoexecute: use the return value of setrlimit_closest() properly
Lennart Poettering [Wed, 22 Jun 2016 23:31:24 +0000 (01:31 +0200)]
execute: use the return value of setrlimit_closest() properly

It's a function defined by us, hence we should look for the error in its return
value, not in "errno".

8 years agocore: when writing transient unit files, make sure all lines end with a newline
Lennart Poettering [Wed, 22 Jun 2016 23:29:33 +0000 (01:29 +0200)]
core: when writing transient unit files, make sure all lines end with a newline

This is a fix-up for 2a9a6f8ac04a69ca36d645f9305a33645f22a22b which covered
non-transient units, but missed the case for transient units.

8 years agonspawn: improve man page (#3577)
Lennart Poettering [Wed, 22 Jun 2016 21:30:36 +0000 (23:30 +0200)]
nspawn: improve man page (#3577)

This change documents the existance of the systemd-nspawn@.service template
unit file, which was previously not mentioned at all. Since the unit file uses
slightly different default than nspawn invoked from the command line, these
defaults are now explicitly documented too.

A couple of further additions and changes are made, too.

Replaces: #3497

8 years agoman: document that %f in units always unescapes (#3578)
Lennart Poettering [Wed, 22 Jun 2016 21:28:12 +0000 (23:28 +0200)]
man: document that %f in units always unescapes (#3578)

8 years agosystemctl: Add missing "/" to files created by 'edit --runtime'
Douglas Christman [Wed, 22 Jun 2016 19:09:33 +0000 (15:09 -0400)]
systemctl:  Add missing "/" to files created by 'edit --runtime'

8 years agomachinectl: do not escape the unit name (#3554)
Elias Probst [Wed, 22 Jun 2016 15:10:52 +0000 (17:10 +0200)]
machinectl: do not escape the unit name (#3554)

Otherwise starting a machine named `foo-bar-baz` will end up in
machinectl attempting to start the service unit
`systemd-nspawn@foo\x2dbar\x2dbaz` instead of
`systemd-nspawn@foo-bar-baz`.

8 years agowatchdog: Support changing watchdog_usec during runtime (#3492)
Minkyung [Wed, 22 Jun 2016 11:26:05 +0000 (20:26 +0900)]
watchdog: Support changing watchdog_usec during runtime (#3492)

Add sd_notify() parameter to change watchdog_usec during runtime.

Application can change watchdog_usec value by
sd_notify like this. Example. sd_notify(0, "WATCHDOG_USEC=20000000").

To reset watchdog_usec as configured value in service file,
restart service.

Notice.
sd_event is not currently supported. If application uses
sd_event_set_watchdog, or sd_watchdog_enabled, do not use
"WATCHDOG_USEC" option through sd_notify.

8 years agoNEWS: start section for 231, with tmpfs.mount option changes (#3576)
Martin Pitt [Wed, 22 Jun 2016 11:22:47 +0000 (13:22 +0200)]
NEWS: start section for 231, with tmpfs.mount option changes (#3576)

This documents the "add nosuid and nodev options to tmp.mount" change from
commit 2f9df7c96a2.

8 years agoMerge pull request #3526 from fbuihuu/fix-console-log-color
Lennart Poettering [Wed, 22 Jun 2016 10:34:25 +0000 (12:34 +0200)]
Merge pull request #3526 from fbuihuu/fix-console-log-color

Fix console log color

8 years agounits: add nosuid and nodev options to tmp.mount (#3575)
Martin Pitt [Wed, 22 Jun 2016 10:32:59 +0000 (12:32 +0200)]
units: add nosuid and nodev options to tmp.mount (#3575)

This makes privilege escalation attacks harder by putting traps and exploits
into /tmp.

https://bugs.debian.org/826377

8 years agopid1: initialize status color mode after setting up TERM
Franck Bui [Mon, 20 Jun 2016 19:45:28 +0000 (21:45 +0200)]
pid1: initialize status color mode after setting up TERM

Also we had to connect PID's stdio to null later since colors_enabled()
assume that stdout is connected to the console.

8 years agopid1: initialize TERM environment variable correctly
Franck Bui [Mon, 20 Jun 2016 16:54:21 +0000 (18:54 +0200)]
pid1: initialize TERM environment variable correctly

When systemd is started by the kernel, the kernel set the TERM
environment variable unconditionnally to "linux" no matter the console
device used. This might be an issue for dumb devices with no colors
support.

This patch uses default_term_for_tty() for getting a more accurate
value. But it makes sure to keep the user preferences (if any) which
might be passed via the kernel command line. For that purpose /proc
should be mounted.

8 years agounits: machined needs mount-related syscalls for its namespacing operations
Lennart Poettering [Tue, 21 Jun 2016 19:32:17 +0000 (21:32 +0200)]
units: machined needs mount-related syscalls for its namespacing operations

Specifically "machinectl shell" (or its OpenShell() bus call) is implemented by
entering the file system namespace of the container  and opening a TTY there.
In order to enter the file system namespace, chroot() is required, which is
filtered by SystemCallFilter='s @mount group. Hence, let's make this work again
and drop @mount from the filter list.

8 years agomachinectl: interpret options placed between "shell" verb and machine name
Lennart Poettering [Tue, 21 Jun 2016 19:30:20 +0000 (21:30 +0200)]
machinectl: interpret options placed between "shell" verb and machine name

Previously, we'd stop processing of the argument list immediately when hitting
the "shell" verb. However, we really should continue processing options then,
until we hit the machine name.

Fixes: #3472

8 years agoman: document some sd-bus functions (#3567)
mahkoh [Tue, 21 Jun 2016 15:52:32 +0000 (17:52 +0200)]
man: document some sd-bus functions (#3567)

* sd_bus_add_match
* sd_bus_get_fd
* sd_bus_message_read_basic
* sd_bus_process

8 years agoDo not ellipsize cgroups when showing slices in --full mode (#3560)
Ian Lee [Tue, 21 Jun 2016 14:10:31 +0000 (15:10 +0100)]
Do not ellipsize cgroups when showing slices in --full mode (#3560)

Do not ellipsize cgroups when showing slices in --full mode

8 years agoemergency.service: Don't say "Welcome" when it's an emergency (#3569)
Lennart Poettering [Tue, 21 Jun 2016 14:09:47 +0000 (16:09 +0200)]
emergency.service: Don't say "Welcome" when it's an emergency (#3569)

Quoting @cgwalters:

        Just uploading this as an RFC.  Now I know reading the code that systemd says
        `Welcome to $OS` as a generic thing, but my initial impression on seeing this
        was that it was almost sarcastic =)

        Let's say "You are in emergency mode" as a more neutral/less excited phrase.

This patch is based on #3556, but makes the same change for rescue mode.

8 years agotmpfiles: make sure to always initialize "r" correctly.
Lennart Poettering [Tue, 21 Jun 2016 11:20:23 +0000 (13:20 +0200)]
tmpfiles: make sure to always initialize "r" correctly.

8 years agotree-wide: some work-arounds for gcc false positives regarding uninitialized variables
Lennart Poettering [Tue, 21 Jun 2016 11:20:02 +0000 (13:20 +0200)]
tree-wide: some work-arounds for gcc false positives regarding uninitialized variables

8 years agoman: beef up resolved man page
Lennart Poettering [Tue, 21 Jun 2016 11:19:21 +0000 (13:19 +0200)]
man: beef up resolved man page

Let's explain the various APIs and various ways to handle /etc/resolv.conf.

8 years agoresolved: respond to local resolver requests on 127.0.0.53:53
Lennart Poettering [Mon, 20 Jun 2016 22:58:47 +0000 (00:58 +0200)]
resolved: respond to local resolver requests on 127.0.0.53:53

In order to improve compatibility with local clients that speak DNS directly
(and do not use NSS or our bus API) listen locally on 127.0.0.53:53 and process
any queries made that way.

Note that resolved does not implement a full DNS server on this port, but
simply enough to allow normal, local clients to resolve RRs through resolved.
Specifically it does not implement queries without the RD bit set (these are
requests where recursive lookups are explicitly disabled), and neither queries
with DNSSEC DO set in combination with DNSSEC CD (i.e. DNSSEC lookups with
validation turned off). It also refuses zone transfers and obsolete RR types.
All lookups done this way will be rejected with a clean error code, so that the
client side can repeat the query with a reduced feature set.

The code will set the DNSSEC AD flag however, depending on whether the data
resolved has been validated (or comes from a local, trusted source).

Lookups made via this mechanisms are propagated to LLMNR and mDNS as necessary,
but this is only partially useful as DNS packets cannot carry IP scope data
(i.e. the ifindex), and hence link-local addresses returned cannot be used
properly (and given that LLMNR/mDNS are mostly about link-local communication
this is quite a limitation). Also, given that DNS tends to use IDNA for
non-ASCII names, while LLMNR/mDNS uses UTF-8 lookups cannot be mapped 1:1.

In general this should improve compatibility with clients bypassing NSS but
it is highly recommended for clients to instead use NSS or our native bus API.

This patch also beefs up the DnsStream logic, as it reuses the code for local
TCP listening. DnsStream now provides proper reference counting for its
objects.

In order to avoid feedback loops resolved will no silently ignore 127.0.0.53
specified as DNS server when reading configuration.

resolved listens on 127.0.0.53:53 instead of 127.0.0.1:53 in order to leave
the latter free for local, external DNS servers or forwarders.

This also changes the "etc.conf" tmpfiles snippet to create a symlink from
/etc/resolv.conf to /usr/lib/systemd/resolv.conf by default, thus making this
stub the default mode of operation if /etc is not populated.

8 years agoresolved: use DNS_{QUESTION|ANSWER}_FOREACH macros at two more places
Lennart Poettering [Mon, 20 Jun 2016 19:59:17 +0000 (21:59 +0200)]
resolved: use DNS_{QUESTION|ANSWER}_FOREACH macros at two more places

8 years agoresolved: extend dns_packet_append_opt() so that it can set the extended rcode
Lennart Poettering [Mon, 20 Jun 2016 19:57:57 +0000 (21:57 +0200)]
resolved: extend dns_packet_append_opt() so that it can set the extended rcode

We don't make use of this yet, but later work will.

8 years agoresolved: add dns_packet_add_{question,answer}() helper
Lennart Poettering [Mon, 20 Jun 2016 19:39:02 +0000 (21:39 +0200)]
resolved: add dns_packet_add_{question,answer}() helper

And make use of it at a couple of places.

8 years agoresolved: add dns_answer_is_empty() and dns_question_is_empty() helpers
Lennart Poettering [Mon, 20 Jun 2016 19:28:53 +0000 (21:28 +0200)]
resolved: add dns_answer_is_empty() and dns_question_is_empty() helpers

And make use of them at a few places.

8 years agoresolved: when using the ResolveRecord() bus call, adjust TTL for caching time
Lennart Poettering [Mon, 20 Jun 2016 19:24:46 +0000 (21:24 +0200)]
resolved: when using the ResolveRecord() bus call, adjust TTL for caching time

When we return the full RR wire data, let's make sure the TTL included in it is
adjusted by the time the RR sat in the cache.

As an optimization we do this only for ResolveRecord() and not for
ResolveHostname() and friends, since adjusting the TTL means copying the RR
object, and we don#t want to do that if there's no reason to.
(ResolveHostname() and friends don't return the TTL hence there's no reason to
in that case)