1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-24 06:04:05 +03:00

64980 Commits

Author SHA1 Message Date
Luca Boccassi
5aab673dd1
Merge pull request #27840 from mrc0mmand/gcc-13
ci: add gcc-13, drop gcc-12
2023-05-31 11:07:22 +01:00
Luca Boccassi
29084afd91
Merge pull request #27519 from yuwata/journalctl-fixes
journalctl: several fixes and cleanups for --follow
2023-05-31 11:05:54 +01:00
Luca Boccassi
23f315dc08
Merge pull request #27835 from keszybz/test-58-repart-modernization
Cleanup/simplifications for TEST-58-repart
2023-05-31 11:00:18 +01:00
Zbigniew Jędrzejewski-Szmek
088d8c99fe test-fstab-generator: fix test on systemd with systemd-boot
(… or other boot loaders implementing the Boot Loader Interface.)

Fixes #27857.
2023-05-31 10:59:50 +01:00
Lennart Poettering
40fb9eebbc tmpfiles: use same credstore perms everywhere
In b6033b706028a64e9affb79050ced1ad9a4f5b43 support was added to create
{/etc|/run}/credstore{|.encrypted} via tmpfiles.d with perms 0000. These
perms are so restrictive that not even root can access them unless it
has CAP_DAC_OVERRIDE capability. This is creates the dirs at boot time

In 24039e1207c169b18adf5234ad300ea3ba1b671e support was added to create
/etc/credstore with perm 0700 from meson.build at build time.

This patch makes unifies the two parts:

1. creates both /etc/credstore *and* /etc/credstore.encrypted in both
   places (the build system still won't create them in /run/, since
   that's pointless since not shipped, and the runtime won't create the
   dirs below /usr/lib/, since that's not generically writable anyway).

2. Both at runtime and at build time we'll create the dirs with mode
   0700. This is easier for packaging tools to handle since they
   generally react pretty negatively on dirs they can't enumerate.
2023-05-31 11:15:26 +08:00
Frantisek Sumsal
241ecd1cc2 core,shared: add a couple of asserts
To appease the LTO overlords:

In file included from ../../../../src/basic/macro.h:446,
                 from ../../../../src/shared/blockdev-util.h:8,
                 from ../../../../src/shared/creds-util.c:11:
../../../../src/shared/creds-util.c: In function 'get_credential_host_secret':
../../../../src/shared/creds-util.c:379:52: error: '%s' directive argument is null [-Werror=format-overflow=]
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/basic/log.h:214:86: note: in definition of macro 'log_full_errno_zerook'
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../../../../src/basic/log.h:250:41: note: in expansion of macro 'log_full_errno'
  250 | #define log_debug_errno(error, ...)     log_full_errno(LOG_DEBUG,   error, __VA_ARGS__)
      |                                         ^~~~~~~~~~~~~~
../../../../src/shared/creds-util.c:379:33: note: in expansion of macro 'log_debug_errno'
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                 ^~~~~~~~~~~~~~~
../../../../src/shared/creds-util.c:379:74: note: format string is defined here
  379 |                                 log_debug_errno(r, "Credential secret %s/%s appeared while we were creating it, rereading.",
      |                                                                          ^~
cc1: some warnings being treated as errors

../../../../src/core/transaction.c: In function 'transaction_verify_order_one':
../../../../src/core/transaction.c:338:38: error: '%s' directive argument is null [-Werror=format-overflow=]
  338 |                 sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
      |                                      ^~
cc1: some warnings being treated as errors
2023-05-30 16:23:40 +02:00
Frantisek Sumsal
4189d009ae ci: add gcc-13, drop gcc-12 2023-05-30 16:23:40 +02:00
Daan De Meyer
600bf76c17 repart: Allow target directory excludes
Currently, ExcludeFiles= supports excluding directories on the host
from being copied. Let's extend this to also support preventing files
from being copied into specific directories in the partition by adding
a new option ExcludeFilesTarget=. An example where this is useful is
when setting up btrfs subvolumes in the top level that are intended to
be mounted into specific locations, so /usr would be stored in @usr,
/home in @home, .... To accomplish this, we need to copy /usr to @usr
and prevent any files from being copied into /usr in the partition,
which with this commit, we'd be able to do as follows:

```
[Partition]
CopyFiles=/usr:@usr
ExcludeFilesTarget=/usr
```
2023-05-30 13:45:49 +02:00
Zbigniew Jędrzejewski-Szmek
afbe20b7d4 shared/loop-util: use longer delay when waiting for loop device
The kernel may be syncing a file system or doing something else that requires
more time. So make the delay a bit longer, but provide some feedback and also
grow the delay exponentially (though with a long exponent). If the kernel is
doing something else, no need to repeat so often. With 38 attempts, we get a
total of slightly above 5000 ms.

I wrote this when I thought that the the delay is not long enough. It turned
out that we were blocking the file system on the loop device, so waiting longer
wasn't helpful. But I think it's nicer to do it this way anyway.
2023-05-30 13:41:56 +02:00
Zbigniew Jędrzejewski-Szmek
5097077954
Merge pull request #27842 from keszybz/man-page-links
Man page formatting and links and such
2023-05-30 13:40:45 +02:00
Frantisek Sumsal
6405afdaf5 meson: use -Werror=strict-flex-arrays 2023-05-30 10:31:25 +02:00
Frantisek Sumsal
13bb569b75 boot: make Event a standard-conforming flexible array 2023-05-30 10:22:44 +02:00
Dmitry V. Levin
d4bfb78bfc man: mention that udevadm verify also checks for udev rules style issues
Starting with commit acc1954a0394, udevadm verify also checks token
delimiters, which are not necessarily a matter of udev rules syntax,
but rather a question of style and readability.  Mention that in the
documentation to avoid confusion.

Suggested-by: Martin Wilck <mwilck@suse.com>
Complements: acc1954a0394 ("udev-rules: check token delimiters")
2023-05-30 10:13:04 +02:00
Zbigniew Jędrzejewski-Szmek
706a297cd7 man/analyze: drop paths from output examples
They are not useful for the user but make the examples
wider than necessary.
2023-05-30 10:11:04 +02:00
Zbigniew Jędrzejewski-Szmek
9140404a12 man/analyze: reword description of malloc and fix link 2023-05-30 10:11:02 +02:00
Zbigniew Jędrzejewski-Szmek
730ab2cc23 TEST-58: remove whitespace between redirection operator and its argument 2023-05-30 09:46:20 +02:00
Zbigniew Jędrzejewski-Szmek
1b6f8915f0 TEST-58: add echo calls to print what is happening
This makes it easier to identify the relevant test in the logs when
something fails.
2023-05-30 09:46:20 +02:00
Zbigniew Jędrzejewski-Szmek
dfb3ebfd60 TEST-58: create config files as root
There is really no reason to go out of our way to create the config files as
the unprivileged user. And in the logs, the runas calls are quite verbose,
distracting from the interesting stuff. Also add .defs/.imgs/.root to the
temporary paths to make them easier to distinguish in the logs.
2023-05-30 09:46:20 +02:00
Zbigniew Jędrzejewski-Szmek
b13d59243b test/README: fix advice for testsuite debugging
KERNEL_APPEND="systemd.unit=multi-user.target" is not very useful, because the
machine will still shut down as soon as the tests succeeds or fails. But
INTERACTIVE_DEBUG=1 works great, so let's simplify the instructions and
recommend that.
2023-05-30 09:46:20 +02:00
Russell Harmon
bcc1ee56c0 Support no-journal for dm-integrity devices.
As documented in integritysetup.8, dm-integrity devices support running
without a journal whatsoever. This change allows the
CRYPT_ACTIVATE_NO_JOURNAL flag (the same as is used with `integritysetup
--integrity-no-journal`) to be passed in during dmsetup by specifying
the `no-journal` option in integritytab.5.
2023-05-30 16:35:46 +09:00
Mike Yuan
dd3775ab88
Merge pull request #27687 from keszybz/boot-efi-choices
gpt-auto-generator: rework/simplify logic for picking /efi or /boot
2023-05-30 15:21:42 +08:00
James Hilliard
e4086f7dc9 bpf: test with GCC BPF compiler on opensuse 2023-05-30 13:30:28 +09:00
Frantisek Sumsal
e4ab2db9df home: move the assert back to the intended place
98d81cf974 moved the assertion at the beginning of home_dispatch_acquire(),
which is however before we even check for any ongoing operation, hence we
might hit it even in legitimate cases.

Let's move it back to after we check for any possibly ongoing operation, to
make it once again a safety check.

Follow-up to 98d81cf974.
Resolves: #22443 and #24036
2023-05-30 10:00:29 +09:00
James Hilliard
4a7a13b5a0 bpf: stabilize GCC BPF support
Now that we have a GCC release which should support our bpf programs
lets set the minimum version and stabilize it.
2023-05-30 09:27:56 +09:00
Zbigniew Jędrzejewski-Szmek
1d96dae716 dissect: implement the same logic as gpt-auto-generator
gpt-auto-generator does three checks: 1. whether the directory doesn't have
files, 2. whether it's not in fstab, and 3. whether it is not a mount point.
For dissect logic, 3. is not relevant, and it ignores 2.
But the check whether files exists was done only partially: it was done
for /efi, but not for /boot.

Two changes are made:
- the check whether /boot is empty is now done.
- for ESP, /boot is used in preference to /efi, if not used for XBOOTLDR.

With those changes, the logic in dissect matches what gpt-auto-generator does.
There are the two intentional differences described in the first paragraph,
2023-05-30 00:21:44 +02:00
Zbigniew Jędrzejewski-Szmek
6a488fa7cc gpt-auto-generator: rework/simplify logic for picking /efi or /boot
I started looking into https://github.com/uapi-group/specifications/issues/35.

BLS says:
> Otherwise [no existing XBOOTLDR partition], if on GPT and an ESP is found and
> it is large enough (let’s say at least 1G) it should be used as $BOOT and
> used as primary location to place boot loader menu resources in.

> It is recommended to mount $BOOT to /boot/, and the ESP to /efi/.

DPS says:
> The ESP used for the current boot is automatically mounted to /efi/ (or
> /boot/ as fallback), unless a different partition is mounted there (possibly
> via /etc/fstab, or because the Extended Boot Loader Partition — see below —
> exists) or the directory is non-empty on the root disk.

I don't think we want to mount the same partition in two places.
If the same partition is not mounted in two places, then the two specs are
contradictory.

The code in gpt-auto-generator implemented the logic from the DPS. It is
modified to implement the logic from BLS.

Effectively:
- if both /boot and /efi are available:
  - if both XBOOTLDR and ESP exist:
    ESP on /efi, XBOOTLDR on /boot
  - if only ESP exists:
    ESP on /boot
  - if only XBOOTLDR exists:
    XBOOTLDR on /boot
- if only /boot is available:
  - if XBOOTLDR exists:
    XBOOTLDR on /boot
  - if only ESP exists:
    ESP on /boot
- if only /efi is available:
  - if ESP exists:
    ESP on /efi

"Available" means that it the mount point is not mounted over and does not
contain files. If the directory doesn't exist, it is also "available" and will
be created later when the mount or automount unit is started.

Thus, the generator attempts to match the partitions and mount points to the
extent possible. In all cases, /boot is the primary place to install kernels.
ESP can be found on /boot or /efi, depending on the situation.

If this patch is merged, I'll submit fixes for BLS and DPS to describe the
same logic.
2023-05-29 22:53:08 +02:00
Zbigniew Jędrzejewski-Szmek
d2149f6c76 man/tmpfiles: add more man page citerefs
This was supposed to be part of 8fb350049bb7a7305589f201df9d37482e544f24, but
I forgot to save the file.
2023-05-29 12:12:45 +02:00
David Tardon
e30b4c1357 resolvectl: drop extra colon 2023-05-29 11:37:18 +09:00
Yu Watanabe
7b975e9f45 basic/syscall: update syscall list
Only notable change is that memfd_secret is now defined on s390(x).
2023-05-29 06:59:10 +08:00
Luca Boccassi
8340d5003d gpt/DPS: add more aliases for python's machine
In mkosi we set the default architecture to platform.machine() which
is again slightly incompatible for a few architectures, so add more
aliases, so that repart works by default with these names.
2023-05-28 18:33:31 +01:00
Yu Watanabe
80ec3db5c7 journalctl: fix --follow with non-matching filter
When there is no matching entry stored in journal, then initial call of
`sd_journal_previous()` following `sd_journal_seek_tail()` returns
zero, and does not move the read pointer.
In the main loop, on every journal event, we call `sd_journal_next()`,
even though the current location is tail, and it takes no effect.

In such a case, we need to call `sd_journal_previous()` instead of
`sd_journal_next()`.
2023-05-28 23:53:58 +09:00
Yu Watanabe
b78f9481bc sd-journal: introduce sd_journal_step_one()
After the commit 7a4ee861615101ddd2f95056cf30e69e41da86ce,
sd_journal_next() following sd_journal_seek_tail() takes no-op,
and we need to call sd_journal_previous(). This may be useful in
some cases, e.g. to fix the issue explained in the previous commit.
2023-05-28 23:53:18 +09:00
Yu Watanabe
fb35feae97 test: add testcase for 'journalctl --follow --cursor-file='
Also, add a FIXME comment to illustrate the issue uncovered after by
7a4ee861615101ddd2f95056cf30e69e41da86ce.
2023-05-28 14:52:32 +09:00
Yu Watanabe
24d633e438 journalctl: also update cursor with --follow
Fixes #26746.
2023-05-28 14:52:32 +09:00
Yu Watanabe
713342d9b0 journalctl: replace ppoll() loop with sd_event_loop()
No functional change, just refactoring.
2023-05-28 14:52:32 +09:00
Yu Watanabe
e4c4a9db87 journalctl: split out show()
No functional changes, just refactoring.
2023-05-28 14:52:32 +09:00
Yu Watanabe
8c12d3586a journalctl: split out update_cursor()
No functional change, just refactoring.
2023-05-28 14:52:32 +09:00
Yu Watanabe
2ce9a07b34 journalctl: split out action_list_fields()
No functional change, just refactoring.
2023-05-28 14:52:32 +09:00
Yu Watanabe
3f2203f64d journalctl: fix --no-tail handling
Fixes a bug introduced by 62f21ec91ad8e7e24079962f4df066b0094fe68d.
2023-05-28 14:52:32 +09:00
Yu Watanabe
20e933ae74 journalctl: use correct variable to check if --since is specified 2023-05-28 14:52:32 +09:00
Yu Watanabe
4f0165fd34 journalctl: always initialize global variables
That's not necessary, as they are initialized with zero, but for safety
and readability.
2023-05-28 14:52:32 +09:00
Piotr Drąg
059b1b31ad po: add a false positive to POTFILES.skip
Scripts used to detect files that should be in POTFILES.in, like
intltool-update -m used on https://l10n.gnome.org/module/systemd/,
falsely detect this file as containing translations. Avoid this
behavior by putting the file in POTFILES.skip.
2023-05-27 17:17:57 +01:00
Daan De Meyer
30868c1c8d tree-wide: Downgrade a few more noisy log messages to trace 2023-05-27 14:47:56 +02:00
Dan Streetman
b2efe28658 boot/measure: replace TPM PolicyPCR session with calculation
Instead of using a trial policy with a TPM to calculate the measurement hash,
this uses a function to calculate the hash with no TPM needed.
2023-05-27 08:50:04 +02:00
Yu Watanabe
9e39cb2855
Merge pull request #27721 from yuwata/journalctl-cleanup
journalctl: split get_boots() into three
2023-05-27 07:59:22 +09:00
Rene Hollander
58fa558ae4 Add DHCPServer information to JSON output.
Adds a new JSON object called DHCPServer for each interface that has a
DHCPServer configured. It has the following attributes:
- PoolSize and PoolOffset from the configuration
- List of offered leases
- List of static leases from the configuration
2023-05-27 07:58:12 +09:00
Frantisek Sumsal
837773add4 Revert "test: add test case for systemd-update-utmp vs daemon-reexec"
Temporarily revert the test case for #27167, as the additional
daemon-reexecs exacerbate #27287, making CIs fail quite often.
As the #27167 is also covered by TEST-01-BASIC itself, since we do
daemon-reexec there anyway, we shouldn't lose any coverage, but it
should make CIs more stable until #27287 is figured out.

Resolves (or more like works around): #27807

This reverts commit d689f70a2c18666bbf6500df7a53962a8f3e91a4.
2023-05-27 07:57:20 +09:00
Daan De Meyer
dcc5547b8b
Merge pull request #27517 from ddstreet/tpm2_calculate_policy
Tpm2 calculate policy
2023-05-26 23:08:15 +02:00
Yu Watanabe
e44f06065b journalctl: split get_boots() into three
Previously, get_boots() used for three ways; finding boot entry by
boot ID, finding boot entry by offset, listing up all boot IDs.

Let's split it into three for each usecase.

No functional change, just refactoring.
2023-05-27 03:57:39 +09:00
Yu Watanabe
c93d3c0512 logs-show: introduce add_match_boot_id() helper function 2023-05-27 03:57:01 +09:00