]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agotest-journal-syslog: Add some valid priority cases 22765/head
Jan Janssen [Wed, 16 Mar 2022 10:05:13 +0000 (11:05 +0100)] 
test-journal-syslog: Add some valid priority cases

3 years agotest: Use C11 UTF-16 string literal
Jan Janssen [Mon, 14 Mar 2022 09:32:48 +0000 (10:32 +0100)] 
test: Use C11 UTF-16 string literal

3 years agotest: Use TEST macros in more places
Jan Janssen [Mon, 14 Mar 2022 09:37:27 +0000 (10:37 +0100)] 
test: Use TEST macros in more places

3 years agoupdate TODO
Lennart Poettering [Wed, 16 Mar 2022 10:33:27 +0000 (11:33 +0100)] 
update TODO

3 years agodocs: s/straight-forward/straightforward/
Lennart Poettering [Tue, 15 Mar 2022 16:04:36 +0000 (17:04 +0100)] 
docs: s/straight-forward/straightforward/

Inspired by https://github.com/systemd/systemd/pull/20156#discussion_r810878846

3 years agoMerge pull request #22746 from yuwata/home-cleanups
Luca Boccassi [Tue, 15 Mar 2022 22:44:58 +0000 (22:44 +0000)] 
Merge pull request #22746 from yuwata/home-cleanups

home: two cleanups

3 years agoimport: improve error message
Lennart Poettering [Tue, 15 Mar 2022 17:35:48 +0000 (18:35 +0100)] 
import: improve error message

As suggested: https://github.com/systemd/systemd/pull/20156#discussion_r810941489

3 years agoMerge pull request #22757 from DaanDeMeyer/bpf-error
Luca Boccassi [Tue, 15 Mar 2022 22:42:48 +0000 (22:42 +0000)] 
Merge pull request #22757 from DaanDeMeyer/bpf-error

BPF error logging improvements

3 years agobpf: Fix error handling 22757/head
Daan De Meyer [Tue, 15 Mar 2022 17:14:19 +0000 (17:14 +0000)] 
bpf: Fix error handling

The __open() functions actually set errno on failure so let's
update the error handling to account for that.

3 years agobpf: Log at debug when checking if restricting ifaces is supported
Daan De Meyer [Tue, 15 Mar 2022 17:12:06 +0000 (17:12 +0000)] 
bpf: Log at debug when checking if restricting ifaces is supported

Same change as 1a9e33aee36b4c353628068507ba1dd7d76b6e14 did for
socket-bind.

3 years agohome: use open_image_file() helper at one more place 22746/head
Yu Watanabe [Mon, 14 Mar 2022 07:01:23 +0000 (16:01 +0900)] 
home: use open_image_file() helper at one more place

3 years agoMerge pull request #22745 from yuwata/test-repart-fixes
Frantisek Sumsal [Tue, 15 Mar 2022 11:52:50 +0000 (11:52 +0000)] 
Merge pull request #22745 from yuwata/test-repart-fixes

test: fixes for TEST-58-REPART

3 years agoMerge pull request #22739 from mrc0mmand/list-boot-followup
Yu Watanabe [Tue, 15 Mar 2022 06:59:45 +0000 (15:59 +0900)] 
Merge pull request #22739 from mrc0mmand/list-boot-followup

A couple of follow-ups for #22721

3 years agohome: shorten code a bit and add missing assertions
Yu Watanabe [Sun, 13 Mar 2022 07:17:08 +0000 (16:17 +0900)] 
home: shorten code a bit and add missing assertions

This drops redundant call of fstat(), and reduces indentation.

3 years agotest: wait for loopback device being actually created 22745/head
Yu Watanabe [Mon, 14 Mar 2022 13:02:37 +0000 (22:02 +0900)] 
test: wait for loopback device being actually created

It seems there exists a short time period that we cannot see the
loopback device after `losetup` is finished:
```
testsuite-58.sh[367]: ++ losetup -b 1024 -P --show -f /tmp/testsuite-58-sector-1024.img
kernel: loop1: detected capacity change from 0 to 204800
testsuite-58.sh[285]: + LOOP=/dev/loop1
testsuite-58.sh[285]: + systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no /dev/loop1
testsuite-58.sh[368]: Device '/dev/loop1' has no dm-crypt/dm-verity device, no need to look for underlying block device.
testsuite-58.sh[368]: Failed to determine canonical path for '/dev/loop1': No such file or directory
testsuite-58.sh[368]: Failed to open file or determine backing device of /dev/loop1: No such file or directory
```

3 years agotest: format disk image through loopback device
Yu Watanabe [Sun, 13 Mar 2022 17:26:25 +0000 (02:26 +0900)] 
test: format disk image through loopback device

It seems that the change on the image file sometimes not propagated on
the loopback device immediately.

3 years agotest: use /var/tmp for storing disk images
Yu Watanabe [Sun, 13 Mar 2022 12:38:10 +0000 (21:38 +0900)] 
test: use /var/tmp for storing disk images

The Ubuntu CI on ppc64el seems to have a issue on tmpfs, and files
may not be fsynced. See c10caebb98803b812ebc4dd6cdeaab2ca17826d7.
For safety, let's use /var/tmp to store disk images.

3 years agoMerge pull request #22730 from GeorgesStavracas/gbsneto/multimedia-stream-deck
Luca Boccassi [Mon, 14 Mar 2022 23:40:51 +0000 (23:40 +0000)] 
Merge pull request #22730 from GeorgesStavracas/gbsneto/multimedia-stream-deck

Add AV production devices to hwdb

3 years agounits: fix factory-reset.target description
Vivien Didelot [Mon, 14 Mar 2022 20:34:57 +0000 (16:34 -0400)] 
units: fix factory-reset.target description

The current description for the factory reset target does not add any
value and doesn't respect the definition of the related property as
described in systemd.unit(5).

Starting the target currently results in the following log:

    [   11.139174] systemd[1]: Reached target Target that triggers factory reset. Does nothing by default..
    [  OK  ] Reached target Target that…set. Does nothing by default..

Simply update the target description to "Factory Reset".

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
3 years agojournal: make --reverse affect --list-boots 22739/head
Frantisek Sumsal [Mon, 14 Mar 2022 17:43:03 +0000 (18:43 +0100)] 
journal: make --reverse affect --list-boots

Fixes: #16274
3 years agojournal: use table_set_json_field_name() to override a column name
Frantisek Sumsal [Mon, 14 Mar 2022 17:26:53 +0000 (18:26 +0100)] 
journal: use table_set_json_field_name() to override a column name

Pointed out in: https://github.com/systemd/systemd/pull/22721#discussion_r826014227
Follow-up for: 5a1355d848a0f6564a04c6d8268e72bc93d173de

3 years agoMerge pull request #22734 from poettering/decimal-str-width-test
Lennart Poettering [Mon, 14 Mar 2022 22:07:59 +0000 (23:07 +0100)] 
Merge pull request #22734 from poettering/decimal-str-width-test

DECIMAL_STR_WIDTH() + DECIMAL_STR_MAX() tweaks

3 years agoMerge pull request #22727 from fbuihuu/journald-preserve-acl-when-rotating
Luca Boccassi [Mon, 14 Mar 2022 20:39:14 +0000 (20:39 +0000)] 
Merge pull request #22727 from fbuihuu/journald-preserve-acl-when-rotating

Journald preserve acl when rotating

3 years agorandom-util: remove RDRAND usage
Jason A. Donenfeld [Mon, 7 Mar 2022 05:15:44 +0000 (22:15 -0700)] 
random-util: remove RDRAND usage

/dev/urandom is seeded with RDRAND. Calling genuine_random_bytes(...,
..., 0) will use /dev/urandom as a last resort. Hence, we gain nothing
here by having our own RDRAND wrapper, because /dev/urandom already is
based on RDRAND output, even before /dev/urandom has fully initialized.

Furthermore, RDRAND is not actually fast! And on each successive
generation of new x86 CPUs, from both AMD and Intel, it just gets
slower.

This commit simplifies things by just using /dev/urandom in cases where
we before might use RDRAND, since /dev/urandom will always have RDRAND
mixed in as part of it.

And above where I say "/dev/urandom", what I actually mean is
GRND_INSECURE, which is the same thing but won't generate warnings in
dmesg.

3 years agodocs: document how we usually define enums
Lennart Poettering [Mon, 14 Mar 2022 10:53:35 +0000 (11:53 +0100)] 
docs: document how we usually define enums

3 years agohostnamed: update chassis table to SMBIOS 3.5
Lennart Poettering [Mon, 14 Mar 2022 10:52:30 +0000 (11:52 +0100)] 
hostnamed: update chassis table to SMBIOS 3.5

3 years agodocs: document we use C11 with GNU extensions now
Lennart Poettering [Mon, 14 Mar 2022 14:56:53 +0000 (15:56 +0100)] 
docs: document we use C11 with GNU extensions now

Follow-up for: #22711

3 years agohwdb: Add AV production access to Elgado Stream Deck devices 22730/head
Georges Basile Stavracas Neto [Mon, 14 Mar 2022 13:50:45 +0000 (10:50 -0300)] 
hwdb: Add AV production access to Elgado Stream Deck devices

The Stream Deck products from Elgato are simple key pads
intended to be used as macro pads. They're popular within
the streaming community.

This commit adds all 5 Stream Deck variants available to
the AV production file.

See https://www.elgato.com/en/stream-deck

3 years agoAdd AV production controllers to hwdb and add uaccess
Be [Sat, 28 Aug 2021 03:30:50 +0000 (22:30 -0500)] 
Add AV production controllers to hwdb and add uaccess

This adds support for AV production controller devices, such
as DJ tables, music-oriented key pads, and others.

The USB vendor and product IDs come from Mixxx, Ctlra, and
Ardour.

Fixes #20533

Co-developed-by: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
3 years agojournal: reset previously set JSON flags
Frantisek Sumsal [Mon, 14 Mar 2022 17:16:15 +0000 (18:16 +0100)] 
journal: reset previously set JSON flags

Make sure we reset the JSON format flags if the format option is used
multiple times, e.g. `journalctl -o json-format -o export`.

Pointed out in: https://github.com/systemd/systemd/pull/22721#discussion_r826018985
Follow-up for: 5a1355d848a0f6564a04c6d8268e72bc93d173de

3 years agotest: add test case for DECIMAL_STR_MAX() 22734/head
Lennart Poettering [Mon, 14 Mar 2022 13:48:17 +0000 (14:48 +0100)] 
test: add test case for DECIMAL_STR_MAX()

3 years agomacro: handle DECIMAL_STR_MAX() special cases more accurately
Lennart Poettering [Mon, 14 Mar 2022 13:44:54 +0000 (14:44 +0100)] 
macro: handle DECIMAL_STR_MAX() special cases more accurately

So far DECIMAL_STR_MAX() overestimated the types in two ways: it would
also adds space for a "-" for unsigned types.

And it would always return the same size for 64bit values regardless of
signedness, even though the longest maximum numbers for signed and
unsigned differ in length by one digit. i.e. 2^64-1 (i.e. UINT64_MAX) is
one decimal digit longer than -2^63 (INT64_MIN) - for the other integer
widths the number of digits in the "longest" decimal value is always the
same, regardless of signedness. by example: strlen("65535") ==
strlen("32768") (i.e. the relevant 16 bit limits) holds — and similar
for 8bit and 32bit integer width limits — but
strlen("18446744073709551615") > strlen("9223372036854775808") (i.e. the
relevant 64 bit limits).

Let's fix both misestimations.

3 years agotest: add test for DECIMAL_STR_WIDTH()
Lennart Poettering [Mon, 14 Mar 2022 11:02:42 +0000 (12:02 +0100)] 
test: add test for DECIMAL_STR_WIDTH()

3 years agomacro: DECIMAL_STR_WIDTH() is about *values* not *types*
Lennart Poettering [Mon, 14 Mar 2022 11:01:47 +0000 (12:01 +0100)] 
macro: DECIMAL_STR_WIDTH() is about *values* not *types*

Hence, check if the value is negative, not whether the type can carry
negatives.

Follow-up for: e3dd9ea8ea4510221f73071ad30ee657ca77565d

3 years agotest: change // comments to /* */
Lennart Poettering [Mon, 14 Mar 2022 10:53:02 +0000 (11:53 +0100)] 
test: change // comments to /* */

We use // comments only for "FIXME" style comments, and explanatory
comments get /* */, as per coding style.

3 years agocopy: use FLAGS_SET() in copy_xattr() 22727/head
Franck Bui [Mon, 14 Mar 2022 17:05:49 +0000 (18:05 +0100)] 
copy: use FLAGS_SET() in copy_xattr()

3 years agojournal: preserve acls when rotating user journals with NOCOW attribute set
Franck Bui [Mon, 14 Mar 2022 17:03:02 +0000 (18:03 +0100)] 
journal: preserve acls when rotating user journals with NOCOW attribute set

When restoring the COW flag for journals on BTRFS, the full journal contents
are copied into new files. But during these operations, the acls of the
previous files were lost and users were not able to access to their old
journal contents anymore.

3 years agocopy: fix wrong argument passed to S_ISREG() in copy_file_fd_full()
Franck Bui [Mon, 14 Mar 2022 08:30:11 +0000 (09:30 +0100)] 
copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full()

Follow-up for 2f782044986a30bf73f1fe00209dbd204b3efe33.

3 years agorandom-util: drop left-over comment
Lennart Poettering [Wed, 9 Mar 2022 13:32:41 +0000 (14:32 +0100)] 
random-util: drop left-over comment

We don't use non-blocking mode anymore, since 31234fbeec1c4a8e500106dff4779ccaa5baef83

Follow-up for: 31234fbeec1c4a8e500106dff4779ccaa5baef83

3 years agoMerge pull request #22721 from mrc0mmand/journalctl-tweaks
Yu Watanabe [Mon, 14 Mar 2022 01:59:13 +0000 (10:59 +0900)] 
Merge pull request #22721 from mrc0mmand/journalctl-tweaks

journal: convert --list-boots to a table

3 years agotest: extend format-table tests with negative numbers 22721/head
Frantisek Sumsal [Sun, 13 Mar 2022 19:32:18 +0000 (20:32 +0100)] 
test: extend format-table tests with negative numbers

3 years agoman: replace full stop with colon
Yu Watanabe [Sun, 13 Mar 2022 13:33:27 +0000 (22:33 +0900)] 
man: replace full stop with colon

Fixes #22724.

3 years agojournal: convert --list-boots to a table
Frantisek Sumsal [Sat, 12 Mar 2022 19:37:16 +0000 (20:37 +0100)] 
journal: convert --list-boots to a table

so it can be output as JSON as well.

```
$ build-san/journalctl --list-boots --file boot-test.journal
IDX BOOT ID                          FIRST ENTRY                 LAST ENTRY
 -3 39d66eb1925f4d01b8464d502650a714 Sat 2022-03-05 15:20:33 CET Sat 2022-03-05 16:19:21 CET
 -2 5dffeb08a27344d5ae9e2fc244bbcbc5 Fri 2022-03-11 17:23:57 CET Fri 2022-03-11 17:38:31 CET
 -1 c8ebd52915b642c39eda4bf00f864f79 Fri 2022-03-11 17:38:41 CET Fri 2022-03-11 20:03:46 CET
  0 00bcba97c7094fa88cc5d1cf2a389057 Sat 2022-03-12 20:39:08 CET Sat 2022-03-12 20:40:18 CET

$ build-san/journalctl --list-boots --file boot-test.journal -q
-3 39d66eb1925f4d01b8464d502650a714 Sat 2022-03-05 15:20:33 CET Sat 2022-03-05 16:19:21 CET
-2 5dffeb08a27344d5ae9e2fc244bbcbc5 Fri 2022-03-11 17:23:57 CET Fri 2022-03-11 17:38:31 CET
-1 c8ebd52915b642c39eda4bf00f864f79 Fri 2022-03-11 17:38:41 CET Fri 2022-03-11 20:03:46 CET
 0 00bcba97c7094fa88cc5d1cf2a389057 Sat 2022-03-12 20:39:08 CET Sat 2022-03-12 20:40:18 CET

$ build-san/journalctl --list-boots --file boot-test.journal -o json-pretty
[
        {
                "index" : -3,
                "boot_id" : "39d66eb1925f4d01b8464d502650a714",
                "first_entry" : 1646490033438495,
                "last_entry" : 1646493561047353
        },
        {
                "index" : -2,
                "boot_id" : "5dffeb08a27344d5ae9e2fc244bbcbc5",
                "first_entry" : 1647015837289036,
                "last_entry" : 1647016711595489
        },
        {
                "index" : -1,
                "boot_id" : "c8ebd52915b642c39eda4bf00f864f79",
                "first_entry" : 1647016721056382,
                "last_entry" : 1647025426397414
        },
        {
                "index" : 0,
                "boot_id" : "00bcba97c7094fa88cc5d1cf2a389057",
                "first_entry" : 1647113948506002,
                "last_entry" : 1647114018943637
        }
]
```

Resolves: #14625

3 years agomacro: account for negative values in DECIMAL_STR_WIDTH()
Frantisek Sumsal [Sun, 13 Mar 2022 13:45:03 +0000 (14:45 +0100)] 
macro: account for negative values in DECIMAL_STR_WIDTH()

With negative numbers we wouldn't account for the minus sign, thus
returning a string with one character too short, triggering buffer
overflows in certain situations.

3 years agodoc: fix error code
Yu Watanabe [Sun, 13 Mar 2022 09:34:39 +0000 (18:34 +0900)] 
doc: fix error code

3 years agotime-util: support parsing OUTPUT_SHORT and OUTPUT_SHORT_PRECISE timestamps
Frantisek Sumsal [Sat, 12 Mar 2022 11:17:46 +0000 (12:17 +0100)] 
time-util: support parsing OUTPUT_SHORT and OUTPUT_SHORT_PRECISE timestamps

so we can feed journalctl the localized syslog-style timestamps it shows
by default, e.g.:

```
$ LANG=cs_CZ.utf-8 build-san/journalctl -b --no-hostname | head -n1
led 30 22:13:54 systemd-journald[981]: System Journal (/var/log/journal/1588e1d9d0b74acdbaada907b163b837) is 4.1G, max 4.0G, 0B free.
$ LANG=cs_CZ.utf-8 build-san/journalctl --no-hostname --since 'led 30 22:13:54' -n1
led 30 22:13:54 systemd-journald[981]: System Journal (/var/log/journal/1588e1d9d0b74acdbaada907b163b837) is 4.1G, max 4.0G, 0B free.
$ LANG=cs_CZ.utf-8 build-san/journalctl --no-hostname --since 'led 30 22:13:54.9999' -n1
led 30 22:13:58 rsyslogd[1300]: imjournal: journal files changed, reloading...  [v8.2102.0-4.fc35 try https://www.rsyslog.com/e/0 ]
```

Resolves: #15899

3 years agoMerge pull request #22463 from poettering/kernel-install-propagate-machine-id
Luca Boccassi [Sat, 12 Mar 2022 17:17:28 +0000 (17:17 +0000)] 
Merge pull request #22463 from poettering/kernel-install-propagate-machine-id

kernel-install: clean-up machine-id handling

3 years agoMerge pull request #22711 from yuwata/c11
Yu Watanabe [Sat, 12 Mar 2022 05:27:48 +0000 (14:27 +0900)] 
Merge pull request #22711 from yuwata/c11

move to C11 (gnu11) and use u8 specifier for special characters

3 years agoMerge pull request #22714 from mrc0mmand/codeql-docs
Luca Boccassi [Fri, 11 Mar 2022 19:03:38 +0000 (19:03 +0000)] 
Merge pull request #22714 from mrc0mmand/codeql-docs

A couple of doc updates

3 years agoresolve: update the referenced RFC & section for mDNS 22714/head
Frantisek Sumsal [Fri, 11 Mar 2022 15:55:55 +0000 (16:55 +0100)] 
resolve: update the referenced RFC & section for mDNS

Resolves: #20386

3 years agotest: document how to run CodeQL/LGTM stuff manually
Frantisek Sumsal [Fri, 11 Mar 2022 15:51:53 +0000 (16:51 +0100)] 
test: document how to run CodeQL/LGTM stuff manually

Let's have this documented somewhere so I don't have to relearn all this
stuff every time I need it.

3 years agoMerge pull request #22631 from yuwata/network-redesign-request-queue
Luca Boccassi [Fri, 11 Mar 2022 10:48:45 +0000 (10:48 +0000)] 
Merge pull request #22631 from yuwata/network-redesign-request-queue

network: re-design request queue

3 years agoNEWS: add NEWS entry highlighting what the "entry-token" logic means for "gold image... 22463/head
Lennart Poettering [Tue, 15 Feb 2022 16:59:36 +0000 (17:59 +0100)] 
NEWS: add NEWS entry highlighting what the "entry-token" logic means for "gold image" builders

3 years agobootctl: update to new kernel-install semantics
Lennart Poettering [Thu, 10 Feb 2022 17:01:36 +0000 (18:01 +0100)] 
bootctl: update to new kernel-install semantics

This makes a bunch of closely related changes:

1. The "entry-token" concept already introduced in kernel-install is now
   made use of. i.e. specifically there's a new option --entry-token=
   that can be used to explicitly select by which ID to identify boot
   loader entries: the machine ID, or some OS ID (ID= or IMAGE_ID= from
   /etc/os-release, or even some completely different string. The
   selected string is then persisted to /etc/kernel/entry-token, so that
   kernel-install can find it there.

2. The --make-machine-id-directory= switch is renamed to
   --make-entry-directory= since after all it's not necessarily the
   machine ID the dir is named after, but can be any other string as
   selected by the entry token.

3. This drops all code to make automatic changes to /etc/machine-info.
   Specifically, the KERNEL_INSTALL_MACHINE_ID= field is now more
   generically implemented in /etc/kernel/entry-token described above,
   hence no need to place it at two locations. And the
   KERNEL_INSTALL_LAYOUT= field is not configurable by user switch or
   similar anyway in bootctl, but only read from
   /etc/kernel/install.conf, and hence copying it from one configuration
   file to another appears unnecessary, the second copy is fully
   redundant. Note that this just drops writing these fields, they'll
   still be honoured when already set.

3 years agoman: document recent changes
Lennart Poettering [Thu, 10 Feb 2022 14:27:45 +0000 (15:27 +0100)] 
man: document recent changes

This drops documentation of KERNEL_INSTALL_MACHINE_ID as machine-info
field (though we'll still read it for compat).

This updates the kernel-install man page to always say "ENTRY-TOKEN"
instead of "MACHINE-ID" where appropriate, to clear the confusion up
between the two.

This also tries to fix how we denote env vars (always prefix with $ and
without = suffix), and other vars (without $ but with = suffix)

Other fixes.

3 years agokernel-install: add new "inspect" verb, showing paths and parameters we discovered
Lennart Poettering [Thu, 10 Feb 2022 13:37:37 +0000 (14:37 +0100)] 
kernel-install: add new "inspect" verb, showing paths and parameters we discovered

3 years agokernel-install: search harder for kernel image/initrd drop-in dir
Lennart Poettering [Thu, 10 Feb 2022 13:27:22 +0000 (14:27 +0100)] 
kernel-install: search harder for kernel image/initrd drop-in dir

If not explicitly configured, let's search a bit harder for the
ENTRY_TOKEN, and let's try the machine ID, the IMAGE_ID and ID fields of
/etc/os-release and finally "Default", all below potential $XBOOTLDR.

3 years agokernel-install: only generate systemd.boot_id= in kernel command line if used for...
Lennart Poettering [Wed, 9 Feb 2022 13:44:48 +0000 (14:44 +0100)] 
kernel-install: only generate systemd.boot_id= in kernel command line if used for naming the boot loader spec files/dirs

Now that we can distinguish the naming of the boot loader spec
dirs/files and the machine ID let's tweak the logic for suffixing the
kernel cmdline with systemd.boot_id=: let's only do that when we
actually need the boot ID for naming these dirs/files. If we don't,
let's not bother.

This should be beneficial for "golden" images that shall not carry any
machine IDs at all, i.e acquire their identity only once the final
userspace is actually reached.

3 years agokernel-install: add a new $ENTRY_TOKEN variable for naming boot entries
Lennart Poettering [Wed, 9 Feb 2022 13:29:19 +0000 (14:29 +0100)] 
kernel-install: add a new $ENTRY_TOKEN variable for naming boot entries

This cleans up naming of boot loader spec boot entries a bit (i.e. the
naming of the .conf snippet files, and the directory in $BOOT where the
kernel images and initrds are placed), and isolates it from the actual machine
ID concept.

Previously there was a sinlge concept for both things, because typically
the entries are just named after the machine ID. However one could also
use a different identifier, i.e. not a 128bit ID in which cases issues
pop up everywhere. For example, the "machine-id" field in the generated
snippets would not be a machine ID anymore, and the newly added
systemd.machine_id= kernel parameter would possibly get passed invalid
data.

Hence clean this up:

$MACHINE_ID → always a valid 128bit ID.

$ENTRY_TOKEN → usually the $MACHINE_ID but can be any other string too.
This is used to name the directory to put kernels/initrds in. It's also
used for naming the *.conf snippets that implement the Boot Loader Type
1 spec.

3 years agokernel-install: don't try to persist used machine ID locally
Lennart Poettering [Wed, 9 Feb 2022 12:59:36 +0000 (13:59 +0100)] 
kernel-install: don't try to persist used machine ID locally

This reworks the how machine ID used by the boot loader spec snippet
generation logic. Instead of persisting it automatically to /etc/ we'll
append it via systemd.machined_id= to the kernel command line, and thus
persist it in the generated boot loader spec snippets instead. This has
nice benefits:

  1. We do not collide with read-only root
  2. The machine ID remains stable across factory reset, so that we can
     safely recognize the path in $BOOT we drop our kernel images in
     again, i.e. kernel updates will work correctly and safely across
     kernel factory resets.
  3. Previously regular systems had different machine IDs while in
     initrd and after booting into the host system. With this change
     they will now have the same.

This then drops implicit persisting of KERNEL_INSTALL_MACHINE_ID, as its
unnecessary then. The field is still honoured though, for compat
reasons.

This also drops the "Default" fallback previously used, as it actually
is without effect, the randomized ID generation already took precedence
in all cases. This means $MACHNE_ID/KERNEL_INSTALL_MACHINE_ID are now
guaranteed to look like a proper machine ID, which is useful for us,
given you need it that way to be able to pass it to the
systemd.machine_id= kernel command line option.

3 years agoMerge pull request #22618 from yuwata/network-safe-string
Lennart Poettering [Fri, 11 Mar 2022 10:33:07 +0000 (11:33 +0100)] 
Merge pull request #22618 from yuwata/network-safe-string

network: dhcp-server: refuse unsafe filename

3 years agofix signature of sd_journal_print_with_location in docs
Marcel Hellwig [Fri, 11 Mar 2022 07:23:45 +0000 (08:23 +0100)] 
fix signature of sd_journal_print_with_location in docs

3 years agogitignore: ignore mkosi.installdir
Clyde Byrd III [Fri, 11 Mar 2022 01:43:26 +0000 (17:43 -0800)] 
gitignore: ignore mkosi.installdir

3 years agolgtm: disable cpp/missing-return 22711/head
Yu Watanabe [Fri, 11 Mar 2022 08:19:29 +0000 (17:19 +0900)] 
lgtm: disable cpp/missing-return

As it does not handle assert_not_reahed() gracefully.

3 years agoqrcode-util: use u8 literal specifier
Yu Watanabe [Fri, 11 Mar 2022 06:59:58 +0000 (15:59 +0900)] 
qrcode-util: use u8 literal specifier

3 years agohostnamectl: use u8 literal specifier
Yu Watanabe [Fri, 11 Mar 2022 06:53:18 +0000 (15:53 +0900)] 
hostnamectl: use u8 literal specifier

3 years agoglyph-util: use u8 literal specifier for special characters
Yu Watanabe [Fri, 11 Mar 2022 06:34:27 +0000 (15:34 +0900)] 
glyph-util: use u8 literal specifier for special characters

3 years agomeson: move to c_std=gnu11
Yu Watanabe [Fri, 11 Mar 2022 06:13:23 +0000 (15:13 +0900)] 
meson: move to c_std=gnu11

Recently, the kernel communitiy started to discuss to move C11 (gnu11) [1],
and it seems to come near future.
Let's also move to c_std=gnu11. Unlike the kernel, we already uses
gnu99, hence hopefully we can move to C11 without changing anything.

[1] https://lore.kernel.org/lkml/CAHk-=wiyCH7xeHcmiFJ-YgXUy2Jaj7pnkdKpcovt8fYbVFW3TA@mail.gmail.com/

3 years agonetwork: re-design request queue 22631/head
Yu Watanabe [Mon, 28 Feb 2022 01:55:51 +0000 (10:55 +0900)] 
network: re-design request queue

This makes Request object takes hash, compare, free, and process functions.

With this change, the logic in networkd-queue.c can be mostly
independent of the type of the request or the object (e.g. Address) assigned
to the request, and it becomes simpler.

3 years agonetwork: increment reference counters of Link and Request before processing requests
Yu Watanabe [Mon, 28 Feb 2022 02:21:24 +0000 (11:21 +0900)] 
network: increment reference counters of Link and Request before processing requests

To prevent the request or link is freed while processing requests.

3 years agonetwork: merge RequestType and SetLinkOperation
Yu Watanabe [Mon, 28 Feb 2022 02:03:11 +0000 (11:03 +0900)] 
network: merge RequestType and SetLinkOperation

These two enum indicate how we process the request. Hence, it is not
necessary to introduce two separated indicators.

3 years agonetwork: refuse to configure link properties when in initialized state
Yu Watanabe [Mon, 28 Feb 2022 02:15:01 +0000 (11:15 +0900)] 
network: refuse to configure link properties when in initialized state

The condition should be satisfied only when users request to reconfigure
the link, and in that case, all request will be cancelled. Hence, it is
not necessary to process the request.

3 years agonetwork: drop unnecessary link_enter_failed()
Yu Watanabe [Mon, 28 Feb 2022 02:00:56 +0000 (11:00 +0900)] 
network: drop unnecessary link_enter_failed()

As returning negative errno makes the link will enter the failed state.

3 years agonetwork: introduce request_call_netlink_async()
Yu Watanabe [Mon, 28 Feb 2022 00:20:42 +0000 (09:20 +0900)] 
network: introduce request_call_netlink_async()

In most netlink handlers, we do the following,
1. decrease the message counter,
2. check the link state,
3. error handling,
4. update link state via e.g. link_check_ready().

The first two steps are mostly common, hence let's extract it.

Moreover, this is not only extracting the common logic, but provide a
strong advantage; `request_call_netlink_async()` assigns the relevant
Request object to the userdata of the netlink slot, and the request object
has full information about the message we sent. Hence, in the future,
netlink handler can print more detailed error message. E.g. when
an address is failed to configure, then currently we only show an
address is failed to configure, but with this commit, potentially we can
show which address is failed explicitly.

This does not change such error handling yet. But let's do that later.

3 years agonetwork: make Request object take Manager*
Yu Watanabe [Sun, 27 Feb 2022 06:39:16 +0000 (15:39 +0900)] 
network: make Request object take Manager*

Previously, even though all Request object are owned by Manager, they
do not have direct reference to Manager, but through Link or NetDev
object. But, as Link or NetDev can be NULL, we need to conditionalize
how to access Manager from Request with the type of the request.
This makes the way simpler, as now Request object has direct reference
to Manager.

This also rename request_drop() -> request_detach(), as in the previous
commit, the reference counter is introduced, so even if a reference of
a Request object from Manager is dropped, the object may still alive.
The naming `request_drop()` sounds the object will freed by the
function. But it may not. And `request_detach()` suggests the object
will not be managed by Manager any more, and I think it is more
appropreate.

This is just a cleanup, and should not change any behavior.

3 years agonetwork: introduce reference counter for Request object
Yu Watanabe [Sun, 27 Feb 2022 06:18:01 +0000 (15:18 +0900)] 
network: introduce reference counter for Request object

Currently, all Request object are always owned by Manager, and freed
when it is processed, especially, soon after a netlink message is sent.
So, it is not necessary to introduce the reference counter.

In a later commit, the Request object will _not_ be freed at the time
when a netlink message is sent, but assigned to the relevant netlink
slot as a userdata, and will be freed when a reply is received. So, the
owner of the Request object is changed in its lifetime. In that case, it
is convenient that the object has reference counter to avoid memleak or
double free.

3 years agonetwork: make request_process_address() and friends take Link and corresponding object
Yu Watanabe [Sat, 26 Feb 2022 06:56:39 +0000 (15:56 +0900)] 
network: make request_process_address() and friends take Link and corresponding object

This also renames e.g. request_process_address() -> address_process_request().

Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`,
as in the later commits, the function of processing request, e.g.
`address_process_request()`, will be assigned to the Request object when
it is created. And the request type will be used to distinguish and to
avoid deduplicating requests which do not have any assigned objects,
like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions
are mostly not necessary and redundant.

This is mostly cleanups and preparation for later commits, and should
not change any behavior.

3 years agonetwork: make address_configure() and friends take Request object
Yu Watanabe [Fri, 11 Mar 2022 01:40:59 +0000 (10:40 +0900)] 
network: make address_configure() and friends take Request object

This should not change any behavior.
Just a preparation for a later commit which introduces
request_call_netlink_async().

3 years agonetwork: tc: assign netlink handlers into Request object
Yu Watanabe [Fri, 11 Mar 2022 01:38:59 +0000 (10:38 +0900)] 
network: tc: assign netlink handlers into Request object

This should not change any behavior, as req->netlink_handler is always
qdisc_handler or tclass_handler.

This is just a preparation for a later commit which introduces
request_call_netlink_async().

3 years agoalloc-util: introduce mfree_func_type_t
Yu Watanabe [Fri, 18 Feb 2022 06:24:23 +0000 (15:24 +0900)] 
alloc-util: introduce mfree_func_type_t

3 years agonetwork: dhcp: rename NextServer= and Filename= settings 22618/head
Yu Watanabe [Mon, 7 Mar 2022 10:57:09 +0000 (19:57 +0900)] 
network: dhcp: rename NextServer= and Filename= settings

And make the settings configures DHCP option 66 and 67.

Follow-ups for #22615.
Fixes #22661.

3 years agoMerge pull request #22701 from poettering/raise-memlock
Luca Boccassi [Fri, 11 Mar 2022 01:09:33 +0000 (01:09 +0000)] 
Merge pull request #22701 from poettering/raise-memlock

pid1/nspawn: raise RLIMIT_MEMLOCK to 8M matching kernel 5.16's new default

3 years agocore/dbus-job: Use new way of specifying sd-bus vtable parameter names
Clyde Byrd III [Thu, 10 Mar 2022 08:47:20 +0000 (00:47 -0800)] 
core/dbus-job: Use new way of specifying sd-bus vtable parameter names

3 years agohostname-util: normalize get_pretty_hostname() call semantics
Lennart Poettering [Thu, 10 Mar 2022 17:20:11 +0000 (18:20 +0100)] 
hostname-util: normalize get_pretty_hostname() call semantics

get_pretty_hostname() so far had semantics not in line with our usual
ones: the return parameter was actually freed before the return string
written into it, because that's what parse_env_file() does. Moreover,
when the value was not set it would return NULL but succeed.

Let's normalize this, and only fill in the return value if there's
something set, and never read from it, like we usually do with return
parameter, and in particular those named "ret_xyz".

The existing callers don't really care about the differences, but it's
nicer to normalize behaviour to minimize surprises.

3 years agoMerge pull request #22705 from mrc0mmand/pretty_hostname_specifier
Luca Boccassi [Thu, 10 Mar 2022 21:45:34 +0000 (21:45 +0000)] 
Merge pull request #22705 from mrc0mmand/pretty_hostname_specifier

core: introduce %R specifier for pretty hostname

3 years agocgls: mangle user-provided unit names
Frantisek Sumsal [Thu, 10 Mar 2022 14:18:45 +0000 (15:18 +0100)] 
cgls: mangle user-provided unit names

so the CLI interface is now similar to `systemctl`, i.e. if no unit name
suffix is provided, assume `.service`.

Fixes: #20492
Before:
```
$ systemd-cgls --unit user@1000
Failed to query unit control group path: Invalid argument
Failed to list cgroup tree: Invalid argument
```

After:
```
$ build/systemd-cgls --unit user@1000
Unit user@1000.service (/user.slice/user-1000.slice/user@1000.service):
├─session.slice (#4939)
│ ├─pipewire-pulse.service (#5203)
│ │ └─7711 /usr/bin/pipewire-pulse
...
```

3 years agocore: support ExtensionDirectories in user manager
Luca Boccassi [Thu, 10 Mar 2022 01:30:08 +0000 (01:30 +0000)] 
core: support ExtensionDirectories in user manager

Unprivileged overlayfs is supported since Linux 5.11. The only
change needed to get ExtensionDirectories to work is to avoid
hard-coding the staging directory to the system manager runtime
directory, everything else just works (TM).

3 years agopo: Translated using Weblate (Georgian)
Temuri Doghonadze [Thu, 10 Mar 2022 18:17:00 +0000 (19:17 +0100)] 
po: Translated using Weblate (Georgian)

Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ka/
Translation: systemd/main

3 years agocore: introduce %R specifier for pretty hostname 22705/head
Frantisek Sumsal [Thu, 10 Mar 2022 15:15:54 +0000 (16:15 +0100)] 
core: introduce %R specifier for pretty hostname

Resolves: #20054

3 years agoMerge pull request #22460 from bluca/monitor_refactor
Lennart Poettering [Thu, 10 Mar 2022 17:34:20 +0000 (18:34 +0100)] 
Merge pull request #22460 from bluca/monitor_refactor

core: split $MONITOR_METADATA and return it only if a single unit triggers OnFailure/OnSuccess

3 years agopid1,nspawn: raise default RLIMIT_MEMLOCK to 8M 22701/head
Lennart Poettering [Thu, 10 Mar 2022 12:22:57 +0000 (13:22 +0100)] 
pid1,nspawn: raise default RLIMIT_MEMLOCK to 8M

This mirrors a similar check in Linux kernel 5.16
(9dcc38e2813e0cd3b195940c98b181ce6ede8f20) that raised the
RLIMIT_MEMLOCK to 8M.

This change does two things: raise the default limit for nspawn
containers (where we try to mimic closely what the kernel does), and
bump it when running on old kernels which still have the lower setting.

Fixes: #16300
See: https://lwn.net/Articles/876288/

3 years agomain: add 'const' on two function arguments
Lennart Poettering [Thu, 10 Mar 2022 12:22:32 +0000 (13:22 +0100)] 
main: add 'const' on two function arguments

3 years agoMerge pull request #22682 from bluca/start_skip
Luca Boccassi [Thu, 10 Mar 2022 17:25:44 +0000 (17:25 +0000)] 
Merge pull request #22682 from bluca/start_skip

core: do not return 'skipped' when Condition*= fail with StartUnitWithFlags()

3 years agoMerge pull request #22695 from poettering/crash-handle-refactor
Luca Boccassi [Thu, 10 Mar 2022 16:42:50 +0000 (16:42 +0000)] 
Merge pull request #22695 from poettering/crash-handle-refactor

pid1: add comment clarifying not to use memory allocation from crash handler

3 years agocore: be a bit more defensive when resolving specifiers
Frantisek Sumsal [Thu, 10 Mar 2022 16:14:04 +0000 (17:14 +0100)] 
core: be a bit more defensive when resolving specifiers

3 years agomanager: pass monitor metadata in more cases 22460/head
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 09:49:26 +0000 (10:49 +0100)] 
manager: pass monitor metadata in more cases

The first ExecStartPre or the first ExecStart commands would get the metadata,
but not the subsequent ones. Also check that we do not pass it in
ExecStartPost.

3 years agomanager: prevent cleanup of triggering units before we start the handler
Zbigniew Jędrzejewski-Szmek [Wed, 2 Mar 2022 12:09:06 +0000 (13:09 +0100)] 
manager: prevent cleanup of triggering units before we start the handler

This fixes the following case:
OnFailure= would be spawned correctly, but OnSuccess= would be
spawned without the MONITOR_* metadata, because we'd "collect" the unit
that started successfully. So let's block cleanup while we have a job
running for the handler. The job cannot last infinitely, so at some point
we'll be able to collect both.

3 years agomanager/service: when we have multiple candidates to handle, warn
Zbigniew Jędrzejewski-Szmek [Wed, 2 Mar 2022 12:05:50 +0000 (13:05 +0100)] 
manager/service: when we have multiple candidates to handle, warn

This would be very confusing to users, so let's warn if they configured the
same handler for multiple units and we're not running it as expected.

3 years agomanager/service: when we spawn, say why
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 10:59:48 +0000 (11:59 +0100)] 
manager/service: when we spawn, say why

We already logged what we are spawning, but not so much why. Let's
add this, so it's easier to distinguish execstartpre/execstart/execstartpost
and such.

3 years agomanager: log how many OnSuccess/OnFailure jobs were started
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 10:33:07 +0000 (11:33 +0100)] 
manager: log how many OnSuccess/OnFailure jobs were started