Commit graph

26554 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek eeba9cc3d7
Merge pull request #13120 from keszybz/journal-min-use
Increase journald min_use value
2019-07-27 21:00:38 +02:00
Thomas Haller 6fd79cca68 errno-util: return const string from strerror_safe()
C's strerror() function does not return a "const char *" pointer
for the string. That has historic reasons and C99 even comments
that "[t]he array pointed to shall not be modified by the program".

Make the strerror_safe() wrapper correct this and be more strict
in this regard.
2019-07-26 18:42:49 +02:00
Lennart Poettering 17f8fd9cf7
Merge pull request #13194 from keszybz/chase-symlinks-testing
Chase symlinks testing
2019-07-26 18:42:31 +02:00
Zbigniew Jędrzejewski-Szmek 6aae0b1af4 journald: lower keep_free to 5% and raise min_use to 2%
https://bugzilla.redhat.com/show_bug.cgi?id=1715699

> /dev/mapper/live-rw  6.4G  5.7G  648M  91% /
> systemd-journald[905]: Fixed min_use=1.0M max_use=648.7M max_size=81.0M min_size=512.0K keep_free=973.1M n_max_files=100

When journald is started, we pick keep_free as 15% of the disk size. When the
fs is almost filled, we will only keep one journal file around and rotate very
often (because min_size is very small).

Let's set min use to something reasonable, so that we get more useful logs that
will cover at least the full boot.

Some cases considered in the PR:

> /dev/mapper/live-rw 6.4G 5.7G 648M 91% /

keep_free→MIN(327,100)→100 MB.
min_use→16MB.
effective range: 16 MB – 548 MB

> /dev/mapper/fedora_krowka-root 78G 69G 5.7G 93% /

keep_free → MIN(4GB, 100MB)→100MB
min_use→16MB
effective range: 16 MB – 5.6 GB
(but then there's the max_use limit, which cuts the range down)

> 4TB, 4GB free

keep_free → MIN(209715, 100) → 100 MB
min_use→16MB
effective range: 16 MB – 4.9 GB
(also effectively limited by max_use)

Also replace unneeded width suffixes with spaces, I think this is more
readable, and drop DEFAULT_ prefixes in cases where this setting is
simply a bound, and cannot be overridden by user config, hence is not
a default.
2019-07-26 16:45:49 +02:00
Zbigniew Jędrzejewski-Szmek 22f62b1274 fs-util: CHASE_NOFOLLOW is not limited to CHASE_OPEN
$ build/test-chase-symlinks /etc/os-release
/etc/os-release → /usr/lib/os-release

$ build/test-chase-symlinks --nofollow /etc/os-release /etc/../etc/os-release /etc/../etc/./././os-release
/etc/os-release → /etc/os-release
/etc/../etc/os-release → /etc/os-release
/etc/../etc/./././os-release → /etc/os-release
2019-07-26 15:29:11 +02:00
Zbigniew Jędrzejewski-Szmek 4b486ee8b1 test-chase-symlinks: manual test to call chase_symlinks()
v2:
- print --help to stdout, use size_t
2019-07-26 15:28:58 +02:00
Zbigniew Jędrzejewski-Szmek a4d208018c bootctl: log message tweaks
Follow-up for e44c3229f2.
2019-07-26 15:05:18 +02:00
Zbigniew Jędrzejewski-Szmek 6304fec37c
Merge pull request #13191 from poettering/sysctl-no-fail
allow sysctl assignments to fail
2019-07-26 14:57:56 +02:00
Zbigniew Jędrzejewski-Szmek 47685d9d4b
Merge pull request #13137 from poettering/efi-random
beef up random seed logic, add boot loader entropy privisioning, improve docs about it
2019-07-26 12:43:32 +02:00
Lennart Poettering 8deeef94e7
Merge pull request #13188 from yuwata/news-igmp-version
network: rename `IGMPVersion=` to `MulticastIGMPVersion=`
2019-07-26 09:40:21 +02:00
Lennart Poettering dec02d6e19 sysctl: if options are prefixed with "-" ignore write errors 2019-07-26 09:24:47 +02:00
Lennart Poettering 2de30233f7 sysctl: reset 'r' only where needed 2019-07-26 09:24:47 +02:00
Lennart Poettering 8a65188437 sysctl: switch to log_syntax()
With @keszybz' recent work this will give us clickable links in the
journalctl output.
2019-07-26 09:24:47 +02:00
Yu Watanabe b738530b04 network: slightly update log message 2019-07-26 11:00:56 +09:00
Yu Watanabe e8489008cb network: rename IGMPVersion= -> MulticastIGMPVersion= 2019-07-26 11:00:56 +09:00
Zbigniew Jędrzejewski-Szmek 0a71e31c33 sd-boot: silence one warning about pointer cast
It doesn't matter either way. Fixes #13174.
2019-07-26 10:37:56 +09:00
Lennart Poettering a2aa605d22 bootctl: add is-installed verb
Fixes: #9428
2019-07-25 18:31:20 +02:00
Lennart Poettering 26ded55709 random-seed: rework systemd-random-seed.service substantially
This makes two major changes to the way systemd-random-seed operates:

1. We now optionally credit entropy if this is configured (via an env
var). Previously we never would do that, with this change we still don't
by default, but it's possible to enable this if people acknowledge that
they shouldn't replicate an image with a contained random seed to
multiple systems. Note that in this patch crediting entropy is a boolean
thing (unlike in previous attempts such as #1062), where only a relative
amount of bits was credited. The simpler scheme implemented here should
be OK though as the random seeds saved to disk are now written only with
data from the kernel's entropy pool retrieved after the pool is fully
initialized. Specifically:

2. This makes systemd-random-seed.service a synchronization point for
kernel entropy pool initialization. It was already used like this, for
example by systemd-cryptsetup-generator's /dev/urandom passphrase
handling, with this change it explicitly operates like that (at least
systems which provide getrandom(), where we can support this). This
means services that rely on an initialized random pool should now place
After=systemd-random-seed.service and everything should be fine. Note
that with this change sysinit.target (and thus early boot) is NOT
systematically delayed until the entropy pool is initialized, i.e.
regular services need to add explicit ordering deps on this service if
they require an initialized random pool.

Fixes: #4271
Replaces: #10621 #4513
2019-07-25 18:30:06 +02:00
Lennart Poettering c6127c3996 random-seed: drop falling back to O_WRONLY if O_RDWR on /dev/urandom doesn't work
There's no reason why writing should work if reading and writing
doesn't. Let's simplify this hence. /dev/urandom is generally an r/w
device, and everything else would be a serious system misconfiguration.
2019-07-25 18:20:50 +02:00
Lennart Poettering 15d961bf53 random-seed: reduce scope of variable 2019-07-25 18:20:50 +02:00
Lennart Poettering d6e9a347a5 bootctl: show random seed state 2019-07-25 18:20:50 +02:00
Lennart Poettering e44c3229f2 bootctl: add new verb for initializing a random seed in the ESP 2019-07-25 18:20:50 +02:00
Lennart Poettering 3e155eba43 random-seed: move pool size determination to random-util.[ch]
That way we can reuse it elsewhere.
2019-07-25 18:16:46 +02:00
Lennart Poettering c18ecf0375 core: take random seed from boot loader and credit it to kernel entropy pool 2019-07-25 18:16:46 +02:00
Lennart Poettering e4dcf7aa52 sd-boot: read random seed from ESP and pass it to OS 2019-07-25 18:16:46 +02:00
Lennart Poettering 073220bf36 efi: steal glibc sha256 implementation 2019-07-25 17:10:51 +02:00
Lennart Poettering 22c5ff5132 bootctl: add new feature flag for indicating random seed management support 2019-07-25 17:10:51 +02:00
Lennart Poettering 7c122dfef8 bootctl: shortcut configuration file parsing 2019-07-25 17:10:51 +02:00
Lennart Poettering b461576de4 bootctl: drop const from non-pointer function argument 2019-07-25 17:10:51 +02:00
Lennart Poettering 5509f91261 bootctl: use the fact that startswith() returns the suffix 2019-07-25 17:10:51 +02:00
Lennart Poettering c242a08279 efivars: modernize efi_get_variable() a bit
Primarily, make sure the return parameters are all individually
optional.
2019-07-25 17:10:51 +02:00
Lennart Poettering b19fa8126d efi: add log_oom() helper 2019-07-25 17:10:51 +02:00
Lennart Poettering 1aaabb17fd efi: modernize file_read() a bit 2019-07-25 17:10:51 +02:00
Lennart Poettering 5373172e80 xattr-util: document that we NUL suffix 2019-07-25 17:10:51 +02:00
Lennart Poettering 63d59b8dcf fs-util: add fsync_full() helper
We usually combine an fsync() with fsync_directory_of_file() hence let's
add a helper that does both in one.
2019-07-25 17:10:51 +02:00
Yu Watanabe 500b96eb34 network: drop redundant Link::kind check
All CAN devices' iftype are ARPHRD_CAN. So, checking Link::kind is
redundant.

Follow-up for c6ac3729c9.
2019-07-25 16:47:16 +09:00
Yu Watanabe 4bd04e3dcb network: drop recently added settings from deprecated [DHCP] section 2019-07-25 12:39:33 +09:00
Susant Sahani afa51e2dfb networkd: bridge add support to set IGMP version 2019-07-25 10:05:06 +09:00
Shreyas Behera 037dbb80d1 Add IFLA_BR_MCAST_IGMP_VERSION 2019-07-25 09:54:52 +09:00
Yu Watanabe 4410f5c902
Merge pull request #13166 from yuwata/network-slcan-support
network: slcan support
2019-07-25 09:49:56 +09:00
Yu Watanabe 9a4490e1e9
Merge pull request #13173 from kinvolk/iaguis/fix-norbind
Revert "nspawn: remove unnecessary mount option parsing logic"
2019-07-25 09:47:59 +09:00
Lennart Poettering 0a2eef1ee1 core: try to reopen /dev/kmsg again right after mounting /dev
I was debugging stuff during early boot, and was confused that I never
found the logs for it in kmsg. The reason for that was that /proc is
generally not mounted the first time we do log_open() and hence
log_set_target(LOG_TARGET_KMSG) we do when running as PID 1 had not
effect. A lot later during start-up we call log_open() again where this
is fixed (after the point where we close all remaining fds still open),
but in the meantime no logs every got written to kmsg. This patch fixes
that.
2019-07-24 19:56:51 +02:00
Iago López Galeiras a11fd4067b Revert "nspawn: remove unnecessary mount option parsing logic"
This reverts commit 72d967df3e.

Revert this because it broke the `norbind` option of the bind flags
because it does bind-mounts unconditionally recursive.

Let's bring the old logic back.

Fixes: #13170
2019-07-24 17:17:42 +02:00
Yu Watanabe c6ac3729c9 network: support slcan
The device driver does not have IFLA_INFO_KIND attribute. So, we need to
check iftype.

Closes #13150.
2019-07-24 23:13:22 +09:00
Susant Sahani 426588bc63 network: fix DHCP route rumber parsing. 2019-07-24 18:06:30 +05:30
Zbigniew Jędrzejewski-Szmek 181824e32c
Merge pull request #13145 from poettering/nss-gateway-fix
filter _gateway NSS resolving to only use main routing table
2019-07-24 12:00:30 +02:00
Yu Watanabe 8f815e8b03 tree-wide: drop netinet/ether.h from socket-util.h and sd-netlink.h 2019-07-24 18:23:08 +09:00
Lennart Poettering 544ad34257
Merge pull request #13118 from bluca/shutdown_watchdog_kexec
core: add KExecWatchdogSec and rename ShutdownWatchdogSec to RebootWatchdogSec
2019-07-24 11:11:03 +02:00
Yu Watanabe d008aae97a
Merge pull request #13143 from poettering/logind-inhibit-restart
logind restart inhibition fixes
2019-07-24 16:50:39 +09:00
Lennart Poettering dfadc1f203 meson: reorder alphabetically 2019-07-24 09:07:33 +02:00