]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agologind: fix getting property OnExternalPower via D-Bus 24976/head
Michael Biebl [Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)] 
logind: fix getting property OnExternalPower via D-Bus

The BUS_DEFINE_PROPERTY_GET_GLOBAL macro requires a value as third
argument, so we need to call manager_is_on_external_power(). Otherwise
the function pointer is interpreted as a boolean and always returns
true:

```
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower
b true
$ /lib/systemd/systemd-ac-power  --verbose
no
```

Thanks: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021644

3 years agoMerge pull request #24784 from yuwata/core-exec-directory
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 07:37:16 +0000 (09:37 +0200)] 
Merge pull request #24784 from yuwata/core-exec-directory

core: do not create symlink to private directory if parent already exists

3 years agoMerge pull request #24970 from DaanDeMeyer/crypsetup-fix
Lennart Poettering [Wed, 12 Oct 2022 07:32:56 +0000 (09:32 +0200)] 
Merge pull request #24970 from DaanDeMeyer/crypsetup-fix

Cryptsetup compilation fixes

3 years agoMerge pull request #24867 from yuwata/sd-dhcp6-client-large-packet
Zbigniew Jędrzejewski-Szmek [Wed, 12 Oct 2022 07:18:07 +0000 (09:18 +0200)] 
Merge pull request #24867 from yuwata/sd-dhcp6-client-large-packet

sd-dhcp6-client: allow to build large packet

3 years agoMerge pull request #24957 from yuwata/network-ignore-failure-in-sending-solicitation
Luca Boccassi [Tue, 11 Oct 2022 19:58:26 +0000 (21:58 +0200)] 
Merge pull request #24957 from yuwata/network-ignore-failure-in-sending-solicitation

network: ignore failure in sending solicitation

3 years agoMerge pull request #24933 from keszybz/erradicate-strerror
Luca Boccassi [Tue, 11 Oct 2022 19:47:38 +0000 (21:47 +0200)] 
Merge pull request #24933 from keszybz/erradicate-strerror

Erradicate strerror

3 years agoMerge pull request #24968 from poettering/logs-show-timestamp-fix
Luca Boccassi [Tue, 11 Oct 2022 19:45:46 +0000 (21:45 +0200)] 
Merge pull request #24968 from poettering/logs-show-timestamp-fix

logs-show timestamp fix

3 years agologind: do not emit beep in wall messages
Zbigniew Jędrzejewski-Szmek [Tue, 11 Oct 2022 11:59:45 +0000 (13:59 +0200)] 
logind: do not emit beep in wall messages

Those may go via the PC speaker, which is annoying and unexpected.
Most people have it off, so this doesn't work reliably anyway, so we can
disable it without much loss.

Fixes #23520.

3 years agorepart: Always define VerityMode from/to string functions 24970/head
Daan De Meyer [Tue, 11 Oct 2022 18:36:03 +0000 (20:36 +0200)] 
repart: Always define VerityMode from/to string functions

3 years agocryptsetup-util: Always define dlopen_cryptsetup()
Daan De Meyer [Tue, 11 Oct 2022 18:35:34 +0000 (20:35 +0200)] 
cryptsetup-util: Always define dlopen_cryptsetup()

3 years agotree-wide: drop () around the first argument of a ternary op 24933/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 12:50:35 +0000 (14:50 +0200)] 
tree-wide: drop () around the first argument of a ternary op

https://github.com/systemd/systemd/pull/24933#discussion_r991242789

3 years agoman: use man7.org for strerror_r
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 09:00:57 +0000 (11:00 +0200)] 
man: use man7.org for strerror_r

3 years agoman: recommend strerror_r() over strerror()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 14:24:01 +0000 (16:24 +0200)] 
man: recommend strerror_r() over strerror()

Let's nudge people towards the use of an anonymous buffer like we
do internally.

"errno" → "errnum", to match the man page for strerror, and also to avoid
confusion with the global variable. In general, I think that errno is a
terrible interface and we shouldn't encourage people to use it. Those functions
use errno-style error numbers, which are a different thing.

3 years agoman: recommend %m over strerror()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 14:19:21 +0000 (16:19 +0200)] 
man: recommend %m over strerror()

The need to set errno is very very ugly, but at least it is thread-safe and
works correctly. Using strerror() is likely to be wrong, so let's not recommend
that. People who do a lot of logging would provide use some wrapper that sets
errno like we do, so nudge people towards %m.

I tested that all the separate .c files compile cleanly.

3 years agoman: use external .c files for three examples
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 07:18:26 +0000 (09:18 +0200)] 
man: use external .c files for three examples

This way it's much easier to test that the code compiles without issues.
It's also easier to edit the code.

Indentation in one of the examples is reduced to two spaces. This is what we
use in man pages to make them fit on screen better.

3 years agoGet rid of strerror_safe()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:59:34 +0000 (15:59 +0200)] 
Get rid of strerror_safe()

3 years agosd-bus: make bus_error_message() a thread-safe macro
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:56:25 +0000 (15:56 +0200)] 
sd-bus: make bus_error_message() a thread-safe macro

strerror_r() is used instead of strerror(). The usual trick is employed: we
allocate a buffer that lives until the end of the surrounding block to provide
the scratch space. This change is particularly important forn sd-bus and the
pam modules, which may be called from threaded code.

I checked the codebase, and we only use bus_error_message() in log statements,
so the returned pointer is not used beyond its valid lifetime.

3 years agocore: adjust log message
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:53:10 +0000 (15:53 +0200)] 
core: adjust log message

"umount startup job" is rather confusing. Let's say "unmount job", which should
be more meaningful for a user.

3 years agoanalyze: add forgotten return statement
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:52:33 +0000 (15:52 +0200)] 
analyze: add forgotten return statement

We would fail with an assert in sd_bus_message_enter_container() afterwards.

3 years agotree-wide: get rid of lgtm annotations
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 07:31:58 +0000 (09:31 +0200)] 
tree-wide: get rid of lgtm annotations

We now use CodeQL, and LGTM itself is gone. Those old annotations are not
useful for anythign now.

3 years agotree-wide: define and use STRERROR_OR_EOF()
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 19:19:43 +0000 (21:19 +0200)] 
tree-wide: define and use STRERROR_OR_EOF()

3 years agologs-show: be more careful when initializing get_dual_timestamp() return parameters 24968/head
Lennart Poettering [Tue, 11 Oct 2022 14:39:51 +0000 (16:39 +0200)] 
logs-show: be more careful when initializing get_dual_timestamp() return parameters

make sure we always have something to return in all return parameters,
including in the boot id return parameter, in all code paths.

Follow-up for: #24965

3 years agotree-wide: use STRERROR()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:28:05 +0000 (15:28 +0200)] 
tree-wide: use STRERROR()

3 years agosd-journal: exit loop once we got all fields we are interested in
Lennart Poettering [Tue, 11 Oct 2022 14:39:06 +0000 (16:39 +0200)] 
sd-journal: exit loop once we got all fields we are interested in

3 years agobasic: add STRERROR() wrapper for strerror_r()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 10:28:31 +0000 (12:28 +0200)] 
basic: add STRERROR() wrapper for strerror_r()

3 years agoshared/journal-importer: use %m instead of strerror()
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 07:18:26 +0000 (09:18 +0200)] 
shared/journal-importer: use %m instead of strerror()

Here SYNTHETIC_ERRNO() was used based on the general rule that logging
functions should do that when the error value is generated at the call
site. But here we're really propagating a memory allocation error, which
wasn't reported using errno, but the meaning is the same. And it's better
to bend the rule a bit like this than to use strerror().

3 years agocore,logind,systemctl,journald: replace calls to strerror() with setting errno + %m
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 07:15:44 +0000 (09:15 +0200)] 
core,logind,systemctl,journald: replace calls to strerror() with setting errno + %m

strerror() is not thread safe and calling it just isn't worth the effort
required to justify why it would be safe in those cases. It's easier to just
use %m which is thread-safe out of the box. I don't think that any of the
changes in the patch cause any functional difference. This is just about
getting rid of calls to strerror() in general.

When we print an error message and fail to format the string, using something
like "(null)" is good enough. This is very very unlikely to happen anyway.

3 years agobasic/stdio-util: allow xsprintf() to be used without any arguments
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 13:26:36 +0000 (15:26 +0200)] 
basic/stdio-util: allow xsprintf() to be used without any arguments

xsprintf(buf, "…: %m") would fail, now it works.

3 years agoanalyze: use the same error variable name as everywhere else
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 14:37:57 +0000 (16:37 +0200)] 
analyze: use the same error variable name as everywhere else

3 years agopam_systemd: use pam_syslog_pam_error()
Zbigniew Jędrzejewski-Szmek [Mon, 10 Oct 2022 12:59:50 +0000 (14:59 +0200)] 
pam_systemd: use pam_syslog_pam_error()

Error handling in acquire_user_record() was checking the wrong
condition (PAM errors are always >= 0, so r < 0 cannot match).

Apart from the fix for error handling, no change in behaviour is intended.
I did some minor adjustements to formatting and added _cleanup_ in one more
place.

3 years agopam_systemd_home: use pam_syslog_pam_error()
Zbigniew Jędrzejewski-Szmek [Tue, 11 Oct 2022 12:51:47 +0000 (14:51 +0200)] 
pam_systemd_home: use pam_syslog_pam_error()

The message in acquire_home() was looking at the wrong variable
('r' instead of 'acquired_fd').

Apart from that, no change in behaviour is intended.

3 years agoshared/pam-util: add pam_syslog_pam_error() wrapper
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 13:47:12 +0000 (15:47 +0200)] 
shared/pam-util: add pam_syslog_pam_error() wrapper

This is a primitive helper that wraps calls to pam_syslog() replacing
@PAMERR@ with pam_strerror() output in the format string. This allows for
a bunch of boilerplate to be removed.

@PAMERR@ is only supported at the end of the string. Similarly to %m,
realistically that's the only place where it is useful.

Note that unlike in logging functions in log.[ch], here the error value is
only used for the message and is not saved anywhere, so we don't need to
care about SYNTHETIC_ERRNO.

3 years agopam_systemd: use pam_syslog_errno()
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 12:29:53 +0000 (14:29 +0200)] 
pam_systemd: use pam_syslog_errno()

The debug message for "nice" is tweaked to show the level that was set.

Like in the two previous commits, the return code on error might be changed.

3 years agopam_systemd_home: use pam_syslog_errno()
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 12:25:02 +0000 (14:25 +0200)] 
pam_systemd_home: use pam_syslog_errno()

Like in the previous commit, the return code on error might be changed.

3 years agotest-journal-flush: Don't fail on EADDRNOTAVAIL
Daan De Meyer [Tue, 11 Oct 2022 12:01:04 +0000 (14:01 +0200)] 
test-journal-flush: Don't fail on EADDRNOTAVAIL

File corruption can cause EADDRNOTAVAIL errors. Let's not make these
fatal for the flush test.

3 years agomeson: Fix pcrphase unit conditions
Daan De Meyer [Mon, 10 Oct 2022 14:17:22 +0000 (16:17 +0200)] 
meson: Fix pcrphase unit conditions

3 years agologs-show: Always retrieve the boot ID from the entry
Daan De Meyer [Tue, 11 Oct 2022 11:26:41 +0000 (13:26 +0200)] 
logs-show: Always retrieve the boot ID from the entry

If _SOURCE_MONOTONIC_TIMESTAMP was set in the entry, we wouldn't
query the boot ID, leading to every kernel entry in the export mode
to have BOOT_ID=000000000000000. Let's fix this by always querying
the boot ID.

3 years agoupdate TODO
Lennart Poettering [Tue, 11 Oct 2022 13:06:16 +0000 (15:06 +0200)] 
update TODO

3 years agoMerge pull request #24629 from DaanDeMeyer/mkosi-kernel
Daan De Meyer [Tue, 11 Oct 2022 12:37:19 +0000 (14:37 +0200)] 
Merge pull request #24629 from DaanDeMeyer/mkosi-kernel

mkosi: Optionally build a kernel image from mkosi.kernel/

3 years agotest: add coverage for the nvme-subsystem
Frantisek Sumsal [Tue, 11 Oct 2022 07:54:35 +0000 (09:54 +0200)] 
test: add coverage for the nvme-subsystem

Specifically for:
  - https://github.com/systemd/systemd/pull/24748
  - https://github.com/systemd/systemd/pull/24766
  - https://github.com/systemd/systemd/pull/24946

3 years agosd-radv: mention that failures in sending RA are ignored 24957/head
Yu Watanabe [Tue, 11 Oct 2022 07:22:35 +0000 (16:22 +0900)] 
sd-radv: mention that failures in sending RA are ignored

3 years agosd-ndisc: ignore failure in sending solicitation
Yu Watanabe [Tue, 11 Oct 2022 07:19:12 +0000 (16:19 +0900)] 
sd-ndisc: ignore failure in sending solicitation

Even if a bonding master interface has carrier, the underlying slave
interfaces may not. In such a case, sending solicitation fails with
-ENOBUS. Here, let's unconditionally ignore errors, as anyway we will
send a solicitation later.

Fixes #24717.

3 years agoudev: add one more assertion
Yu Watanabe [Mon, 10 Oct 2022 15:42:44 +0000 (00:42 +0900)] 
udev: add one more assertion

Follow-up for 6209bbbd4b1c9ed2886028ab2ee3df0a7d0e2494.

3 years agocoredumpctl: Add support for the --root option (after merge fixes)
Richard Phibel [Mon, 10 Oct 2022 13:40:02 +0000 (15:40 +0200)] 
coredumpctl: Add support for the --root option (after merge fixes)

3 years agotree-wide: add ERRNO_IS_XATTR_ABSENT() helper
Lennart Poettering [Mon, 10 Oct 2022 09:06:56 +0000 (11:06 +0200)] 
tree-wide: add ERRNO_IS_XATTR_ABSENT() helper

We check the same list of error codes on various xattr operations, and
we should on some more. Add a common helper for this purpose.

3 years agomkosi: update to latest commit
Luca Boccassi [Mon, 10 Oct 2022 11:00:46 +0000 (12:00 +0100)] 
mkosi: update to latest commit

Require dto fix Debian testing/unstable builds, as the initrd is
versioned

3 years agoNEWS: make clear we talk about *system* credentials here
Lennart Poettering [Mon, 10 Oct 2022 10:42:21 +0000 (12:42 +0200)] 
NEWS: make clear we talk about *system* credentials here

The new conditoins are placed inside of services, but they cannot be
used to test service creds, but only system creds. This deserves
explicit mention, since it might be confusing otherwise.

Reverts a small part of 02380e19467cc2761fcea59c199379a8e1d801b9

3 years agoMerge pull request #24654 from fbuihuu/mount_followup_for_pr_19983
Yu Watanabe [Mon, 10 Oct 2022 10:13:22 +0000 (19:13 +0900)] 
Merge pull request #24654 from fbuihuu/mount_followup_for_pr_19983

Mount followup for pr 23367

3 years agoMerge pull request #24595 from rphibel/support-image-option-in-systemctl-and-coredumpctl
Daan De Meyer [Mon, 10 Oct 2022 09:35:20 +0000 (11:35 +0200)] 
Merge pull request #24595 from rphibel/support-image-option-in-systemctl-and-coredumpctl

systemctl/coredumpctl: add support for --root and --image options

3 years agoudev: drop assertion which is always false
Yu Watanabe [Mon, 10 Oct 2022 05:20:33 +0000 (14:20 +0900)] 
udev: drop assertion which is always false

Fixes a bug introduced by 67c3e1f63a5221b47a8fea85ae421671f29f3b7e.

Fixes #24945.

3 years agoshared/pam-util: add pam_syslog_errno() wrapper that sets errno
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 12:19:12 +0000 (14:19 +0200)] 
shared/pam-util: add pam_syslog_errno() wrapper that sets errno

So far our pam code was using strerror_safe(). But that's not a good approach,
because strerror_safe() is not thread-safe, and the pam code is "library code"
that should be thread-safe. In fact, the whole effort to use strerror() is
unnecessary, because pam_syslog() is documented to support %m. The
implementation in linux-pam simply uses vasprintf(). If we use %m too, we get
rid of the issue. The wrapper sets errno temporarily from the argument.

Apparently some PAM consumers run multiple PAM stacks in threads, so we should
avoid non-thread-safe code.

The new helper returns PAM_BUF_ERR for ENOMEM, and PAM_SERVICE_ERR in other
cases. This may change the returned code in some cases, but I think a) it
doesn't matter much, b) it's probably for the better. E.g. we might now return
PAM_SERVICE_ERR if the dbus message is borked, and PAM_SERVICE_ERR seems
appropriate.

3 years agobasic/errno-util: add helper to protect and set errno in one step
Zbigniew Jędrzejewski-Szmek [Thu, 6 Oct 2022 12:41:50 +0000 (14:41 +0200)] 
basic/errno-util: add helper to protect and set errno in one step

This pattern is used in a few places. Those are changed in this patch.
Subsequent patches will add more.

3 years agomeson: Fix build with --optimization=plain
Jan Janssen [Sun, 9 Oct 2022 15:16:12 +0000 (17:16 +0200)] 
meson: Fix build with --optimization=plain

Note that -O0 is deliberately filtered out as we have to compile with at
least -O1 due to #24202.

Fixes: #24323
3 years agoNEWS: fix typos and reword things
Zbigniew Jędrzejewski-Szmek [Sun, 9 Oct 2022 15:16:42 +0000 (17:16 +0200)] 
NEWS: fix typos and reword things

In particular, 'system/service credentials' are now described as simply
'credentials'. The selling point of credentials is that they are transparently
propagated from the system to services, so distinguishing between system and
service credentials is not important.

The description of ordering against initrd-switch-root.target is completely
rewritten. The old description was confused.

I think the description of systemd-measure should be reworked to clearly
describe what new functionality is provided and what policy changes are
built on top. But I don't qrok the details, so I left this part unchanged.

3 years agoman: use a list for description of ConditionFirmware=
Zbigniew Jędrzejewski-Szmek [Sun, 9 Oct 2022 14:18:30 +0000 (16:18 +0200)] 
man: use a list for description of ConditionFirmware=

Also reduce confusion of <replaceable> and <literal> and reword things for
legibility a bit.

3 years agoTODO: fix typo
Yu Watanabe [Sat, 8 Oct 2022 06:09:53 +0000 (15:09 +0900)] 
TODO: fix typo

3 years agoNEWS: fix typo
Yu Watanabe [Sat, 8 Oct 2022 06:09:47 +0000 (15:09 +0900)] 
NEWS: fix typo

3 years agoNEWS: drop reverted feature for networkd
Yu Watanabe [Sat, 8 Oct 2022 06:09:33 +0000 (15:09 +0900)] 
NEWS: drop reverted feature for networkd

3 years agoRevert "journal: Add --convert= command to journalctl"
Daan De Meyer [Fri, 7 Oct 2022 16:14:16 +0000 (18:14 +0200)] 
Revert "journal: Add --convert= command to journalctl"

This reverts commit 721620e8a32907ffe546a582c5ac7136b6367510.

This commit was accidentally merged as part of #22998

3 years agofuzz: shorten name of fuzz test case
Zbigniew Jędrzejewski-Szmek [Fri, 7 Oct 2022 16:32:08 +0000 (18:32 +0200)] 
fuzz: shorten name of fuzz test case

Wide fuzzer case names make meson test output very wide…

3 years agoupdate NEWS for v250-rc1
Lennart Poettering [Fri, 7 Oct 2022 16:10:24 +0000 (18:10 +0200)] 
update NEWS for v250-rc1

3 years agoman/shutdown: document how to switch to single-user mode
anarcat [Thu, 6 Oct 2022 14:20:39 +0000 (10:20 -0400)] 
man/shutdown: document how to switch to single-user mode

Before Debian switched to systemd, `shutdown now` would reset the system into
single user mode, doing roughly the equivalent of `telinit 1`.

Now, systemd's `shutdown` command does not behave that way; it defaults to
`poweroff` which might be confusing for users (like me) used to the previous
method.

Because I don't use the command often, I keep being stumped by this behavior,
and every time I look at the `shutdown(1)` manpage, I don't understand why I
can't find what I am looking for. This patch should make sure that people like
me find their way back to some sort of reason.

Maybe the *proper* way to fix this would be to restore the more classic
behavior, but I'm definitely not going to climb that hill. Besides, I clearly
remember the time I found out about the `shutdown` command and was *really*
confused when it brought me back to a command-line prompt. That was really
counter-intuitive and I find that change to actually be a good thing. So I'm
not proposing to change this behavior, merely document it better.

I originally added this to the `-P` option but it was suggested adding a new
`COMPATIBILITY` section instead, where other such issues could be added.

The `COMPATIBILITY` section is not actually officially documented. `man(1)`
talks about a `CONFORMING TO` section, but `shutdown(1)` is not
POSIX (`shutdown(2)` is, of course), so there's no actual standard on how this
should work.

The other option I considered was to add a `BUGS` section, but that seemed to
inflammatory, and definitely counter-productive.

3 years agoFinalize changelog for v252-rc2 v252-rc1
Luca Boccassi [Fri, 7 Oct 2022 15:09:32 +0000 (17:09 +0200)] 
Finalize changelog for v252-rc2

3 years agomeson: bump numbers for v252-rc1
Luca Boccassi [Fri, 7 Oct 2022 12:08:16 +0000 (14:08 +0200)] 
meson: bump numbers for v252-rc1

3 years agoEnable PR template for RC phase
Luca Boccassi [Fri, 7 Oct 2022 12:09:07 +0000 (14:09 +0200)] 
Enable PR template for RC phase

3 years agoImplement --luks-sector-size for homed
Aidan Dang [Sun, 25 Sep 2022 14:12:10 +0000 (00:12 +1000)] 
Implement --luks-sector-size for homed

3 years agobasic/log: include the log syntax callback in the errno protection block
Zbigniew Jędrzejewski-Szmek [Thu, 6 Oct 2022 11:07:49 +0000 (13:07 +0200)] 
basic/log: include the log syntax callback in the errno protection block

In general, log_syntax_internal() must keep errno unchanged. But the
call to log_syntax_callback() was added outside of the block protected
by PROTECT_ERRNO.

3 years agopam_systemd_home: inline loop variable declaration
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 12:14:13 +0000 (14:14 +0200)] 
pam_systemd_home: inline loop variable declaration

3 years agosd-bus: decrease indentation
Zbigniew Jędrzejewski-Szmek [Tue, 4 Oct 2022 10:37:49 +0000 (12:37 +0200)] 
sd-bus: decrease indentation

3 years agoMerge pull request #22998 from DaanDeMeyer/journal-compact-split
Luca Boccassi [Fri, 7 Oct 2022 14:19:03 +0000 (16:19 +0200)] 
Merge pull request #22998 from DaanDeMeyer/journal-compact-split

journal: Add compact mode

3 years agojournal: Add --convert= command to journalctl 22998/head
Daan De Meyer [Thu, 29 Sep 2022 10:07:54 +0000 (12:07 +0200)] 
journal: Add --convert= command to journalctl

--convert writes the journal files read by journalctl to the given
location. The location should be specified as a full journal file
path (e.g. /a/b/c/converted.journal). The directory specifies where
the converted journal files will be stored. The filename specifies
the naming convention the converted journal files will follow.

3 years agojournal: Store offsets to tail entry array objects in chain
Daan De Meyer [Fri, 21 Jan 2022 18:29:41 +0000 (18:29 +0000)] 
journal: Store offsets to tail entry array objects in chain

Previously, we'd iterate an entry array from start to end every time
we added an entry offset to it. To speed up this operation, we cache
the last entry array in the chain and how many items it contains.
This allows the addition of an entry to the chain to be done in
constant time instead of linear time as we don't have to iterate
the entire chain anymore every time we add an entry.

3 years agojournal: Introduce journal_file_data_payload()
Daan De Meyer [Thu, 29 Sep 2022 10:09:09 +0000 (12:09 +0200)] 
journal: Introduce journal_file_data_payload()

journal_file_data_payload() retrieves the payload of a Data object,
optionally decompressing it and checking to see if matches a given
field. This function replaces all the decompression code in the sd-journal
codebase with a single function.

This commit should not introduce any changes in sd-journal behavior.

3 years agojournal: Use 32-bit entry item object offsets in compact mode
Daan De Meyer [Tue, 2 Nov 2021 20:50:39 +0000 (20:50 +0000)] 
journal: Use 32-bit entry item object offsets in compact mode

To do this, we move EntryItem out of journal-def.h and turn it into
a host only struct in native endian mode so we can still use it to
ship the necessary info around.

Aside from that, the changes are pretty simple, we introduce some
extra functions to access the right field depending on the mode and
convert all the other code to use those functions instead of
accessing the raw fields.

We also drop the unused entry item hash field in compact mode. We
already stopped doing anything with this field a while ago, now we
actually drop it from the format in compact mode.

3 years agojournal: Use 32-bit entry array offsets in compact mode
Daan De Meyer [Sat, 23 Oct 2021 21:36:47 +0000 (22:36 +0100)] 
journal: Use 32-bit entry array offsets in compact mode

Before:

OBJECT TYPE      ENTRIES SIZE
Unused           0       0B
Data             3610336 595.7M
Field            5310    285.2K
Entry            3498326 1.2G
Data Hash Table  29  103.1M
Field Hash Table 29      151.3K
Entry Array      605991  1011.6M
Tag              0  0B
Total            7720021 2.9G

After:

OBJECT TYPE      ENTRIES SIZE
Unused           0  0B
Data             3562667 591.0M
Field            3971    213.6K
Entry            3498566 1.2G
Data Hash Table  20  71.1M
Field Hash Table 20  104.3K
Entry Array  582647  505.0M
Tag              0  0B
Total            7647891 2.4G

3 years agojournal: Don't allocate objects above UINT32_MAX in compact mode
Daan De Meyer [Wed, 3 Nov 2021 14:37:55 +0000 (14:37 +0000)] 
journal: Don't allocate objects above UINT32_MAX in compact mode

To allow storing offsets as 32-bit, we should never allocate objects
outside of the 32-bit range.

3 years agojournal: Run unit tests with and without compact mode enabled
Daan De Meyer [Fri, 21 Jan 2022 15:19:26 +0000 (15:19 +0000)] 
journal: Run unit tests with and without compact mode enabled

3 years agoMerge pull request #24930 from yuwata/network-drop-ndisc-vacuum
Yu Watanabe [Fri, 7 Oct 2022 09:38:34 +0000 (18:38 +0900)] 
Merge pull request #24930 from yuwata/network-drop-ndisc-vacuum

network: further follow-ups for recent NDisc PRs

3 years agoMerge pull request #24931 from bluca/news
Yu Watanabe [Fri, 7 Oct 2022 09:38:18 +0000 (18:38 +0900)] 
Merge pull request #24931 from bluca/news

hwdb and NEWS

3 years agojournal: Enable compact mode
Daan De Meyer [Sat, 23 Oct 2021 21:43:00 +0000 (22:43 +0100)] 
journal: Enable compact mode

We also add an environment variable $SYSTEMD_JOURNAL_COMPACT that
can be used to disable compact mode if needed (similar to
$SYSTEMD_JOURNAL_KEYED_HASH).

3 years agojournal: Add compact mode
Daan De Meyer [Sat, 23 Oct 2021 21:24:56 +0000 (22:24 +0100)] 
journal: Add compact mode

This adds a new flag in preparation for incompatible journal changes
which will be gated behind this flag. The max file size of journal
files in compact mode is limited to 4 GiB.

3 years agoUpdate hwdb 24931/head
Luca Boccassi [Fri, 7 Oct 2022 08:29:27 +0000 (10:29 +0200)] 
Update hwdb

ninja -C build update-hwdb

3 years agoNEWS: list contributors
Luca Boccassi [Fri, 7 Oct 2022 08:14:50 +0000 (10:14 +0200)] 
NEWS: list contributors

3 years agoNEWS: typos
Luca Boccassi [Fri, 7 Oct 2022 08:13:39 +0000 (10:13 +0200)] 
NEWS: typos

3 years agonetwork: free timer event source for NDisc when link is freed 24930/head
Yu Watanabe [Fri, 7 Oct 2022 05:32:10 +0000 (14:32 +0900)] 
network: free timer event source for NDisc when link is freed

Though, it should be already freed already freed in link_stop_engines()
-> ndisc_stop(). Just for safety.

3 years agonetwork: drop unnecessary call of ndisc_vacuum()
Yu Watanabe [Fri, 7 Oct 2022 05:17:13 +0000 (14:17 +0900)] 
network: drop unnecessary call of ndisc_vacuum()

After the commit 773024685b37170395a11716f8e4ad99d3580455, DNS servers
or domains are dropped when their lifefime become zero. Hence, it is not
necessary to try to them when writing state file.

Of course, because of the accuracy of the timer event source or priority
of event sources, a possibility is introduced that a DNS server or domain
with zero lifetime is stored in the state file. However, such entry will
be dropped soon when the timer event source is triggered. Hence, that
should not cause any real issues.

3 years agoMerge pull request #24511 from martinetd/bpf1
Zbigniew Jędrzejewski-Szmek [Thu, 6 Oct 2022 17:01:33 +0000 (19:01 +0200)] 
Merge pull request #24511 from martinetd/bpf1

libbpf: Add libbpf 1.0.0 compat

3 years agorepart: always honour `--discard=no`
Arnaud Ferraris [Tue, 4 Oct 2022 16:52:33 +0000 (18:52 +0200)] 
repart: always honour `--discard=no`

Currently, even if `--discard=no` is passed to `systemd-repart`, the
`context_discard_gap_after()` function still runs normally, discarding
e.g. all blocks between the GPT and the start of the first partition.

This can lead to issues on some embedded devices, where this space
holds the bootloader and shouldn't be modified (creating a protective
partition there is not always possible due to the specifics of the boot
process of some ARM-based SoC's).

This commit ensures passing `--discard=no` would be enough to ensure
the bootloader isn't wiped in such cases.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@gmail.com>
3 years agomeson: Require TPM2 for measuring utilities
Michal Koutný [Thu, 6 Oct 2022 09:59:58 +0000 (11:59 +0200)] 
meson: Require TPM2 for measuring utilities

I happened to run build with openssl but no tpm2 and ran into issues
like:

        [313/1382] Compiling C object systemd-measure.p/src_boot_measure.c.o
        FAILED: systemd-measure.p/src_boot_measure.c.o
        cc -Isystemd-measure.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -fno-omit-frame-pointer -Werror=shadow -include config.h -DOPENSSL_LOAD_CONF -MD -MQ systemd-measure.p/src_boot_measure.c.o -MF systemd-measure.p/src_boot_measure.c.o.d -o systemd-measure.p/src_boot_measure.c.o -c ../src/boot/measure.c
        ../src/boot/measure.c: In function ‘verb_sign’:
        ../src/boot/measure.c:710:48: error: variable ‘c’ has initializer but incomplete type
          710 |         _cleanup_(tpm2_context_destroy) struct tpm2_context c = {};

        [308/1382] Compiling C object systemd-pcrphase.p/src_boot_pcrphase.c.o
        FAILED: systemd-pcrphase.p/src_boot_pcrphase.c.o
        cc -Isystemd-pcrphase.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -fno-omit-frame-pointer -Werror=shadow -include config.h -DOPENSSL_LOAD_CONF -MD -MQ systemd-pcrphase.p/src_boot_pcrphase.c.o -MF systemd-pcrphase.p/src_boot_pcrphase.c.o.d -o systemd-pcrphase.p/src_boot_pcrphase.c.o -c ../src/boot/pcrphase.c
        ../src/boot/pcrphase.c: In function ‘determine_banks’:
        ../src/boot/pcrphase.c:117:24: error: unknown type name ‘TPMI_ALG_HASH’
          117 |         _cleanup_free_ TPMI_ALG_HASH *algs = NULL;

Guarding the utilites with HAVE_TPM2 fixes the issue for me.

This complements #24811.

3 years agolibbpf: add compat helpers for libbpf down to 0.1.0 24511/head
Dominique Martinet [Fri, 30 Sep 2022 10:25:18 +0000 (19:25 +0900)] 
libbpf: add compat helpers for libbpf down to 0.1.0

- new symbols are available from libbpf 0.6.0 so could be used with
libbpf.so.0, but we're sure the old symbols will be there and this
simplifies code
- detection at runtime should always work, regardless of whether systemd
has been compiled with older or newer libbpf and runs with older or newer
libbpf

3 years agoFix key toggle touchpad and programmable buttom for Positivo N14
drosdeck [Wed, 5 Oct 2022 19:48:32 +0000 (15:48 -0400)] 
Fix key toggle touchpad and programmable buttom for Positivo N14

3 years agoata_id: Fixed getting Response Code from SCSI Sense Data (#24921)
Aleksey Vasenev [Wed, 5 Oct 2022 19:33:53 +0000 (22:33 +0300)] 
ata_id: Fixed getting Response Code from SCSI Sense Data (#24921)

The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.

3 years agoTry to load libbpf.so.1 as well
Daan De Meyer [Fri, 9 Sep 2022 08:38:03 +0000 (10:38 +0200)] 
Try to load libbpf.so.1 as well

libbpf had a soname bump. Our usage of libbpf is compatible with
both libbpf.so.0 and libbpf.so.1, so let's try to load from both.

3 years agolibbpf: Remove use of deprecated APIs
Daan De Meyer [Wed, 31 Aug 2022 09:59:52 +0000 (11:59 +0200)] 
libbpf: Remove use of deprecated APIs

3 years agoBump libbpf version to 0.7
Daan De Meyer [Fri, 9 Sep 2022 08:27:57 +0000 (10:27 +0200)] 
Bump libbpf version to 0.7

We already depend on the skeleton APIs introduced in libbpf 0.7 so
let's bump our minimum version to reflect that.

We don't enforce bpf compilation on mkosi anymore since not all
distros have sufficiently up-to-date libbpf available.

3 years agotest: configure ldconfig's cache in the minimal verity images
Frantisek Sumsal [Wed, 5 Oct 2022 13:26:16 +0000 (15:26 +0200)] 
test: configure ldconfig's cache in the minimal verity images

The glibc stuff on ppc64le C8S is a little bit wild, as there are two
versions:

```
$ ldconfig -p | grep libc.so
        libc.so.6 (libc6,64bit, hwcap: "power9", OS ABI: Linux 3.10.0) => /lib64/glibc-hwcaps/power9/libc-2.28.so
        libc.so.6 (libc6,64bit, OS ABI: Linux 3.10.0) => /lib64/libc.so.6
```

and with `/etc/ld.so.cache` present all binaries use the first one:

```
$ ldd /bin/cat
        linux-vdso64.so.1 (0x00007fffa8070000)
        libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffa7e20000)
        /lib64/ld64.so.2 (0x00007fffa8090000)
```

However, without the cache the binaries will fall back to `/lib64/libc.so.6`
which breaks tests that use the minimal verity images (like TEST-29),
because we install only the first version (that's shown by `ldd` at
the time the images are created):

```
[   91.595343] testsuite-29.sh[747]: + portablectl --profile=trusted attach --now --runtime /usr/share/minimal_0.raw minimal-app0
         Starting systemd-portabled.service...
[  OK  ] Started systemd-portabled.service.
         Starting minimal-app0-foo.service...
         Starting minimal-app0.service...
[  104.432217] cat[858]: cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[  104.435080] cat[857]: cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[FAILED] Failed to start minimal-app0.service.
See 'systemctl status minimal-app0.service' for details.
```

```
$ chroot /var/tmp/systemd-test.nMHPfc/minimal/
/bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
```

With the ldconfig's cache it seems to work as expected:
```
$ chroot /var/tmp/systemd-test.gVtYLg/minimal
bash-4.4# cat --version
cat (GNU coreutils) 8.30
...
```

3 years agomount: replace UNIT_DEPENDENCY_MOUNTINFO_OR_FILE with UNIT_DEPENDENCY_MOUNTINFO/UNIT_... 24654/head
Franck Bui [Mon, 12 Sep 2022 15:54:22 +0000 (17:54 +0200)] 
mount: replace UNIT_DEPENDENCY_MOUNTINFO_OR_FILE with UNIT_DEPENDENCY_MOUNTINFO/UNIT_DEPENDENCY_MOUNT_FILE

UNIT_DEPENDENCY_MOUNTINFO_OR_FILE was a bit strange as unlike the other flags
we don't know where the dependency came from exactly. Indeed its origin could
have been from the mount unit file or from /proc/self/mountinfo.

Instead this patch replaces UNIT_DEPENDENCY_MOUNTINFO_OR_FILE with 2 new
dependency flags: UNIT_DEPENDENCY_MOUNT_FILE and UNIT_DEPENDENCY_MOUNTINFO. The
former indicates that the dep is created from the unit file but unlike
UNIT_DEPENDENCY_FILE, it will be replaced by a dep with the
UNIT_DEPENDENCY_MOUNTINFO flag as soon as the kernel will make the mount
available in /proc/self/mountinfo.

3 years agomount: drop UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT and UNIT_DEPENDENCY_MOUNTINFO_DEFAULT
Franck Bui [Mon, 12 Sep 2022 15:50:51 +0000 (17:50 +0200)] 
mount: drop UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT and UNIT_DEPENDENCY_MOUNTINFO_DEFAULT

They're not used anymore.

3 years agomount: always use UNIT_DEPENDENCY_FILE in mount_add_quota_dependencies()
Franck Bui [Wed, 5 Oct 2022 08:26:59 +0000 (10:26 +0200)] 
mount: always use UNIT_DEPENDENCY_FILE in mount_add_quota_dependencies()

The quota options have always been read from the unit file and ignored if only
present in /proc/self/mountinfo. IOW the quota services are not (automagically)
pulled in for mounts initiated by the user running mount(8).

3 years agoMerge pull request #24877 from brauner/namespace_utils
Luca Boccassi [Tue, 4 Oct 2022 20:59:48 +0000 (21:59 +0100)] 
Merge pull request #24877 from brauner/namespace_utils

namespace-util: add an initial set of tweaks