Commit graph

65792 commits

Author SHA1 Message Date
Lennart Poettering 983d621e11 hostname-setup: don't pass "true" to a flags parameter 2023-07-06 03:10:31 +08:00
Mike Yuan 3121374ca4
Merge pull request #28252 from yuwata/journal-open-machine
journal: introduce journal_open_machine()
2023-07-06 03:08:18 +08:00
Yu Watanabe 7050d928be journal-upload: add missing assertion 2023-07-06 00:06:25 +09:00
Yu Watanabe 5c6673afab journal-upload: replace deprecated sd_journal_open_container() 2023-07-06 00:06:25 +09:00
Yu Watanabe 2ec1fb31e9 journal-util: extract journal_open_machine() from journalctl 2023-07-06 00:06:25 +09:00
Yu Watanabe 4a45a2e0e3 sd-journal: introduce SD_JOURNAL_TAKE_DIRECTORY_FD flag for sd_journal_open_directory_fd()
If it is called with the flag, then the provided file descriptor will be
owned by the sd_journal object, and will be closed in sd_journal_close().
2023-07-06 00:06:20 +09:00
Lennart Poettering 529ba8a1a3
Merge pull request #26844 from YHNdnzj/propagate-stop-fixup
core: introduce UNIT_ATOM_PROPAGATE_STOP_GRACEFUL for PropagatesStopTo=
2023-07-05 15:56:21 +02:00
Luca Boccassi 11d797d3b9
Merge pull request #28207 from poettering/initrd-creds
various credential improvements (including initrd creds, creds in generators, fstab + getty creds)
2023-07-05 10:29:33 +01:00
Lennart Poettering 7b8e55772c
Merge pull request #28253 from yuwata/hwdb-follow-up
hwdb: several cleanups
2023-07-05 10:40:44 +02:00
Yu Watanabe 051c0f8926
Merge pull request #28228 from yuwata/repart-free-area
repart: fix free area calculation
2023-07-05 16:36:16 +09:00
Yu Watanabe 6750c1af24 unit: also condition out systemd-backlight in initrd
Follow-up for 9173d31dfea5c2b05ff08480972c499cb7aac940.

The systemd-backlight@.service also save/restore state but the data
is in /var/.
2023-07-05 09:01:27 +02:00
Lennart Poettering 49c55abcbe units: condition out a few services in the initrd
Let's make our units more robust to being added to an initrd:

1. systemd-boot-update only makes sense if sd-boot is available in /usr/
   to copy into the ESP. This is generally not the case in initrds, and
   even if it was, we shouldn't update the ESP from the initrd, but from
   the host instead.

2. The rfkill services save/restore rfkill state, but that information
   is only available once /var/ is mounted, which generally happens
   after the initrd transition.

3. utmp management is partly in /var/, and legacy anyway, hence don't
   bother with it in the initrd.
2023-07-05 10:58:47 +09:00
Yu Watanabe 937625c7c7 test: update test for free area calculation in repart 2023-07-05 10:40:56 +09:00
Yu Watanabe d2eb1f8145 repart: fix free area calculation
Like fdisk_get_last_lba(), fdisk_partition_get_end() return the last
sector in the partition.

Fixes #28225.
2023-07-05 10:40:56 +09:00
Yu Watanabe beba8f2e1e test: add reproducer for issue #28225 2023-07-05 10:40:53 +09:00
Yu Watanabe 495f387c27 hwdb: make matching modalias for Archos 101 Cesium Educ more strict
Follow-up for 41f34dcf3b.
2023-07-05 10:38:00 +09:00
Yu Watanabe 65d7d832a9 hwdb: merge multiple keyboard entries with same setting
Follow-up for 123c0e24dd.

Note, the entry was originally added for IdeaPad Flex 5 in
21b589a155.
Then, a bug introduced by 19db450f3a.
But, when it was fixed by 738a195bd5,
the glob becomes too stricter, and another variant was added by
123c0e24dd.
2023-07-05 10:34:04 +09:00
Yu Watanabe f94b944bf5 hwdb: drop trailing white space
Follow-up for 4687f001e6.
2023-07-05 10:22:13 +09:00
Yu Watanabe 12fff85d55 journal-upload: make --namespace=* work
Follow-up for 9f6e0bd417.

Note that sd_journal_open() is a simple wrapper of sd_journal_open_namespace(),
hence we can merge the two branch.
2023-07-05 09:21:24 +09:00
Mike Yuan 5db456d065
test: add test cases for issue #26839 in TEST-03-JOBS 2023-07-05 08:15:35 +08:00
Mike Yuan 48cb073db8
core: introduce UNIT_ATOM_PROPAGATE_STOP_GRACEFUL for PropagatesStopTo=
Follow-up for 017a7ba4f4

Before this commit, when a unit that is restarting propagates stop
to other units, it can also depend on them, which results in
job type conflict and thus failure to pull in the dependencies.

So, let's introduce a new dependency atom UNIT_ATOM_PROPAGATE_STOP_GRACEFUL,
and use it for PropagatesStopTo=. It will enqueue a restart job if
there's already a start job, which meets the ultimate goal and avoids
job type conflict.

Fixes #26839
2023-07-05 08:15:35 +08:00
Mike Yuan 87d17581af
core/transaction: return early when appropriate to reduce nesting 2023-07-05 08:15:34 +08:00
Mike Yuan e9bd185316
man/systemctl: document --job-mode=restart-dependencies
Follow-up for 09d04ad325
2023-07-05 08:15:34 +08:00
Lennart Poettering aafd429ca7 update TODO 2023-07-04 23:20:33 +02:00
Lennart Poettering de70ecb328 import-creds: add support for binary credentials specified on the kernel cmdline 2023-07-04 23:19:48 +02:00
Lennart Poettering 49850c1ee3 man: document where PID 1 imports credentials from 2023-07-04 23:18:59 +02:00
Lennart Poettering 771c76294a man: document how credentials are passed into generators 2023-07-04 23:18:11 +02:00
Lennart Poettering df5f51c3fe doc: document inird credentials + and how to consume credentials in generators
(as well as various other fixes)
2023-07-04 23:17:17 +02:00
Lennart Poettering 3ed075cf61 generator: run various generators only run on the host, not in initrd
These 5 generators only make sense on the host,not in the initrd, hence
if they end up in the initrd anyway, make them exit quickly.
2023-07-04 23:15:36 +02:00
Lennart Poettering 53888c3393 test: verify that the getty generator with creds works 2023-07-04 23:14:21 +02:00
Lennart Poettering fd2de366e1 getty-generator: minor modernizations 2023-07-04 23:12:38 +02:00
Lennart Poettering cdd133b3dd getty-generator: allow configuring additional gettys via credentials 2023-07-04 23:11:03 +02:00
Lennart Poettering 51235f2fe6 test: add simple fstab credential test 2023-07-04 23:09:39 +02:00
Lennart Poettering 3a065dfc29 fstab-generator: add more parameter name comments 2023-07-04 23:08:01 +02:00
Lennart Poettering 6ac62485cf fstab-generator: optional read addtional fstab lines from credentials
Fixes: #27260
2023-07-04 23:06:48 +02:00
Lennart Poettering 4a262d5677 test: add test for initrd credentials
This extends the test framework a bit, and allows adding additional
initrds to the qemu invocation, which we use here to place credentials
in the new /run/systemd/@initrd/ credentials dir which are then passed
to the host.
2023-07-04 23:05:23 +02:00
Lennart Poettering bfa6d9cc64 import-creds: unify acquire_credential_directory() + acquire_encrypted_credential_directory()
Let's unify these very similar functions, and port them to the new
mount_credentials_fs() call.

While we are at it, if we detect that the credentials dir already is a
mount point, remount it writable so that we can actually write to it.
2023-07-04 23:04:24 +02:00
Lennart Poettering 1155f44f48 execute: split out mounting of credentials fs
Let's add two new helpers: mount_credentials_fs() and
credentials_fs_mount_flags(). The former mounts a file system suitable
for storing of unencrypted credentials at runtime (i.e. a ramfs or
tmpfs). The latter determines the right mount flags to use for such a
mount.

Both functions mostly just take code from execute.c, but make two
changes:

1. If the kernel supports it we'll use a tmpfs with the new "noswap"
   mount option instead of ramfs. Was added in kernel 6.4, hence is very
   recent, but tmpfs is so much less crappy than ramfs, hence worth it.

2. We'll set MS_NOSYMFOLLOW on the mounts if supported. These file
   systems should only contain regulra files, hence no need to allow
   symlinks.
2023-07-04 23:03:24 +02:00
Lennart Poettering 7ca59e67b1 import-creds: show list of imported credentials during initialization of PID 1
Let's make things easier to debug: provide an overview what has been
passed, during boot.
2023-07-04 23:02:31 +02:00
Lennart Poettering deb0d489ea core: consult credentials for machine ID to use for host
Let's hook up one more thing with credentials: the machine ID to use
when none is initialized yet.

This requires some reordering of initialization steps in PID 1: we need
to import credentials first, and only then initialize the machine ID.
2023-07-04 23:01:42 +02:00
Lennart Poettering d021aa8ee3 import-creds: pick up vmm.notify_socket also from encrypted credentials
Now that we have the infra in place, make PID 1 pick up encrypted
credentials too.

(While we are at it, split this out into its own helper)
2023-07-04 23:00:54 +02:00
Lennart Poettering 49e859b7c7 creds-util: add new helper read_credential_with_decryption()
This is just like read_credential() but also looks into the encrypted
credential directory, not just the regular one.

Normally, we decrypt credentials at the moment we pass them to services.
From service PoV all credentials are hence decrypted credentials.

However, when we want to access credentials in a generator this logic
does not apply: here we have the regular and the encrypted credentials
directory. So far we didn't attempt to make use of credentials in
generators hence.

Let's address and add helper that looks into both directories, and talks
to the TPM if necessary to decrypt the credentials.
2023-07-04 22:59:57 +02:00
Lennart Poettering 0dea5b7719 import-creds: define a new dir where initrd configurators can pass credentials to host 2023-07-04 22:59:07 +02:00
Lennart Poettering f76ce81b91 execute: fix credential dir handling for fs which support ACLs
When the credential dir is backed by an fs that supports ACLs we must be
more careful with adjusting the 'x' bit of the directory, as any chmod()
call on the dir will reset the mask entry of the ACL entirely which we
don't want. Hence, do a manual set of ACL changes, that only add/drop
the 'x' bit but otherwise leave the ACL as it is.

This matters if we use tmpfs rather than ramfs to store credentials.
2023-07-04 22:58:01 +02:00
Lennart Poettering 8914f7e8e4 man: make sure credentials properly show up in directives index 2023-07-04 22:56:59 +02:00
Igor Tsiglyar 9f6e0bd417 journal-remote: upload journals from namespace 2023-07-04 18:47:54 +01:00
Thomas Genty 41f34dcf3b hwdb : add support for Archos 101 Cesium Educ to 60-sensor.hwdb 2023-07-04 17:00:52 +01:00
Lennart Poettering d5163f9c87 NEWS/--help: correct/be clearer on bootclt -R vs. -RR
The NEWS file was simply wrong. Let's also improve the --help text on
this.

Fixes: #28221
2023-07-04 12:50:22 +01:00
Lennart Poettering 0b20c56ee1 hibernate-resume-generator: downgrade 'noresume' log message
This log message is shown pretty regular at boot in various scenarios
(such as CI builds), and it's not a reason for any concern, it's just the
immediate effect of explicit configuration. Hence let's downgrade from
LOG_NOTICE to LOG_INFO so that it is still usually in the boot output,
but not particularly highlighted, since there's really no reason to.
2023-07-04 12:30:33 +01:00
Lennart Poettering c86a95082b systemctl: implement a new "whoami" verb, that just returns unit of caller/PID 2023-07-04 01:05:02 +01:00