1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00
Commit Graph

61575 Commits

Author SHA1 Message Date
Yu Watanabe
62650f4258
Merge pull request #25602 from fbuihuu/fix-TEST-73-LOCALE
localed: reload PID1 configuration after modifying /etc/locale.conf
2022-12-15 17:47:05 +09:00
Daan De Meyer
5c33b68652 repart: Rework Minimize= option settings
Instead of having Minimize= take a boolean let's allow for two
different ways to enable it. "best" means we want the most minimal
image possible, which currently is only possible for read-only
filesystems but can be extended in the future with bisection
to find the most minimal possible size.

We also add "guess", which is the current behavior, where we
populate once and use the sparse size to make a reasonable guess
on a size that fits all the sources without needing to O(log(n))
tries to find the most minimal size.
2022-12-15 15:09:09 +09:00
Yu Watanabe
993681def8
Merge pull request #25743 from yuwata/timesync-ipv6
timesync: ignore IPv6 addresses when the kernel does not support it
2022-12-15 12:57:54 +09:00
Zbigniew Jędrzejewski-Szmek
7a14db9cfd basic: do not output emojis if not on a proper terminal
$TERM would generally be set if we're connected to a proper graphical terminal
emulator. In all other cases, in particular if $TERM is not set, we almost
certainly are not connected to something that can output emojis. In particular
the text console is unlikely to ever do it correctly.

So let's invert the check, and only write emojis if $TERM is set.

Fixes #25521.
2022-12-15 12:56:03 +09:00
Yu Watanabe
60e84f0205
Merge pull request #25732 from enr0n/unit-test-machine-id-initialized
unit tests: do not fail when `/etc/machine-id` is empty
2022-12-15 12:55:04 +09:00
Yu Watanabe
a6e16d949c
Merge pull request #25723 from keszybz/generators-tmp
Run generators with / ro and /tmp mounted
2022-12-15 12:53:49 +09:00
Yu Watanabe
1af1c95e30
Merge pull request #25693 from yuwata/binfmt
binfmt: several cleanups
2022-12-15 12:52:30 +09:00
Zbigniew Jędrzejewski-Szmek
750c605614 pam: actually align the columns
In 9efb224443 was supposed to align
them, but for some reason I just added a second space everywhere.
2022-12-15 00:11:11 +01:00
Mike Yuan
8f23229cae systemctl: is-enabled: document the return code change
Follow-up for #25689

We've added a new output ("not-found") in #25689.
2022-12-14 23:21:06 +01:00
Zbigniew Jędrzejewski-Szmek
c41fff1e08 fstab-generator: use log message that matches reality
We *assume* that when /sys is read-only, we're running in a container. But
there can other reasons, for example root is mount ro and nobody has mounted
/sys yet, or somebody forgot to add /sys to the list of filesystem not to
remount ro in a sandbox. So let's actually say what we know instead of assuming.

systemd-fstab-generator was reporting that it's running in a container and I
spent a good few minutes trying to figure out why 'systemd-detect-virt -c'
disagrees, before noticing that it's just checking a different condition.
2022-12-14 22:12:44 +01:00
Zbigniew Jędrzejewski-Szmek
9f563f2792 tree-wide: use mode=0nnn for mount option
This is an octal number. We used the 0 prefix in some places inconsistently.
The kernel always interprets in base-8, so this has no effect, but I think
it's nicer to use the 0 to remind the reader that this is not a decimal number.
2022-12-14 22:12:44 +01:00
Zbigniew Jędrzejewski-Szmek
ca6ce62d2a manager: execute generators in a mount namespace "sandbox"
When generators are executed during early boot, /tmp might not be available
yet. This causes problems with bash, because here-docs don't work. Even
non-shell code can often assume that /tmp is available. This limitation is
known to trip up people, and when the code is tested on a "normal" system,
everything works.

We can solve this nicely, and get another small benefit, by making most of the
file system read-only and "punching holes" for some dirs that should be
writable. The generator code runs with full privileges and can do anything it
wants by writing appropriate systemd units, so it doesn't make much sense to do
any significant sandboxing around generators. But making root read-only is nice
because it can catch stupid mistakes where the generator tries to write to a
wrong path or something like that. We effectively also get a "private /tmp" for
the generators, which protects them against existing files in /tmp.

The path does the following:
when executing generators, we fork, and the child unshares root and makes
it recursively read-only, with the exception of /sys and /run. Error handling
is permissive — if some of this setup fails, we're in the same state as
before the patch.

Fixes #24430.
2022-12-14 22:12:44 +01:00
Zbigniew Jędrzejewski-Szmek
61ef30515b shared: add new safe_fork flag FORK_PRIVATE_TMP
If the flag is set, we mount /tmp/ in a way that is suitable for generators and
other quick jobs.

Unfortunately I had to move some code from shared/mount-util.c to
basic/mountpoint-util.c. The functions that are moved are very thin wrappers
around mount(2), so this doesn't actually change much in the code split between
libbasic and libshared.

Implications for the host would be weird if a private mount namespace is not
used, so assert on FORK_NEW_MOUNTNS when the flag is used.
2022-12-14 22:12:44 +01:00
Nick Rosbrook
3a9ca23036 journal: skip part of test-journal-interleaving if no machine-id exists
When executed on a systemd with an empty /etc/machine-id,
test-journal-interleaving fails in test_sequence_numbers_one() when
re-opening the existing "two.journal". This is because opening the
existing journal file with managed_journal_file_open() causes
journal_file_verify_header() to be called. This function tries to
compare the current machine-id to the machine-id in the journal file
header, but does not handle the case where the machine-id is empty or
non-existent.

Check if we have an initialized machine-id before executing this portion
of the test.
2022-12-14 13:58:12 -05:00
Nick Rosbrook
2c6b738bad test-load-fragment: simplify machine-id check 2022-12-14 13:58:12 -05:00
Nick Rosbrook
a635b6279c test-unit-name: simplify machine-id check 2022-12-14 13:58:12 -05:00
Nick Rosbrook
079fcdd04f test-fs-util: skip part of test_chase_symlinks if machine-id is not initialized
The part of test_chase_symlink in test-fs-util that calls
sd_id128_get_machine will fail if /etc/machine-id is empty, so skip this
block if the machine-id is not initialized.
2022-12-14 13:58:12 -05:00
Nick Rosbrook
415eb50570 test-id128: simplify machine-id check
This also ensures that the test is skipped when /etc/machine-id exists,
but is not initialized.
2022-12-14 13:58:12 -05:00
Yu Watanabe
f74a7cb45c unit: check more specific path to be written by systemd-binfmt
Follow-up for 41807efb15.
Replaces #25690.
2022-12-15 03:36:27 +09:00
Yu Watanabe
94ba5b1532 binfmt: check if binfmt is mounted before applying rules 2022-12-15 03:36:27 +09:00
Yu Watanabe
5aaa79ce96 binfmt-util: also check if binfmt is mounted in read-write 2022-12-15 03:36:24 +09:00
Yu Watanabe
713e6e631d timesync: ignore IPv6 addresses when the kernel does not support IPv6
Fixes #25728.
2022-12-15 03:30:13 +09:00
Yu Watanabe
a51a9684c9 binfmt-util: split out binfmt_mounted()
No functional changes, just refactoring and preparation for later
commits.
2022-12-15 03:26:39 +09:00
Yu Watanabe
dc1752ea72 stat-util: introduce fd_is_read_only_fs()
Then, reimplement path_is_read_only_fs() by the function to avoid race.
2022-12-15 03:25:09 +09:00
Lennart Poettering
5c6c587ce2
Merge pull request #25575 from brauner/nspawn.socket_surgery
nspawn: reduce number of sockets
2022-12-14 18:36:44 +01:00
Yu Watanabe
30a3181504
Merge pull request #25734 from yuwata/sd-id128
sd-id128: several followups
2022-12-15 02:23:03 +09:00
Felix Riemann
9b4e04f0cd timesync: Keep trying to connect even if the socket cannot be opened
This makes sure that after a server could not be contacted due to a
socket error, other (possibly working) NTP servers in the list of
configured NTP servers are (re-)tried.

Fixes #25728.
2022-12-15 02:21:25 +09:00
MVZ Ludwigsburg
a76d7acae1 hwdb: Add mount matrix for CSL Panther Tab HD 2022-12-15 02:20:43 +09:00
Siddhesh Poyarekar
7929e180aa Use dummy allocator to make accesses defined as per standard
systemd uses malloc_usable_size() everywhere to use memory blocks
obtained through malloc, but that is abuse since the
malloc_usable_size() interface isn't meant for this kind of use, it is
for diagnostics only.  This is also why systemd behaviour is flaky when
built with _FORTIFY_SOURCE.

One way to make this more standard (and hence safer) is to, at every
malloc_usable_size() call, also 'reallocate' the block so that the
compiler can see the larger size.  This is done through a dummy
reallocator whose only purpose is to tell the compiler about the larger
usable size, it doesn't do any actual reallocation.

Florian Weimer pointed out that this doesn't solve the problem of an
allocator potentially growing usable size at will, which will break the
implicit assumption in systemd use that the value returned remains
constant as long as the object is valid.  The safest way to fix that is
for systemd to step away from using malloc_usable_size() like this.

Resolves #22801.
2022-12-14 17:49:47 +01:00
Yu Watanabe
f0d8358c24 man: update documents for sd_id128_get_invocation() 2022-12-15 00:07:17 +09:00
Yu Watanabe
75fa1f25c0 sd-id128: also refuse an empty invocation ID 2022-12-15 00:07:17 +09:00
Yu Watanabe
786b652c89 sd-id128: allow sd_id128_get_machine() and friend to be called with NULL
It may be useful to check if the machine ID or friends is set or not.
2022-12-15 00:07:17 +09:00
Yu Watanabe
e8a6625422 sd-id128: make sd_id128_get_machine() or friends return -EUCLEAN when an ID is in an invalid format
EINVAL suggests that the caller passes an invalid argument. EIO is
for "input/output error", i.e. the error you'd get if the disk or
file system is borked, and this error code could be returned by the
underlying read/write functions.

Let's make the functions return an unambiguous error code.
2022-12-15 00:07:13 +09:00
Yu Watanabe
7a12328735 timesync: downgrade log message about unsupported address family
As this is mostly not user's fault.
2022-12-14 23:55:21 +09:00
David Tardon
cc137d53e3 swap: tell swapon to reinitialize swap if needed
If the page size of a swap space doesn't match the page size of the
currently running kernel, swapon will fail. Let's instruct it to
reinitialize the swap space instead.
2022-12-14 15:48:10 +01:00
Luca Boccassi
e146136304
Merge pull request #25717 from bluca/reload
manager: log reload() sender and allow rate-limiting
2022-12-14 15:45:22 +01:00
Yu Watanabe
bdc11d26d1 NEWS: fix typo 2022-12-14 20:41:42 +09:00
Yu Watanabe
0ec8777e18
Merge pull request #25726 from dtardon/cleanups
Several small cleanups
2022-12-14 20:17:56 +09:00
Yu Watanabe
863b620a4a resolve: fix NULL-pointer dereference
Fixes a bug introduced by 16a6bc5a7a.
Fixes CID#1501514.
2022-12-14 19:10:19 +09:00
Jiayi Chen
b1c4466bba doc: add language decorator on the code block
Add `c` decorator on the code block for applying syntax highlighting.
2022-12-14 18:07:07 +09:00
David Tardon
246caacbb4 btrfs-util: shorten a bit 2022-12-14 09:57:35 +01:00
David Tardon
359e8d76e8 machine: propagate error from machine_new 2022-12-14 09:57:35 +01:00
David Tardon
38f514409a machine: use _cleanup_ in machine_new 2022-12-14 09:57:35 +01:00
David Tardon
d2b6485385 localed-util: use _cleanup_ harder 2022-12-14 09:57:35 +01:00
David Tardon
6323bd1094 busctl-introspect: use _cleanup_ 2022-12-14 09:56:33 +01:00
Zbigniew Jędrzejewski-Szmek
357f5ccbf6
Merge pull request #25689 from YHNdnzj/systemctl-exit-code
systemctl: make is-* return EXIT_PROGRAM_OR_SERVICES_STATUS_UNKNOWN(4) when no unit file is found
2022-12-14 08:37:16 +01:00
Daan De Meyer
8275334bec repart: Rename --skip-partitions to --defer-partitions
Defer is better because it indicates that we still intend to
populate these partitions later.
2022-12-14 13:20:32 +09:00
Luca Boccassi
7fe1e7448f
Merge pull request #25706 from yuwata/hwdb-pointing-stick
hwdb: several fixes for pointing stick
2022-12-14 01:38:55 +01:00
Luca Boccassi
71f7cc6a9e
Merge pull request #25725 from keszybz/oom-policy-fixup
Add missing integration of OOMPolicy in scope units
2022-12-14 01:38:11 +01:00
Daan De Meyer
57db3399c3 mkosi: Enable CONFIG_ZBOOT
Required to boot mkosi images with systemd-boot on aarch64.
2022-12-13 21:27:15 +01:00