]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
19 months agoMerge pull request #26499 from mrc0mmand/assorted-tweaks
Yu Watanabe [Mon, 20 Feb 2023 20:55:37 +0000 (05:55 +0900)] 
Merge pull request #26499 from mrc0mmand/assorted-tweaks

A couple of test tweaks for recent CI fails

19 months agoukify: Set fast_load option when parsing PE files
Daan De Meyer [Mon, 20 Feb 2023 13:45:19 +0000 (14:45 +0100)] 
ukify: Set fast_load option when parsing PE files

Let's skip parsing of some irrelevant information that we don't use
to speed up building UKIs with large initrds from +-15s to less than
1s.

19 months agoMerge pull request #26508 from poettering/cap-fixes
Lennart Poettering [Mon, 20 Feb 2023 18:04:13 +0000 (19:04 +0100)] 
Merge pull request #26508 from poettering/cap-fixes

various fixes to capability handling

19 months agocapability-util: use UINT32_MAX as shortcut where appropriatea 26508/head
Lennart Poettering [Mon, 20 Feb 2023 15:26:46 +0000 (16:26 +0100)] 
capability-util: use UINT32_MAX as shortcut where appropriatea

19 months agocapability-util: add macro for largest cap we're willing to accept
Lennart Poettering [Mon, 20 Feb 2023 15:21:25 +0000 (16:21 +0100)] 
capability-util: add macro for largest cap we're willing to accept

Let's hide the hard to grasp 62 behind a name.

19 months agocapability-util: add CAP_MASK_ALL + CAP_MASK_UNSET macros
Lennart Poettering [Mon, 20 Feb 2023 11:53:26 +0000 (12:53 +0100)] 
capability-util: add CAP_MASK_ALL + CAP_MASK_UNSET macros

We should be more careful with distinguishing the cases "all bits set in
caps mask" from "cap mask invalid". We so far mostly used UINT64_MAX for
both, which is not correct though (as it would mean
AmbientCapabilities=~0 followed by AmbientCapabilities=0) would result
in capability 63 to be set (which we don't really allow, since that
means unset).

19 months agocap-list: make sure never to accidentally return more than 63 caps
Lennart Poettering [Mon, 20 Feb 2023 10:30:56 +0000 (11:30 +0100)] 
cap-list: make sure never to accidentally return more than 63 caps

The rest of our codebase stores caps masks in a uint64_t, and also
assumes UINT64_MAX was a suitable value for "unset mask". Hence refuse
any caps outside of 0…62.

(right now the kernel knows 40 caps, hence 22 more to go before we have
to reconsider our life's choices.)

19 months agocap-list: rework capability_set_to_string()
Lennart Poettering [Mon, 20 Feb 2023 10:45:07 +0000 (11:45 +0100)] 
cap-list: rework capability_set_to_string()

Let's use strextend_with_separator() and CAPABILITY_TO_STRING().

19 months agocap-list: add CAPABILITY_TO_STRING() macro using compound initialization to allocate...
Lennart Poettering [Mon, 20 Feb 2023 10:43:13 +0000 (11:43 +0100)] 
cap-list: add CAPABILITY_TO_STRING() macro using compound initialization to allocate fallback buffer

Let's add a helper that can return a numeric string in case we don't
recognize a name for a capability.

19 months agocap-list: refuse parsing numeric capability 63
Lennart Poettering [Mon, 20 Feb 2023 11:26:46 +0000 (12:26 +0100)] 
cap-list: refuse parsing numeric capability 63

We refuse it otherwise currently, simply because we cannot store it in a
uint64_t caps mask value anymore while retaining the ability to use
UINT64_MAX as "unset" marker.

The check actually was in place already, just one off.

19 months agocap-list: modernize capability_set_from_string() a bit
Lennart Poettering [Mon, 20 Feb 2023 11:25:44 +0000 (12:25 +0100)] 
cap-list: modernize capability_set_from_string() a bit

Make return parameter optional. And return whether there were any caps
we didn't recognize via 0/1 return value.

19 months agocap-list: rename capability_set_to_string_alloc() → capability_set_to_string()
Lennart Poettering [Mon, 20 Feb 2023 10:33:48 +0000 (11:33 +0100)] 
cap-list: rename capability_set_to_string_alloc() → capability_set_to_string()

We typically don't use the _alloc() suffix anymore for anything, hence
drop it here too.

19 months agoMerge pull request #26437 from DaanDeMeyer/repart-exclude
Daan De Meyer [Mon, 20 Feb 2023 14:49:29 +0000 (15:49 +0100)] 
Merge pull request #26437 from DaanDeMeyer/repart-exclude

repart: Add ExcludeFiles= option

19 months agoman: document DefaultStartupMemoryLow=
Luca Boccassi [Mon, 20 Feb 2023 12:52:33 +0000 (12:52 +0000)] 
man: document DefaultStartupMemoryLow=

Fixes https://github.com/systemd/systemd/issues/26493

19 months agoMerge pull request #26465 from DaanDeMeyer/openat-helpers
Daan De Meyer [Mon, 20 Feb 2023 12:58:59 +0000 (13:58 +0100)] 
Merge pull request #26465 from DaanDeMeyer/openat-helpers

Add more openat() helpers of utility functions

19 months agorepart: Add ExcludeFiles= option 26437/head
Daan De Meyer [Thu, 16 Feb 2023 12:23:47 +0000 (13:23 +0100)] 
repart: Add ExcludeFiles= option

19 months agosmack-util: Add renameat_and_apply_smack_floor_label() 26465/head
Daan De Meyer [Thu, 22 Dec 2022 13:28:27 +0000 (14:28 +0100)] 
smack-util: Add renameat_and_apply_smack_floor_label()

Also add mac_smack_apply_at() as its a requirement for
renameat_and_apply_smack_floor_label().

19 months agotmpfile-util-label: Add fopen_temporary_at_label()
Daan De Meyer [Thu, 22 Dec 2022 13:27:57 +0000 (14:27 +0100)] 
tmpfile-util-label: Add fopen_temporary_at_label()

19 months agocopy: Add copy_file_at()
Daan De Meyer [Thu, 22 Dec 2022 13:27:26 +0000 (14:27 +0100)] 
copy: Add copy_file_at()

19 months agoenv-file: Add write_env_file_at()
Daan De Meyer [Thu, 22 Dec 2022 13:26:29 +0000 (14:26 +0100)] 
env-file: Add write_env_file_at()

19 months agoudev-node: make stack_directory_read_one() accept NULL for devnode
Yu Watanabe [Mon, 20 Feb 2023 05:43:58 +0000 (14:43 +0900)] 
udev-node: make stack_directory_read_one() accept NULL for devnode

No functional change, as currently the function is always called with
non-NULL argument. Just a preparation for #26048 or #25839.

19 months agoMerge pull request #26479 from yuwata/exec-util-misc
Lennart Poettering [Mon, 20 Feb 2023 10:17:58 +0000 (11:17 +0100)] 
Merge pull request #26479 from yuwata/exec-util-misc

exec-util: several cleanups

19 months agoudev-node: drop unnecessary initialization
Yu Watanabe [Sat, 18 Feb 2023 22:15:02 +0000 (07:15 +0900)] 
udev-node: drop unnecessary initialization

The priority of device node symlink can be negative. So the
initialization is confusing.

Fortunately, this changes no functionality, as we only compare the
priorities of symlinks only when we parsed at least one device node and
its priority.

19 months agotest: ignore missing coverage in TEST-78 26499/head
Frantisek Sumsal [Mon, 20 Feb 2023 09:50:06 +0000 (10:50 +0100)] 
test: ignore missing coverage in TEST-78

gcov is incompatible with DynamicUser=true without additional tweaks, so
let's ignore its complaints in this test, as working around it is not
worth it (in this case).

19 months agotest: disable pipefail when testing interactive firstboot
Frantisek Sumsal [Wed, 1 Feb 2023 12:54:21 +0000 (13:54 +0100)] 
test: disable pipefail when testing interactive firstboot

Otherwise we might get unexpected test fails due to SIGPIPE:

```
[   14.334917] testsuite-74.sh[565]: + grep -q '^root:.*:0:0:.*:/bin/fooshell$' test-root/etc/passwd
[   14.335670] testsuite-74.sh[681]: + systemd-firstboot --root=test-root --prompt-root-shell
[   14.336382] testsuite-74.sh[680]: + echo -ne '\n/bin/barshell\n'
[   14.336980] testsuite-74.sh[680]: .//usr/lib/systemd/tests/testdata/units/testsuite-74.firstboot.sh: line 166: echo: write error: Broken pipe
```

19 months agocore: permit sending augmented enable/disable methods
Ronan Pigott [Sat, 18 Feb 2023 23:50:22 +0000 (16:50 -0700)] 
core: permit sending augmented enable/disable methods

systemctl disable some.service fails to acquire interactive permission
because the DisableUnitFilesWithFlagsAndInstallInto method isn't permitted

19 months agoexec-util: use TAKE_FD() 26479/head
Yu Watanabe [Sat, 18 Feb 2023 17:09:22 +0000 (02:09 +0900)] 
exec-util: use TAKE_FD()

19 months agoexec-util: propagate error in wait_for_terminate_and_check()
Yu Watanabe [Sat, 18 Feb 2023 16:55:28 +0000 (01:55 +0900)] 
exec-util: propagate error in wait_for_terminate_and_check()

Then, the two error handlings becomes consistent with the one in
execute_directories().

19 months agoprocess-util: show requested process name in the log
Yu Watanabe [Sat, 18 Feb 2023 16:26:39 +0000 (01:26 +0900)] 
process-util: show requested process name in the log

This is useful for debugging issues like #26474.

19 months agosystemctl: edit: fix double free of instanced name
Ronan Pigott [Sat, 18 Feb 2023 20:03:07 +0000 (13:03 -0700)] 
systemctl: edit: fix double free of instanced name

There is a double free of unit_name when an instance is used, causing
systemctl --user edit service@instance to abort.

19 months agojournalctl: fix output when --lines is used with --grep
Mike Yuan [Sat, 18 Feb 2023 13:49:21 +0000 (21:49 +0800)] 
journalctl: fix output when --lines is used with --grep

Previously, we skip the entries before arg_lines
unconditionally, which doesn't behave correctly
when used with --grep. After this commit, when
a pattern is specified, we don't skip the entries
early, but rely on the count of the lines shown
to tell us when to stop. To achieve that we would
have to search backwards instead.

Fixes #25147

19 months agoloop-util: fix error condition and return value
Yu Watanabe [Sat, 18 Feb 2023 06:35:41 +0000 (15:35 +0900)] 
loop-util: fix error condition and return value

Fixes a bug introduced by da4fd28871227d23d4719e30da03af5a71f47e5a.

19 months agoshared: move psi-util.[ch] to basic/ so that we can use it in sd-event
Lennart Poettering [Tue, 14 Feb 2023 15:10:21 +0000 (16:10 +0100)] 
shared: move psi-util.[ch] to basic/ so that we can use it in sd-event

19 months agoutil: move mallinfo compat glue from selinux code into generic code
Lennart Poettering [Fri, 10 Feb 2023 15:55:06 +0000 (16:55 +0100)] 
util: move mallinfo compat glue from selinux code into generic code

19 months agohashmap: fix build with valgrind
Yu Watanabe [Fri, 17 Feb 2023 21:56:02 +0000 (06:56 +0900)] 
hashmap: fix build with valgrind

Follow-up for a2b052b29f8bc141e94a4af95d1653a38a57eaeb.

19 months agoCorrect journal misspell
Winterhuman [Fri, 17 Feb 2023 21:19:51 +0000 (21:19 +0000)] 
Correct journal misspell

19 months agoMerge pull request #26443 from poettering/mempool-fixes
Lennart Poettering [Fri, 17 Feb 2023 16:15:35 +0000 (17:15 +0100)] 
Merge pull request #26443 from poettering/mempool-fixes

mempool tweaks

19 months agotests: add test for mempool logic 26443/head
Lennart Poettering [Tue, 14 Feb 2023 12:49:17 +0000 (13:49 +0100)] 
tests: add test for mempool logic

19 months agomempool: rework mempool_cleanup() to only release freed tiles
Lennart Poettering [Tue, 14 Feb 2023 12:44:51 +0000 (13:44 +0100)] 
mempool: rework mempool_cleanup() to only release freed tiles

This substantially reworks mempool_cleanup() so that it releases pools
with all freed tiles only, but keeps all pools with still-allocated
tiles around.

This is more correct, as the previous implementation just released all
pools regardless if anything was still used or not. This would make
valgrind shut up but would just hide memory leaks altogether. Moreover
if called during regular runtime of a program would result in bad memory
accesses all over.

Hence, let's add a proper implementation and only trim pools we really
know are empty.

This way we can safely call these functions later, when under memory
pressure, at any time.

19 months agomempool: make mempool_free_tile() return NULL
Lennart Poettering [Tue, 14 Feb 2023 12:42:03 +0000 (13:42 +0100)] 
mempool: make mempool_free_tile() return NULL

To match how we usually do this current allocation code.

(Also, make it accept a NULL pointer, also in order to match behaviour
in the rest of our codebase)

19 months agomempool: introduce new helper pool_ptr()
Lennart Poettering [Tue, 14 Feb 2023 12:40:40 +0000 (13:40 +0100)] 
mempool: introduce new helper pool_ptr()

This new helper returns the beginning of the usable area of the pool
object.

For now this is only used once, a later commit will use it more.

19 months agotpm2: simplify tpm2_seal() blob creation
Dan Streetman [Mon, 19 Dec 2022 14:58:05 +0000 (09:58 -0500)] 
tpm2: simplify tpm2_seal() blob creation

TPM2 marshalling will never increase the total size, only possibly decrease.
There is no need for checking for insufficient size if the buffer size
is set to the sizeof both objects to be marshalled.

19 months agomempool: rename local variable to match current coding style
Lennart Poettering [Tue, 14 Feb 2023 12:38:18 +0000 (13:38 +0100)] 
mempool: rename local variable to match current coding style

19 months agomempool: use size_t for all memory object sizes and counts
Lennart Poettering [Tue, 14 Feb 2023 12:37:20 +0000 (13:37 +0100)] 
mempool: use size_t for all memory object sizes and counts

19 months agohashmap: expose helper for releasing memory pools independently of valgrind
Lennart Poettering [Wed, 8 Feb 2023 17:03:27 +0000 (18:03 +0100)] 
hashmap: expose helper for releasing memory pools independently of valgrind

Let's clean this up and export this always, so that we can later call
when we are under memory pressure.

19 months agodissect-image: Return mount point fd if requested
Daan De Meyer [Thu, 22 Dec 2022 12:00:31 +0000 (13:00 +0100)] 
dissect-image: Return mount point fd if requested

19 months agoprocess-util: add helper get_process_threads()
Lennart Poettering [Wed, 8 Feb 2023 17:01:26 +0000 (18:01 +0100)] 
process-util: add helper get_process_threads()

Let's add a proper helper for querying the number of threads in a
process.

19 months agoMerge pull request #26463 from DaanDeMeyer/hacking
Luca Boccassi [Fri, 17 Feb 2023 11:58:13 +0000 (11:58 +0000)] 
Merge pull request #26463 from DaanDeMeyer/hacking

Hacking

19 months agosync-util: port fsync_directory_of_file() to fd_is_opath()
Lennart Poettering [Fri, 17 Feb 2023 09:32:18 +0000 (10:32 +0100)] 
sync-util: port fsync_directory_of_file() to fd_is_opath()

As suggested here:

https://github.com/systemd/systemd/pull/26450#pullrequestreview-1302922404

19 months agoMerge pull request #26438 from poettering/event-source-shorten
Lennart Poettering [Fri, 17 Feb 2023 11:46:55 +0000 (12:46 +0100)] 
Merge pull request #26438 from poettering/event-source-shorten

sd-event: reduce memory use of sd_event_source objects

19 months agoMerge pull request #26341 from DaanDeMeyer/chase-fixes
Luca Boccassi [Fri, 17 Feb 2023 11:44:47 +0000 (11:44 +0000)] 
Merge pull request #26341 from DaanDeMeyer/chase-fixes

chase-symlinks fixes

19 months agoMerge pull request #26447 from poettering/sigqueue
Lennart Poettering [Fri, 17 Feb 2023 09:51:58 +0000 (10:51 +0100)] 
Merge pull request #26447 from poettering/sigqueue

pid1/systemctl: add ability to enqueue POSIX RT sigs with associated value to service processes

19 months agosocket-util: make connect_unix_path() work with a NULL path
Lennart Poettering [Fri, 10 Feb 2023 15:43:58 +0000 (16:43 +0100)] 
socket-util: make connect_unix_path() work with a NULL path

19 months agoMerge pull request #26343 from DaanDeMeyer/bus-debug
Lennart Poettering [Fri, 17 Feb 2023 09:50:19 +0000 (10:50 +0100)] 
Merge pull request #26343 from DaanDeMeyer/bus-debug

Bus debug

19 months agoMerge pull request #26450 from yuwata/fd-is-opath
Lennart Poettering [Fri, 17 Feb 2023 09:28:32 +0000 (10:28 +0100)] 
Merge pull request #26450 from yuwata/fd-is-opath

util: introduce fd_is_opath() and use it in xsetxattr()

19 months agosd-event: allocate event source objects with the actually needed size 26438/head
Lennart Poettering [Fri, 10 Feb 2023 16:56:48 +0000 (17:56 +0100)] 
sd-event: allocate event source objects with the actually needed size

Currently we allocate fixed-size memory for event sources: the largest
any of the event source type needs. Discrepancy in the sizes needed for
the various event sources is quite major however: it's 144 bytes on
x86_64, i.e. more than two cache lines.

hence, let's be a tiny bit more careful, and allocate exactly as much as
we need, but not more.

19 months agomacro: add macro for determining size of struct with trailing union
Lennart Poettering [Fri, 10 Feb 2023 16:56:30 +0000 (17:56 +0100)] 
macro: add macro for determining size of struct with trailing union

19 months agotest: add test for new "systemctl --kill-value=" functionality 26447/head
Lennart Poettering [Thu, 16 Feb 2023 15:31:02 +0000 (16:31 +0100)] 
test: add test for new "systemctl --kill-value=" functionality

(as side-effect this also tests the new systemd-notify --exec switch)

19 months agoman: document new --exec switch for systemd-notify
Lennart Poettering [Thu, 16 Feb 2023 15:30:09 +0000 (16:30 +0100)] 
man: document new --exec switch for systemd-notify

19 months agonotify: add new --exec switch for chaining other commands to systemd-notify
Lennart Poettering [Thu, 16 Feb 2023 14:42:49 +0000 (15:42 +0100)] 
notify: add new --exec switch for chaining other commands to systemd-notify

This is useful in tests, so that we can first send a READY message and
then continue doing something else without changing PID.

19 months agostrv: add strv_copy_n() helper for copying part of a n strv
Lennart Poettering [Thu, 16 Feb 2023 14:41:55 +0000 (15:41 +0100)] 
strv: add strv_copy_n() helper for copying part of a n strv

19 months agoman: document new --kill-value= switch to systemctl
Lennart Poettering [Thu, 16 Feb 2023 15:20:48 +0000 (16:20 +0100)] 
man: document new --kill-value= switch to systemctl

19 months agosystemctl: add --kill-value= argument to systemctl
Lennart Poettering [Wed, 15 Feb 2023 09:51:33 +0000 (10:51 +0100)] 
systemctl: add --kill-value= argument to systemctl

This allows accompanying a signal with a value (as supported for Linux
Realtime signals). This is particularly useful as it allows us to do
stuff like this:

   systemctl kill --kill-whom=main --kill-value=0x300 systemd-journald

In order to ask journald to flush its allocation caches and compact
memory.

19 months agopid1: add a new D-Bus method for enquing POSIX signals with values to unit processes
Lennart Poettering [Wed, 15 Feb 2023 09:25:51 +0000 (10:25 +0100)] 
pid1: add a new D-Bus method for enquing POSIX signals with values to unit processes

This augments the existing KillUnit() + Kill() methods with
QueueSignalUnit() + QueueSignal(), which are what sigqueue() is to
kill().

This is useful for sending our new SIGRTMIN+18 control signals to system
services.

19 months agotest-execute: also mount tmpfs on /dev/shm
Yu Watanabe [Fri, 17 Feb 2023 01:21:58 +0000 (10:21 +0900)] 
test-execute: also mount tmpfs on /dev/shm

Otherwise, if /dev/shm has a directory that cannot be accessible by
unprivileged user, then we cannot pick a dynamic user, and test service
may fail with unexpected error code:
---
Failed to enter shared memory directory /dev/shm/systemd-watch-bind-BqAGlN: Permission denied
exec-dynamicuser-supplementarygroups.service: Failed to update dynamic user credentials: Device or resource busy
exec-dynamicuser-supplementarygroups.service: Failed at step USER spawning /bin/sh: Device or resource busy
src/test/test-execute.c:885:test_exec_dynamicuser: exec-dynamicuser-supplementarygroups.service: can_unshare=no: exit status 217, expected 216
---

Follow-up for 4e032f654b94c2544ccf937209303766dfa66c24.

19 months agocryptsetup: check the existence of salt by salt_size > 0
Yu Watanabe [Thu, 16 Feb 2023 23:24:54 +0000 (08:24 +0900)] 
cryptsetup: check the existence of salt by salt_size > 0

Follow-up for 504d0acf61c8472bc93c2a927e858074873b2eaf.

The function may be called with non-NULL salt and salt_size == 0.

19 months agoMerge pull request #26453 from yuwata/activate-main
Lennart Poettering [Fri, 17 Feb 2023 08:45:52 +0000 (09:45 +0100)] 
Merge pull request #26453 from yuwata/activate-main

activate: use DEFINE_MAIN_FUNCTION() macro

19 months agoMerge pull request #26452 from yuwata/journalctl-main-func
Lennart Poettering [Fri, 17 Feb 2023 08:44:19 +0000 (09:44 +0100)] 
Merge pull request #26452 from yuwata/journalctl-main-func

journalctl: use DEFINE_MAIN_FUNCTION() macro

19 months agotest: add tests for xsetxattr() 26450/head
Yu Watanabe [Fri, 17 Feb 2023 02:42:14 +0000 (11:42 +0900)] 
test: add tests for xsetxattr()

19 months agotest: use mkdtemp_open()
Yu Watanabe [Fri, 17 Feb 2023 02:12:13 +0000 (11:12 +0900)] 
test: use mkdtemp_open()

19 months agoactivate: use _cleanup_close_ attribute 26453/head
Yu Watanabe [Fri, 17 Feb 2023 00:49:01 +0000 (09:49 +0900)] 
activate: use _cleanup_close_ attribute

19 months agoactivate: use log_set_open_when_needed()
Yu Watanabe [Fri, 17 Feb 2023 00:31:01 +0000 (09:31 +0900)] 
activate: use log_set_open_when_needed()

Otherwise, several error logs may not be shown.

19 months agoactivate: fix typo
Yu Watanabe [Fri, 17 Feb 2023 00:26:34 +0000 (09:26 +0900)] 
activate: fix typo

19 months agoactivate: use DEFINE_MAIN_FUNC() macro
Yu Watanabe [Fri, 17 Feb 2023 00:25:21 +0000 (09:25 +0900)] 
activate: use DEFINE_MAIN_FUNC() macro

19 months agojournalctl: fix fd leak 26452/head
Yu Watanabe [Fri, 17 Feb 2023 00:11:28 +0000 (09:11 +0900)] 
journalctl: fix fd leak

19 months agojournalctl: use DEFINE_MAIN_FUNCTION() macro
Yu Watanabe [Fri, 17 Feb 2023 00:11:17 +0000 (09:11 +0900)] 
journalctl: use DEFINE_MAIN_FUNCTION() macro

19 months agoxattr-util: check if fd has O_PATH and do not try setxattr() twice
Yu Watanabe [Thu, 16 Feb 2023 22:34:13 +0000 (07:34 +0900)] 
xattr-util: check if fd has O_PATH and do not try setxattr() twice

Follow-up for a4d2461c46f40c9ae5002a2aea35b35ccb60ef9c.

19 months agofd-util: introduce a simple helper to check a file descriptor has O_PATH
Yu Watanabe [Thu, 16 Feb 2023 22:18:42 +0000 (07:18 +0900)] 
fd-util: introduce a simple helper to check a file descriptor has O_PATH

19 months agotest: avoid matching other fields than __SEQNUM=
Frantisek Sumsal [Thu, 16 Feb 2023 18:48:03 +0000 (19:48 +0100)] 
test: avoid matching other fields than __SEQNUM=

The current unanchored grep sometimes matches MESSAGE=/_CMDLINE= fields
that contain "__SEQNUM=" instead of just the __SEQNUM= field, causing
spurious test fails:

[  721.546372] testsuite-04.sh[1013]: ++ cut -d= -f2
[  721.555858] testsuite-04.sh[1011]: ++ journalctl -o export -n 1
[  721.573037] testsuite-04.sh[1012]: ++ grep -a __SEQNUM=
[  721.767294] testsuite-04.sh[562]: + SEQNUM1='495773
[  721.769671] testsuite-04.sh[562]: ++ grep -a __SEQNUM
[  721.771323] testsuite-04.sh[562]: grep -a __SEQNUM'
[  721.772938] testsuite-04.sh[562]: + systemd-cat echo yo
[  721.921413] testsuite-04.sh[562]: + journalctl --sync
[  722.088945] testsuite-04.sh[1018]: ++ journalctl -o export -n 1
[  722.104040] testsuite-04.sh[1019]: ++ grep -a __SEQNUM=
[  722.117239] testsuite-04.sh[1020]: ++ cut -d= -f2
[  722.314936] testsuite-04.sh[562]: + SEQNUM2=495786
[  722.317906] testsuite-04.sh[562]: + test 495786 -gt '495773
[  722.319737] testsuite-04.sh[562]: ++ grep -a __SEQNUM
[  722.321609] testsuite-04.sh[562]: grep -a __SEQNUM'
[  722.323536] testsuite-04.sh[562]: /usr/lib/systemd/tests/testdata/units/testsuite-04.sh: line 276: test: 495773
[  722.325744] testsuite-04.sh[562]: ++ grep -a __SEQNUM
[  722.327498] testsuite-04.sh[562]: grep -a __SEQNUM: integer expression expected
[  722.329528] testsuite-04.sh[562]: + journalctl --rotate --vacuum-size=16M

$ build/journalctl --file /var/tmp/systemd-test.0HpVjt/system.journal -o export | grep -a __SEQNUM=
...
__SEQNUM=214849
__SEQNUM=214850
MESSAGE=++ grep -a __SEQNUM=
_CMDLINE=grep -a __SEQNUM=
__SEQNUM=214851
...
__SEQNUM=214860
MESSAGE=++ grep -a __SEQNUM=
_CMDLINE=grep -a __SEQNUM=
__SEQNUM=214861
__SEQNUM=214862
__SEQNUM=214863
...

Let's anchor the expression to avoid this.

Follow-up to f28ed2c1be7.

19 months agoMerge pull request #26271 from d-hatayama/fix_sulogin_shell
Yu Watanabe [Thu, 16 Feb 2023 21:52:03 +0000 (06:52 +0900)] 
Merge pull request #26271 from d-hatayama/fix_sulogin_shell

sulogin: fix control lost of the current terminal when default.target…

19 months agoboot: Fix assertion failure
Jan Janssen [Thu, 16 Feb 2023 14:24:44 +0000 (15:24 +0100)] 
boot: Fix assertion failure

The TPM code expects a description unless the PCR index indicates that
no measurements have to take place. The assert was preempting this
check from happening.

Fixes: #26428
19 months agoDrop mkosi + clang section from HACKING 26463/head
Daan De Meyer [Thu, 16 Feb 2023 19:06:27 +0000 (20:06 +0100)] 
Drop mkosi + clang section from HACKING

We removed a few features that made this work, will be added back
in the future when we restructure the way mkosi does build images.

19 months agoUpdate HACKING for latest mkosi
Daan De Meyer [Thu, 16 Feb 2023 19:05:55 +0000 (20:05 +0100)] 
Update HACKING for latest mkosi

19 months agobootctl: Fix debug messages
Samanta Navarro [Thu, 16 Feb 2023 11:59:05 +0000 (11:59 +0000)] 
bootctl: Fix debug messages

Remove duplicate KERNEL_INSTALL_MACHINE_ID from message and also
specify the correct origin of layout variable.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
19 months agolog: add common helper log_set_target_and_open()
Lennart Poettering [Tue, 14 Feb 2023 15:10:58 +0000 (16:10 +0100)] 
log: add common helper log_set_target_and_open()

quite often we want to set a log target and immediately open it. Add a
common helper for that.

19 months agoMerge pull request #26435 from poettering/pid1-seccomp-disable-fix
Luca Boccassi [Thu, 16 Feb 2023 14:49:52 +0000 (14:49 +0000)] 
Merge pull request #26435 from poettering/pid1-seccomp-disable-fix

pid1: fix handling of SystemCallArchitectures= if seccomp is off

19 months agocore/mount: fix default target for /sysusr/usr and its child
Yu Watanabe [Wed, 15 Feb 2023 05:23:34 +0000 (14:23 +0900)] 
core/mount: fix default target for /sysusr/usr and its child

Follow-up for 29a24ab28e9790680348b1ffab653a321fa49a67.

19 months agoman: Fix spelling mistake
Paul Barker [Thu, 16 Feb 2023 14:19:40 +0000 (14:19 +0000)] 
man: Fix spelling mistake

19 months agoupdate TODO
Lennart Poettering [Thu, 16 Feb 2023 13:07:03 +0000 (14:07 +0100)] 
update TODO

19 months agosulogin: fix control lost of the current terminal when default.target is rescue.target 26271/head
HATAYAMA Daisuke [Sun, 12 Feb 2023 12:15:08 +0000 (12:15 +0000)] 
sulogin: fix control lost of the current terminal when default.target is rescue.target

When default.target is rescue.target, exiting from the single-user shell
results in lost of the control of the current terminal. This is because the
operation performed to continue to boot is systemctl default but default.target
is now rescue.target and it is already active. Hence, no new process that
controls the current terminal is created. Users need to make hardware reset to
recover the situation.

This sounds like a bit corner case issue and some might feel configuring
default.target as rescue.target is odd because there are several other ways to
transition to rescue.mode without configuring default.target to rescue.target
such as systemctl rescue or systemd.unit=rescue.target something like
that. However, users unfamiliar with systemd operations tend to come up with
systemctl set-default rescue.target.

To fix this issue, let's transition to default.target only when default.target
is inactive. Otherwise, invoke the single-user shell again to keep control of
the current terminal for users.

This new logic depends on whether D-Bus working well. Exiting without any check
of result of systemctl default could lead to again the control lost of the
current terminal. Hence, add checking results of each D-Bus operations
including systemctl default and invoke the single-user shell if they fail.

19 months agorepart: Make config_parse_copy_files() more generic
Daan De Meyer [Thu, 16 Feb 2023 11:45:13 +0000 (12:45 +0100)] 
repart: Make config_parse_copy_files() more generic

19 months agoexecute: drop spurious empty line 26435/head
Lennart Poettering [Thu, 16 Feb 2023 09:59:16 +0000 (10:59 +0100)] 
execute: drop spurious empty line

19 months agopid1: generate compat warning for SystemCallArchitectures= if seccomp is off
Lennart Poettering [Thu, 16 Feb 2023 09:10:19 +0000 (10:10 +0100)] 
pid1: generate compat warning for SystemCallArchitectures= if seccomp is off

19 months agomkosi: configure multiarch libdir in debian/ubuntu builds
Luca Boccassi [Wed, 15 Feb 2023 22:06:26 +0000 (22:06 +0000)] 
mkosi: configure multiarch libdir in debian/ubuntu builds

Debian/Ubuntu use /usr/lib/<triplet> instead of /usr/lib64, so configure it
accordingly. This is especially important for cryptsetup token plugins,
as cryptsetup comes from the distro and is configured to look into those
directories.

19 months agotpm2: fix build failure without openssl
Dan Streetman [Fri, 20 Jan 2023 17:42:52 +0000 (12:42 -0500)] 
tpm2: fix build failure without openssl

19 months agomkosi: Enable debug logging in CI
Daan De Meyer [Wed, 15 Feb 2023 10:16:28 +0000 (11:16 +0100)] 
mkosi: Enable debug logging in CI

"Failed to dissect image: connection timed out" messages have been
appearing sporadically in mkosi CI. Let's enable debug logging to
help figure out why.

19 months agojournalctl: actually run the static destructors
Frantisek Sumsal [Wed, 15 Feb 2023 17:08:35 +0000 (18:08 +0100)] 
journalctl: actually run the static destructors

In journalctl we don't run the static destructors defined via
the STATIC_DESTRUCTOR_REGISTER() macro, since it requires a corresponding
static_destruct() call. In most cases this is handled by
the DEFINE_(TEST_)?MAIN*() macros, but journalctl defines its own main
function, so let's handle that as well.

$ valgrind --suppressions=valgrind.supp --show-leak-kinds=all --leak-check=full build/journalctl --no-pager -u system.slice -n 10 >/dev/null
==2778093== Memcheck, a memory error detector
==2778093== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2778093== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==2778093== Command: build/journalctl --no-pager -u system.slice -n 10
==2778093==
==2778093==
==2778093== HEAP SUMMARY:
==2778093==     in use at exit: 8,221 bytes in 4 blocks
==2778093==   total heap usage: 458 allocs, 454 frees, 255,182 bytes allocated
==2778093==
==2778093== 13 bytes in 1 blocks are still reachable in loss record 1 of 4
==2778093==    at 0x484586F: malloc (vg_replace_malloc.c:381)
==2778093==    by 0x4DA256D: strdup (strdup.c:42)
==2778093==    by 0x4ADB747: strv_extend_with_size (strv.c:544)
==2778093==    by 0x405386: strv_extend (strv.h:45)
==2778093==    by 0x40816F: parse_argv (journalctl.c:933)
==2778093==    by 0x40EAB5: main (journalctl.c:2111)
==2778093==
==2778093== 16 bytes in 1 blocks are still reachable in loss record 2 of 4
==2778093==    at 0x484578A: malloc (vg_replace_malloc.c:380)
==2778093==    by 0x484A70B: realloc (vg_replace_malloc.c:1437)
==2778093==    by 0x4ADB2A3: strv_push_with_size (strv.c:423)
==2778093==    by 0x4ADB620: strv_consume_with_size (strv.c:496)
==2778093==    by 0x4ADB770: strv_extend_with_size (strv.c:548)
==2778093==    by 0x405386: strv_extend (strv.h:45)
==2778093==    by 0x40816F: parse_argv (journalctl.c:933)
==2778093==    by 0x40EAB5: main (journalctl.c:2111)
==2778093==
==2778093== LEAK SUMMARY:
==2778093==    definitely lost: 0 bytes in 0 blocks
==2778093==    indirectly lost: 0 bytes in 0 blocks
==2778093==      possibly lost: 0 bytes in 0 blocks
==2778093==    still reachable: 29 bytes in 2 blocks
==2778093==         suppressed: 8,192 bytes in 2 blocks
==2778093==
==2778093== For lists of detected and suppressed errors, rerun with: -s
==2778093== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

19 months agoresolved: Fall back to TCP if UDP is blocked
Joan Bruguera [Sun, 12 Feb 2023 20:06:08 +0000 (20:06 +0000)] 
resolved: Fall back to TCP if UDP is blocked

If UDP is blocked on the system (e.g. by iptables or BPF), the kernel will
return EPERM on some or all of the system calls (connect, sendmsg, etc.).
In this case, try to fall back to TCP, which hopefully will not be blocked.

19 months agocore: add support for Startup memory limits
Luca Boccassi [Mon, 6 Feb 2023 14:13:09 +0000 (14:13 +0000)] 
core: add support for Startup memory limits

We support separate Startup configurations for CPU and I/O, so
add it for memory too. Only cover cgroupsv2 settings.

19 months agovconsole: allow setting default keymap through build option
Mike Yuan [Tue, 17 Jan 2023 17:21:59 +0000 (01:21 +0800)] 
vconsole: allow setting default keymap through build option

Allow defining the default keymap to be used by
vconsole-setup through a build option. A template
vconsole.conf also gets populated by tmpfiles if
it doesn't exist.