platform/upstream/systemd.git
5 years agologind: at start-up automatically clean up orphaned inhibitors
Lennart Poettering [Tue, 23 Jul 2019 08:33:39 +0000 (10:33 +0200)]
logind: at start-up automatically clean up orphaned inhibitors

5 years agologind: un-export and voidify a few functions
Lennart Poettering [Tue, 23 Jul 2019 08:32:41 +0000 (10:32 +0200)]
logind: un-export and voidify a few functions

Let's minimize scope of functions and make sure that functions that
semantically should never fail can't return errors.

5 years agologind: rework allocation/freeing of inhibitors
Lennart Poettering [Tue, 23 Jul 2019 08:27:19 +0000 (10:27 +0200)]
logind: rework allocation/freeing of inhibitors

Let's follow our modern style (i.e. return proper errors, use structure
initialization and _cleanup_).

Most importantly: remove state file and FIFO removal from
inhibitor_free() and let's move it to inhibitor_stop().

This makes sure that state files/FIFOs are not removed when the we
terminate logind, i.e. that they can survive logind restarts.

Fixes: #11825

5 years agologind: use free_and_replace() where that makes sense
Lennart Poettering [Tue, 23 Jul 2019 08:25:03 +0000 (10:25 +0200)]
logind: use free_and_replace() where that makes sense

5 years agologind: add logging to inhibitor_load()
Lennart Poettering [Tue, 23 Jul 2019 08:23:15 +0000 (10:23 +0200)]
logind: add logging to inhibitor_load()

Also make some parsing errors, fatals and others (that just care fore
'decoration') non-fatal.

The single caller of inhibitor_load() didn't log about any errors, hence
let's do this in our function, similar to how this is done in
session_load() already.

5 years agologind: unify inhibitor signal generation in a single function
Lennart Poettering [Tue, 23 Jul 2019 08:22:24 +0000 (10:22 +0200)]
logind: unify inhibitor signal generation in a single function

5 years agologind: cast to (void) when we ignore a syscall return value that is potentially...
Lennart Poettering [Tue, 23 Jul 2019 08:19:58 +0000 (10:19 +0200)]
logind: cast to (void) when we ignore a syscall return value that is potentially dangerous

5 years agologind: drop redundant session_id_valid() check
Lennart Poettering [Tue, 23 Jul 2019 08:18:40 +0000 (10:18 +0200)]
logind: drop redundant session_id_valid() check

session_new() checks that as first step anyway, no need to do this
beforehand.

5 years agologind: use log_warning_errno() return value where we can
Lennart Poettering [Tue, 23 Jul 2019 08:17:46 +0000 (10:17 +0200)]
logind: use log_warning_errno() return value where we can

Also, change a couple of log error levels to LOG_WARNING, where we
encounter an error but then end up ignoring it.

5 years agologind: don't claim we'd preallocate VTs when we shortcut it
Lennart Poettering [Tue, 23 Jul 2019 08:13:45 +0000 (10:13 +0200)]
logind: don't claim we'd preallocate VTs when we shortcut it

5 years agologind: use gcc empty structure initialization
Lennart Poettering [Tue, 23 Jul 2019 08:13:28 +0000 (10:13 +0200)]
logind: use gcc empty structure initialization

5 years agologind: check return value of inhibitor_start()
Lennart Poettering [Tue, 23 Jul 2019 08:12:43 +0000 (10:12 +0200)]
logind: check return value of inhibitor_start()

5 years agologind: add missing OOM check in client tool
Lennart Poettering [Tue, 23 Jul 2019 08:12:25 +0000 (10:12 +0200)]
logind: add missing OOM check in client tool

5 years agoMerge pull request #13136 from keszybz/readd-ntp-units.d
Lennart Poettering [Tue, 23 Jul 2019 13:49:37 +0000 (15:49 +0200)]
Merge pull request #13136 from keszybz/readd-ntp-units.d

ntp-units.d support

5 years agoMerge pull request #13109 from poettering/revert-kbd-mode
Lennart Poettering [Tue, 23 Jul 2019 12:58:37 +0000 (14:58 +0200)]
Merge pull request #13109 from poettering/revert-kbd-mode

Revert of #12378 ("VT kbd reset check")

5 years agohwdb: add entry for Zowie FK2 mouse (#13139)
Thomas Weißschuh [Tue, 23 Jul 2019 07:02:43 +0000 (09:02 +0200)]
hwdb: add entry for Zowie FK2 mouse (#13139)

5 years agoMerge pull request #13133 from keszybz/pstore-return-value
Lennart Poettering [Mon, 22 Jul 2019 16:29:52 +0000 (18:29 +0200)]
Merge pull request #13133 from keszybz/pstore-return-value

pstore: refuse to run if arguments are specified

5 years agotimesyncd: add Conflicts for ntpd and chronyd
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jul 2019 13:58:08 +0000 (15:58 +0200)]
timesyncd: add Conflicts for ntpd and chronyd

Users might end up with more than one of those service enabled, through
admin mistake, or broken installation scriptlets, or whatever. On my machine,
I had both chronyd and timesyncd happilly running at the same time. If
more than one is enabled, it's better to have just one running. Adding
Conflicts will make the issue more visible in logs too.

5 years agotimesyncd: add ntp-units.d/ entry for timesync
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jul 2019 12:47:51 +0000 (14:47 +0200)]
timesyncd: add ntp-units.d/ entry for timesync

Priority is 80. At least in Fedora, chrony uses 50, and ntpd 60.
timesyncd has lower priority, because if people install those other packages,
it's most likely on purpose. timesyncd is always installed and provides
less functionality.

5 years agotimedated: add back support for ntp-units.d/
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jul 2019 13:06:35 +0000 (15:06 +0200)]
timedated: add back support for ntp-units.d/

We removed support for foreign services (and ntp-units.d/) in b72ddf0f4.
Support for foreign services was added back in 5d280742, but through an
environment variable.

The problem with the env var approach is that it only works as a mechanism
to select one item, and doesn't work nicely as a mechinism to create a list
of items through drop-ins (because the env var can be easily overridden, but not
extended). Having a list of "ntp providers" is important to be able to reliably disable
all of them when that is requested.

Another problem is that nobody ever bothered to care about our new "standard".
ntp-units.d/ is a nice simple format that works and is already supported by
chrony and ntpd and timedatex. If we were to introduce and ask people to follow
a new standard, there should be some good reason for this. The idea with env
vars has lower functionality, requires systemd-specific syntax. We should just
re-adopt the format that we originally introduced and that seems to work for
everyone, and more on to more interesting problems.

5 years agomeson: catch programs which ignore arguments
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jul 2019 08:59:19 +0000 (10:59 +0200)]
meson: catch programs which ignore arguments

Don't try to use <<<. It seems to not work properly with old bash
versions or something.

5 years agoMerge pull request #13131 from yuwata/pstore-follow-ups
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jul 2019 08:53:53 +0000 (10:53 +0200)]
Merge pull request #13131 from yuwata/pstore-follow-ups

pstore: several minor follow-ups

5 years agopstore: refuse to run if arguments are specified
Zbigniew Jędrzejewski-Szmek [Mon, 22 Jul 2019 08:43:19 +0000 (10:43 +0200)]
pstore: refuse to run if arguments are specified

(This is why the --help chech passed.)

5 years agopid1: make sure we look at /proc/1/cmdline when parsing config
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 15:13:09 +0000 (17:13 +0200)]
pid1: make sure we look at /proc/1/cmdline when parsing config

In recent systemd-nspawn we wouldn't parse init args like systemd.log-level=debug.
This is because we wouldn't even look at /proc/1/cmdline.

$ systemd-nspawn -n cat /proc/1/stat
1 (cat) R 0 1 1 34816 ....
                ^^^^^
34816 is 136:0 a.k.a. /dev/pts/0.

5 years agopstore: run only when /sys/fs/pstore is not empty
Yu Watanabe [Mon, 22 Jul 2019 05:09:12 +0000 (14:09 +0900)]
pstore: run only when /sys/fs/pstore is not empty

5 years agopstore: use log_setup_service()
Yu Watanabe [Mon, 22 Jul 2019 04:14:28 +0000 (13:14 +0900)]
pstore: use log_setup_service()

5 years agopstore: do not add FILE= journal entry if content_size == 0
Yu Watanabe [Mon, 22 Jul 2019 02:08:06 +0000 (11:08 +0900)]
pstore: do not add FILE= journal entry if content_size == 0

5 years agopstore: remove temporary file on failure
Yu Watanabe [Mon, 22 Jul 2019 02:01:43 +0000 (11:01 +0900)]
pstore: remove temporary file on failure

5 years agopstore: drop commented out line
Yu Watanabe [Mon, 22 Jul 2019 01:58:13 +0000 (10:58 +0900)]
pstore: drop commented out line

5 years agopstopre: fix return value of list_files()
Yu Watanabe [Mon, 22 Jul 2019 01:55:10 +0000 (10:55 +0900)]
pstopre: fix return value of list_files()

Previously, the return value of the last read_full_file() is returned.
This makes the error in read_full_file() is always ignored.

5 years agopstore: drop unnecessary initializations
Yu Watanabe [Mon, 22 Jul 2019 01:52:12 +0000 (10:52 +0900)]
pstore: drop unnecessary initializations

5 years agomeson: drop redundant line
Yu Watanabe [Mon, 22 Jul 2019 01:46:53 +0000 (10:46 +0900)]
meson: drop redundant line

Found by @mattiasb.

5 years agoman: describe $LESS options more fully
Zbigniew Jędrzejewski-Szmek [Sun, 21 Jul 2019 10:32:17 +0000 (12:32 +0200)]
man: describe $LESS options more fully

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

5 years agoMerge pull request #13096 from keszybz/unit-loading
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jul 2019 19:47:10 +0000 (21:47 +0200)]
Merge pull request #13096 from keszybz/unit-loading

Preparatory work for the unit loading rework

5 years agopstore: Tool to archive contents of pstore
Eric DeVolder [Thu, 16 May 2019 13:59:01 +0000 (08:59 -0500)]
pstore: Tool to archive contents of pstore

This patch introduces the systemd pstore service which will archive the
contents of the Linux persistent storage filesystem, pstore, to other storage,
thus preserving the existing information contained in the pstore, and clearing
pstore storage for future error events.

Linux provides a persistent storage file system, pstore[1], that can store
error records when the kernel dies (or reboots or powers-off). These records in
turn can be referenced to debug kernel problems (currently the kernel stuffs
the tail of the dmesg, which also contains a stack backtrace, into pstore).

The pstore file system supports a variety of backends that map onto persistent
storage, such as the ACPI ERST[2, Section 18.5 Error Serialization] and UEFI
variables[3 Appendix N Common Platform Error Record]. The pstore backends
typically offer a relatively small amount of persistent storage, e.g. 64KiB,
which can quickly fill up and thus prevent subsequent kernel crashes from
recording errors. Thus there is a need to monitor and extract the pstore
contents so that future kernel problems can also record information in the
pstore.

The pstore service is independent of the kdump service. In cloud environments
specifically, host and guest filesystems are on remote filesystems (eg. iSCSI
or NFS), thus kdump relies [implicitly and/or explicitly] upon proper operation
of networking software *and* hardware *and* infrastructure.  Thus it may not be
possible to capture a kernel coredump to a file since writes over the network
may not be possible.

The pstore backend, on the other hand, is completely local and provides a path
to store error records which will survive a reboot and aid in post-mortem
debugging.

Usage Notes:
This tool moves files from /sys/fs/pstore into /var/lib/systemd/pstore.

To enable kernel recording of error records into pstore, one must either pass
crash_kexec_post_notifiers[4] to the kernel command line or enable via 'echo Y
 > /sys/module/kernel/parameters/crash_kexec_post_notifiers'. This option
invokes the recording of errors into pstore *before* an attempt to kexec/kdump
on a kernel crash.

Optionally, to record reboots and shutdowns in the pstore, one can either pass
the printk.always_kmsg_dump[4] to the kernel command line or enable via 'echo Y >
/sys/module/printk/parameters/always_kmsg_dump'. This option enables code on the
shutdown path to record information via pstore.

This pstore service is a oneshot service. When run, the service invokes
systemd-pstore which is a tool that performs the following:
 - reads the pstore.conf configuration file
 - collects the lists of files in the pstore (eg. /sys/fs/pstore)
 - for certain file types (eg. dmesg) a handler is invoked
 - for all other files, the file is moved from pstore

 - In the case of dmesg handler, final processing occurs as such:
   - files processed in reverse lexigraphical order to faciliate
     reconstruction of original dmesg
   - the filename is examined to determine which dmesg it is a part
   - the file is appended to the reconstructed dmesg

For example, the following pstore contents:

 root@vm356:~# ls -al /sys/fs/pstore
 total 0
 drwxr-x--- 2 root root    0 May  9 09:50 .
 drwxr-xr-x 7 root root    0 May  9 09:50 ..
 -r--r--r-- 1 root root 1610 May  9 09:49 dmesg-efi-155741337601001
 -r--r--r-- 1 root root 1778 May  9 09:49 dmesg-efi-155741337602001
 -r--r--r-- 1 root root 1726 May  9 09:49 dmesg-efi-155741337603001
 -r--r--r-- 1 root root 1746 May  9 09:49 dmesg-efi-155741337604001
 -r--r--r-- 1 root root 1686 May  9 09:49 dmesg-efi-155741337605001
 -r--r--r-- 1 root root 1690 May  9 09:49 dmesg-efi-155741337606001
 -r--r--r-- 1 root root 1775 May  9 09:49 dmesg-efi-155741337607001
 -r--r--r-- 1 root root 1811 May  9 09:49 dmesg-efi-155741337608001
 -r--r--r-- 1 root root 1817 May  9 09:49 dmesg-efi-155741337609001
 -r--r--r-- 1 root root 1795 May  9 09:49 dmesg-efi-155741337710001
 -r--r--r-- 1 root root 1770 May  9 09:49 dmesg-efi-155741337711001
 -r--r--r-- 1 root root 1796 May  9 09:49 dmesg-efi-155741337712001
 -r--r--r-- 1 root root 1787 May  9 09:49 dmesg-efi-155741337713001
 -r--r--r-- 1 root root 1808 May  9 09:49 dmesg-efi-155741337714001
 -r--r--r-- 1 root root 1754 May  9 09:49 dmesg-efi-155741337715001

results in the following:

 root@vm356:~# ls -al /var/lib/systemd/pstore/155741337/
 total 92
 drwxr-xr-x 2 root root  4096 May  9 09:50 .
 drwxr-xr-x 4 root root    40 May  9 09:50 ..
 -rw-r--r-- 1 root root  1610 May  9 09:50 dmesg-efi-155741337601001
 -rw-r--r-- 1 root root  1778 May  9 09:50 dmesg-efi-155741337602001
 -rw-r--r-- 1 root root  1726 May  9 09:50 dmesg-efi-155741337603001
 -rw-r--r-- 1 root root  1746 May  9 09:50 dmesg-efi-155741337604001
 -rw-r--r-- 1 root root  1686 May  9 09:50 dmesg-efi-155741337605001
 -rw-r--r-- 1 root root  1690 May  9 09:50 dmesg-efi-155741337606001
 -rw-r--r-- 1 root root  1775 May  9 09:50 dmesg-efi-155741337607001
 -rw-r--r-- 1 root root  1811 May  9 09:50 dmesg-efi-155741337608001
 -rw-r--r-- 1 root root  1817 May  9 09:50 dmesg-efi-155741337609001
 -rw-r--r-- 1 root root  1795 May  9 09:50 dmesg-efi-155741337710001
 -rw-r--r-- 1 root root  1770 May  9 09:50 dmesg-efi-155741337711001
 -rw-r--r-- 1 root root  1796 May  9 09:50 dmesg-efi-155741337712001
 -rw-r--r-- 1 root root  1787 May  9 09:50 dmesg-efi-155741337713001
 -rw-r--r-- 1 root root  1808 May  9 09:50 dmesg-efi-155741337714001
 -rw-r--r-- 1 root root  1754 May  9 09:50 dmesg-efi-155741337715001
 -rw-r--r-- 1 root root 26754 May  9 09:50 dmesg.txt

where dmesg.txt is reconstructed from the group of related
dmesg-efi-155741337* files.

Configuration file:
The pstore.conf configuration file has four settings, described below.
 - Storage : one of "none", "external", or "journal". With "none", this
   tool leaves the contents of pstore untouched. With "external", the
   contents of the pstore are moved into the /var/lib/systemd/pstore,
   as well as logged into the journal.  With "journal", the contents of
   the pstore are recorded only in the systemd journal. The default is
   "external".
 - Unlink : is a boolean. When "true", the default, then files in the
   pstore are removed once processed. When "false", processing of the
   pstore occurs normally, but the pstore files remain.

References:
[1] "Persistent storage for a kernel's dying breath",
    March 23, 2011.
    https://lwn.net/Articles/434821/

[2] "Advanced Configuration and Power Interface Specification",
    version 6.2, May 2017.
    https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf

[3] "Unified Extensible Firmware Interface Specification",
    version 2.8, March 2019.
    https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf

[4] "The kernel’s command-line parameters",
    https://static.lwn.net/kerneldoc/admin-guide/kernel-parameters.html

5 years agotest-fs-util: call test functions in order of declaration
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 11:11:44 +0000 (13:11 +0200)]
test-fs-util: call test functions in order of declaration

5 years agoCreate src/shared/unit-file.[ch] for unit-file related ops
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jul 2019 13:46:16 +0000 (15:46 +0200)]
Create src/shared/unit-file.[ch] for unit-file related ops

So far we put such functinos in install.[ch], but that is tied too closely
to enable/disable. Let's start moving things to a place with a better name.

5 years agoshared/dropin: rename function for clarity
Zbigniew Jędrzejewski-Szmek [Wed, 10 Jul 2019 14:04:34 +0000 (16:04 +0200)]
shared/dropin: rename function for clarity

The caller looks for directories and is called "..._find_dirs()". Here, there
is no "finding" going on, so I found the old name confusing.

5 years agoshared/dropin: use TAKE_PTR in one more place
Zbigniew Jędrzejewski-Szmek [Wed, 10 Jul 2019 13:56:21 +0000 (15:56 +0200)]
shared/dropin: use TAKE_PTR in one more place

5 years agobasic/path-util: move two path_simplify* functions to be adjacent
Zbigniew Jędrzejewski-Szmek [Tue, 9 Jul 2019 09:40:19 +0000 (11:40 +0200)]
basic/path-util: move two path_simplify* functions to be adjacent

No functional change.

5 years agopid1: get rid of unit_supported() helper
Zbigniew Jędrzejewski-Szmek [Mon, 8 Jul 2019 15:43:14 +0000 (17:43 +0200)]
pid1: get rid of unit_supported() helper

Another case where "open code" is easier to read than the helper.

5 years agobasic/set: constify operations which don't modify Set
Zbigniew Jędrzejewski-Szmek [Mon, 8 Jul 2019 15:31:30 +0000 (17:31 +0200)]
basic/set: constify operations which don't modify Set

No functional change, but it's nicer to the reader.

5 years agopid1: do not say "(null)" if no disabled controllers
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jul 2019 11:49:43 +0000 (13:49 +0200)]
pid1: do not say "(null)" if no disabled controllers

It looks like we made a mistake. The list is just empty, that's all.

5 years agopid1: simplify timestamp buffer declaration
Zbigniew Jędrzejewski-Szmek [Fri, 5 Jul 2019 11:44:31 +0000 (13:44 +0200)]
pid1: simplify timestamp buffer declaration

5 years agoRename test-unit-file to test-load-fragment
Zbigniew Jędrzejewski-Szmek [Mon, 8 Jul 2019 22:27:18 +0000 (00:27 +0200)]
Rename test-unit-file to test-load-fragment

This file was testing a mix of functions from src/core/load-fragment.c and some
from src/shared/install.c. Let's name it more appropriately. I want to add
tests for the new unit-file.c too.

5 years agotest-unit-file: move some tests to new test-env-file.c
Zbigniew Jędrzejewski-Szmek [Thu, 4 Jul 2019 14:06:30 +0000 (16:06 +0200)]
test-unit-file: move some tests to new test-env-file.c

5 years agotest-hashmap: move tests which should also apply to ordered hashmaps and add comment
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jul 2019 11:59:30 +0000 (13:59 +0200)]
test-hashmap: move tests which should also apply to ordered hashmaps and add comment

Effectively this does two more tests also for ordered hashmaps.
This setup is a bit confusing, let's add a comment.

5 years agobasic/hashmap: add hashops variant that does strdup/freeing on its own
Zbigniew Jędrzejewski-Szmek [Thu, 11 Apr 2019 16:08:57 +0000 (18:08 +0200)]
basic/hashmap: add hashops variant that does strdup/freeing on its own

So far, we'd use hashmap_free_free to free both keys and values along with
the hashmap. I think it's better to make this more encapsulated: in this variant
the way contents are freed can be decided when the hashmap is created, and
users of the hashmap can always use hashmap_free.

5 years agotest-strv: add function headers
Zbigniew Jędrzejewski-Szmek [Wed, 3 Jul 2019 11:31:45 +0000 (13:31 +0200)]
test-strv: add function headers

5 years agosysusers,strv: export the hash ops to map char* → strv
Zbigniew Jędrzejewski-Szmek [Thu, 28 Mar 2019 16:28:48 +0000 (17:28 +0100)]
sysusers,strv: export the hash ops to map char* → strv

Also make string_strv_hashmap_put return 0 only if the entry already existed.

5 years agobasic/unit-name: allow unit_name_to_instance() to be used to classify units
Zbigniew Jędrzejewski-Szmek [Tue, 2 Apr 2019 09:05:44 +0000 (11:05 +0200)]
basic/unit-name: allow unit_name_to_instance() to be used to classify units

This could already be done by calling unit_name_is_*(), but if we don't know
if the argument is a valid unit name, it is more convenient to have a single
function which returns the type or possibly an error if the unit name is not
valid.

The values in the enum are sorted "by length". Not really important, but it
seems more natural to me.

5 years agobasic/unit-name: drop unused function
Zbigniew Jędrzejewski-Szmek [Tue, 2 Apr 2019 08:55:25 +0000 (10:55 +0200)]
basic/unit-name: drop unused function

5 years agopath-util: add path_startswith_strv()
Zbigniew Jędrzejewski-Szmek [Thu, 28 Mar 2019 21:35:46 +0000 (22:35 +0100)]
path-util: add path_startswith_strv()

5 years agotest-path-util: add function headers
Zbigniew Jędrzejewski-Szmek [Thu, 28 Mar 2019 16:59:26 +0000 (17:59 +0100)]
test-path-util: add function headers

5 years agoMerge pull request #13070 from yuwata/network-set-route-to-dhcp-dns
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jul 2019 07:34:22 +0000 (09:34 +0200)]
Merge pull request #13070 from yuwata/network-set-route-to-dhcp-dns

5 years agopid1: order jobs that execute processes with lower priority
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 16:30:15 +0000 (18:30 +0200)]
pid1: order jobs that execute processes with lower priority

We can meaningfully compare jobs for units which have cpu weight or nice set.
But non-exec units those have those set.

Starting non-exec jobs first allows us to get them out of the queue quickly,
and consider more jobs for starting.

If we have service A, and socket B, and service C which is after socket B,
and we want to start both A and C, and C has higher cpu weight, if we get
B out of the way first, we'll know that we can start both A and C, and we'll
start C first.

Also invert the comparisons using CMP() so they are always done left vs. right,
and negate when returning instead.

Follow-up for da8e178296.

5 years agotest: convert all uses of '|| true' into '|| :'
Dan Streetman [Fri, 19 Jul 2019 00:34:57 +0000 (20:34 -0400)]
test: convert all uses of '|| true' into '|| :'

No change in functionality; just use the shorter || :

5 years agoMerge pull request #13100 from 1848/neigh_ipv6
Yu Watanabe [Fri, 19 Jul 2019 00:48:49 +0000 (09:48 +0900)]
Merge pull request #13100 from 1848/neigh_ipv6

networkd: Neighbor IPv6 support for LinkLayerAddress

5 years agodocs: typo in arg name replace-irreversible -> replace-irreversibly
Anita Zhang [Thu, 18 Jul 2019 21:52:35 +0000 (14:52 -0700)]
docs: typo in arg name replace-irreversible -> replace-irreversibly

5 years agotest-network: add test for neighbor with ipv6 lladdr
Yu Watanabe [Thu, 18 Jul 2019 04:09:42 +0000 (13:09 +0900)]
test-network: add test for neighbor with ipv6 lladdr

5 years agosd-netlink: update comment
Yu Watanabe [Thu, 18 Jul 2019 03:58:07 +0000 (12:58 +0900)]
sd-netlink: update comment

5 years agonetwork: Added neighbor lladdr support for IPv6
1848 [Wed, 17 Jul 2019 17:43:35 +0000 (19:43 +0200)]
network: Added neighbor lladdr support for IPv6

5 years agomeson: update hint in man/rules/
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 20:27:45 +0000 (22:27 +0200)]
meson: update hint in man/rules/

5 years agocore: set shutdown watchdog on kexec too
Luca Boccassi [Thu, 18 Jul 2019 13:25:30 +0000 (14:25 +0100)]
core: set shutdown watchdog on kexec too

At the moment the shutdown watchdog is set only when rebooting.
The set of "things that can go wrong" is not too far off when kexec'ing
and in fact we have a use case where it would be useful - moving to a
new kernel image.

5 years agotest-network: add tests for routes to DNS servers provided by DHCPv4
Yu Watanabe [Tue, 16 Jul 2019 05:28:40 +0000 (14:28 +0900)]
test-network: add tests for routes to DNS servers provided by DHCPv4

5 years agonetwork: add DHCPv4.RoutesToDNS= setting
Yu Watanabe [Tue, 16 Jul 2019 17:47:20 +0000 (02:47 +0900)]
network: add DHCPv4.RoutesToDNS= setting

5 years agonetwork: set routes to dns servers provided by DHCPv4
Yu Watanabe [Tue, 16 Jul 2019 17:30:56 +0000 (02:30 +0900)]
network: set routes to dns servers provided by DHCPv4

5 years agonetwork: store routes provided by DHCPv4 in Set
Yu Watanabe [Tue, 16 Jul 2019 17:14:27 +0000 (02:14 +0900)]
network: store routes provided by DHCPv4 in Set

This re-writes d03073ddcde6dd2d5604b70ff4184acbe0a7961a.

5 years agonetwork: introduce route_full_hash_ops
Yu Watanabe [Tue, 16 Jul 2019 16:47:52 +0000 (01:47 +0900)]
network: introduce route_full_hash_ops

Will be used later.

5 years agoMerge pull request #13097 from poettering/mount-state-fix
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 15:33:20 +0000 (17:33 +0200)]
Merge pull request #13097 from poettering/mount-state-fix

Scan /proc/self/mountinfo before waitid() handling

5 years agoMerge pull request #13102 from mbiebl/nologin-path
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 15:17:23 +0000 (17:17 +0200)]
Merge pull request #13102 from mbiebl/nologin-path

meson: make nologin path build time configurable

5 years agomount: rename update_parameters_proc_self_mount_info() → update_parameters_proc_self_...
Lennart Poettering [Thu, 18 Jul 2019 15:02:30 +0000 (17:02 +0200)]
mount: rename update_parameters_proc_self_mount_info() → update_parameters_proc_self_mountinfo()

let's name the call like the file in /proc is actually called.

5 years agoswap: scan /proc/swaps before processing waitid() results
Lennart Poettering [Wed, 17 Jul 2019 16:58:44 +0000 (18:58 +0200)]
swap: scan /proc/swaps before processing waitid() results

Similar to the previous commit, but for /proc/swaps, where the same
logic and rationale applies.

5 years agomount: rescan /proc/self/mountinfo before processing waitid() results
Lennart Poettering [Wed, 17 Jul 2019 16:57:13 +0000 (18:57 +0200)]
mount: rescan /proc/self/mountinfo before processing waitid() results

(The interesting bits about the what and why are in a comment in the
patch, please have a look there instead of looking here in the commit
msg).

Fixes: #10872

5 years agomount: simplify /proc/self/mountinfo handler
Lennart Poettering [Wed, 17 Jul 2019 12:53:07 +0000 (14:53 +0200)]
mount: simplify /proc/self/mountinfo handler

Our IO handler is only installed for one fd, hence there's no reason to
conditionalize on it again.

Also, split out the draining into a helper function of its own.

5 years agoMerge pull request #12639 from michaelolbrich/job-order
Lennart Poettering [Thu, 18 Jul 2019 14:53:32 +0000 (16:53 +0200)]
Merge pull request #12639 from michaelolbrich/job-order

make the run queue order deterministic

5 years agovconsole-setup: rename toggle_utf8() → toggle_utf8_vc()
Lennart Poettering [Thu, 18 Jul 2019 14:05:56 +0000 (16:05 +0200)]
vconsole-setup: rename toggle_utf8() → toggle_utf8_vc()

Let's make clearer that toggle_utf8_sysfs() is about sysfs, and
toggle_utf8_vc() about VC access

5 years agoRevert "Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode()"
Lennart Poettering [Thu, 18 Jul 2019 14:01:07 +0000 (16:01 +0200)]
Revert "Move verify_vc_kbmode() to terminal-util.c as vt_verify_kbmode()"

This reverts commit bb5ac84d79ac3aef606a4a9eeaafef94a1f199be.

5 years agoRevert "Add check to switch VTs only between K_XLATE or K_UNICODE"
Lennart Poettering [Thu, 18 Jul 2019 14:01:05 +0000 (16:01 +0200)]
Revert "Add check to switch VTs only between K_XLATE or K_UNICODE"

This reverts commit 13a43c73d8cbac4b65472de04bb88ea1bacdeb89.

5 years agoman: add note about systemctl stop return value
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 08:14:52 +0000 (10:14 +0200)]
man: add note about systemctl stop return value

Fixes #13104.

(I know a lot more could be added to that  man page. This patch only addresses that
once specific complaint.)

5 years agoMerge pull request #13107 from keszybz/lvalue-rvalue
Lennart Poettering [Thu, 18 Jul 2019 14:12:20 +0000 (16:12 +0200)]
Merge pull request #13107 from keszybz/lvalue-rvalue

Better error messages for syntax errors

5 years agotest: replace Makefile copy with a symlink for TEST-28-PERCENTJ-WANTEDBY
Michael Biebl [Thu, 18 Jul 2019 10:48:50 +0000 (12:48 +0200)]
test: replace Makefile copy with a symlink for TEST-28-PERCENTJ-WANTEDBY

TEST-28-PERCENTJ-WANTEDBY/Makefile is identical to
TEST-01-BASIC/Makefile so avoid duplication and use a symlink instead.

5 years agomeson: make nologin path build time configurable
Michael Biebl [Wed, 17 Jul 2019 23:24:00 +0000 (01:24 +0200)]
meson: make nologin path build time configurable

Some distros install nologin as /usr/sbin/nologin, others as
/sbin/nologin.
Since we can't really on merged-usr everywhere (where the path wouldn't
matter), make the path build time configurable via -Dnologin-path=.

Closes #13028

5 years agoshared/conf-parser: say "key name" not "lvalue", add dot
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 09:33:48 +0000 (11:33 +0200)]
shared/conf-parser: say "key name" not "lvalue", add dot

"lvalue" is our internal jargon. Let's try not to confuse non-programmers.

5 years agoshared/conf-parser: emit a nicer warning for something like "======"
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 09:30:43 +0000 (11:30 +0200)]
shared/conf-parser: emit a nicer warning for something like "======"

Urlich Windl wrote on the mailing list:
> I noticed that a line of "=======" in "[Service]" cases the message " Unknown lvalue '' in section 'Service'".

This now becomes:
/etc/systemd/system/eqeqeqeq.service:3: Missing key name before '=', ignoring line.

5 years agoshared/conf-parser: be nice and ignore lines without "="
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 09:28:55 +0000 (11:28 +0200)]
shared/conf-parser: be nice and ignore lines without "="

We generally don't treat syntax error as fatal, but in this case we would
completely refuse to load the file. I think we should treat the the same
as assignment outside of a section, or an unknown key name.

5 years agojob: make the run queue order deterministic
Michael Olbrich [Wed, 22 May 2019 10:12:17 +0000 (12:12 +0200)]
job: make the run queue order deterministic

Jobs are added to the run queue in random order. This happens because most
jobs are added by iterating over the transaction or dependency hash maps.

As a result, jobs that can be executed at the same time are started in a
different order each time.
On small embedded devices this can cause a measurable jitter for the point
in time when a job starts (~100ms jitter for 10 units that are started in
random order).
This results is a similar jitter for the boot time. This is undesirable in
general and make optimizing the boot time a lot harder.
Also, jobs that should have a higher priority because the unit has a higher
CPU weight might get executed later than others.

Fix this by turning the job run_queue into a Prioq and sort by the
following criteria (use the next if the values are equal):
- CPU weight
- nice level
- unit type
- unit name

The last one is just there for deterministic sorting to avoid any jitter.

5 years agobasic: reorder UnitType enum
Michael Olbrich [Wed, 3 Jul 2019 14:11:47 +0000 (16:11 +0200)]
basic: reorder UnitType enum

The enum order will be used to order jobs in the job queue.
Make sure that unit types that fork aditional processes come first to
maximize parallelism.

5 years agoMerge pull request #13103 from anitazha/conditiondocs
Zbigniew Jędrzejewski-Szmek [Thu, 18 Jul 2019 06:06:37 +0000 (08:06 +0200)]
Merge pull request #13103 from anitazha/conditiondocs

NEWS and catalog update for ExecCondition=

5 years agocatalog: reference ExecCondition= in unit skipped str
Anita Zhang [Thu, 18 Jul 2019 05:39:55 +0000 (22:39 -0700)]
catalog: reference ExecCondition= in unit skipped str

5 years agoNEWS: bullet point for ExecCondition=
Anita Zhang [Thu, 18 Jul 2019 05:24:23 +0000 (22:24 -0700)]
NEWS: bullet point for ExecCondition=

5 years agocore: never propagate reload failure to service result
Lennart Poettering [Wed, 17 Jul 2019 17:16:33 +0000 (19:16 +0200)]
core: never propagate reload failure to service result

Fixes: #11238

5 years agoMerge pull request #13047 from niedbalski/fix-5552-pr
Lennart Poettering [Wed, 17 Jul 2019 17:27:16 +0000 (19:27 +0200)]
Merge pull request #13047 from niedbalski/fix-5552-pr

resolved: add new option to only cache positive answers

5 years agoMerge pull request #13086 from yuwata/network-dhcp6-cleanups
Lennart Poettering [Wed, 17 Jul 2019 17:26:46 +0000 (19:26 +0200)]
Merge pull request #13086 from yuwata/network-dhcp6-cleanups

network: dhcp6 cleanups

5 years agoMerge pull request #13093 from keszybz/two-assert-cc-cleanups
Frantisek Sumsal [Wed, 17 Jul 2019 15:53:35 +0000 (15:53 +0000)]
Merge pull request #13093 from keszybz/two-assert-cc-cleanups

Two assert_cc cleanups

5 years agoresolved: switch cache option to a tri-state option (systemd#5552).
Jorge Niedbalski [Fri, 12 Jul 2019 19:34:24 +0000 (15:34 -0400)]
resolved: switch cache option to a tri-state option (systemd#5552).

Change the resolved.conf Cache option to a tri-state "no, no-negative, yes" values.

If a lookup returns SERVFAIL systemd-resolved will cache the result for 30s (See 201d995),
however, there are several use cases on which this condition is not acceptable (See systemd#5552 comments)
and the only workaround would be to disable cache entirely or flush it , which isn't optimal.

This change adds the 'no-negative' option when set it avoids putting in cache
negative answers but still works the same heuristics for positive answers.

Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
5 years agonetwork: update state file after dhcp6 events
Yu Watanabe [Wed, 17 Jul 2019 14:12:07 +0000 (23:12 +0900)]
network: update state file after dhcp6 events

E.g. DNS servers may be received from DHCPv6 server. If the link is
already in configured state, the DNS servers are not written in the
state file.

5 years agoRevert "test-network: extend sleep time"
Yu Watanabe [Wed, 17 Jul 2019 14:03:01 +0000 (23:03 +0900)]
Revert "test-network: extend sleep time"

This reverts commit 7d7bb5c8613b774bf77c531f46d31ee20d7a1b1e.

Still the CIs are flaky and the commit just slow down them.

5 years agoman: fix wrong section name
Yu Watanabe [Wed, 17 Jul 2019 01:07:42 +0000 (10:07 +0900)]
man: fix wrong section name

5 years agonetwork: fix use after free()
Yu Watanabe [Wed, 17 Jul 2019 01:21:07 +0000 (10:21 +0900)]
network: fix use after free()

The hashmap will be accessed by client_stop().