1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00
Commit Graph

67882 Commits

Author SHA1 Message Date
Yu Watanabe
d67078b4a3 sd-journal: rewrite conditions for test result and direction
No functional change, just refactoring. Hopefully the condition is more
descriptive now.
2023-10-06 09:55:00 +09:00
Yu Watanabe
3b0ae13bbf test: add reproducer for SIGBUS issue caused by journal truncation
The added code fails without the previous commit.

For issue #24320.
2023-10-06 09:24:55 +09:00
Luca Boccassi
85d0fd29af
Merge pull request #29438 from evelikov/document-rm-extra-uefi-vars
Document and purge LoaderConfigConsoleMode and LoaderEntryLastBooted
2023-10-06 00:12:49 +01:00
Lennart Poettering
3fe418a571 machinectl: align UID shift status field properly 2023-10-05 23:23:52 +01:00
Lennart Poettering
e7df707b8a image-discover: skip properly over files that cannot be recognized as image files
Follow-up for: #29364
2023-10-05 23:23:31 +01:00
Lennart Poettering
c79e760f36
Merge pull request #29364 from poettering/make-ddi-easy
repart: make building DDIs easier (and other fixes)
2023-10-05 21:13:13 +02:00
Mike Yuan
4146960ee9 systemctl-show: align "Cntrl PID" correctly 2023-10-05 19:37:44 +01:00
Lennart Poettering
634b847149 repart: make arg_empty a proper enum with a string table
Now that we translate in both directions (from enum to string, and
string to enum) let's just make the thing a proper enum with a proper
string table, like we generally do.
2023-10-05 19:18:36 +02:00
Lennart Poettering
99d9edf0bd test: test the new --make-ddi= logic 2023-10-05 19:18:36 +02:00
Lennart Poettering
e59049d7a9 repart: add simple mechanism to override fstype choices
This is very useful for quickly testing things when building DDIs, in
particular in the CI, and trivial to add.
2023-10-05 19:18:36 +02:00
Lennart Poettering
489b0f515b repart: relax rules on CopyFiles= a bit
If a source dir doesn't exist, mention this, but continue.

This is useful to permit generic definitions that apply to all kinds of
trees, where some parts might remain unpopulated.
2023-10-05 19:11:49 +02:00
Lennart Poettering
37a3878801 repart: say image file instead of loopback file
After all we can now operate without loopback device, so it might be a
big misleading.
2023-10-05 19:10:57 +02:00
Lennart Poettering
95515896f6 sysext: fix some sysextisms in confext mode
Nothing earth-shattering. Just make sure we never expose the string
"sysext" in "confext" mode.
2023-10-05 19:10:06 +02:00
Lennart Poettering
a747994b45 discover-image: nicely support .sysext.raw + .confext.raw suffix for DDIs
Back at Plumbers 2022 we discussed that we should push people towards
using the .sysext.raw and .confext.raw for their DDIs if they are
extension images. Let's actually support that, by chopping off these
suffixes when turning file names into "pretty image names".
2023-10-05 19:09:12 +02:00
Lennart Poettering
a121b331e3 repart: make it easy to generate DDIs
This adds --make-ddi=confext, --make-ddi=sysext, --make-ddi=portable, to
make it really easiy to generate DDIs of the specified class. It
it's ultimately just a fancy wrapper around some defaults and in
particular --definitions=.

This makes it very easy to generate a confext:

 $ systemd-repart -C --private-key=privkey.pem --certificate=cert.crt -s mytree/ mytree.confext.raw
2023-10-05 19:08:11 +02:00
Lennart Poettering
607343a1ac repart: add new --copy-source= switch
This specifies a directory to which CopyFiles= is considered relative.
If unset defaults to the --root=/--image= setting, or host / otherwise.

This is very similar to --root= but is much more focussed: it is really
and exclusively about CopyFiles= (and related settings such as
ExcludeFiles=) and does not affect any of the settings, i.e. it doesn't
affect CopyBlocks=, the machine ID/seed handling, or where definitions
are read from.

In fact, --root= and --copy-source= may be combined for example to
use the machine ID and similar from one tree, but the copy the files
from another.
2023-10-05 19:07:19 +02:00
Lennart Poettering
248f0186c1 repart: drop redundant () 2023-10-05 19:06:26 +02:00
Lennart Poettering
ba6bd342fa repart: get rid of redundant variable 'dry_run'
There's only one case where we set 'dry_run', which is when
--empty=create is set. Hence simplify things and directly check for
that.
2023-10-05 19:05:33 +02:00
Lennart Poettering
243dd1e9fa repart: rework --empty= handling a bit
Introduce a new enum value EMPTY_UNSET to which arg_empty now is set
initially. Only after we finished parsing the command line we'll now set
this to EMPTY_REFUSE as before.

This prepares ground for later changes, where we then can make different
decisions after havig all input from the command line.

As of now this doesn't change behaviour of systemd-repart, it just
rearranges things a bit.
2023-10-05 19:04:40 +02:00
Lennart Poettering
6c05395e82 repart: disable pager in --dry-run=no mode
When --dry-run=yes is used it makes sense to spawn a pager to look at
the report it provides you with about what it is about to do. Hoewver,
when we are actually doing it, then the output is more in the category
of "logs" than "review material", and logs we generally don't page when
we generate them.
2023-10-05 19:03:46 +02:00
Lennart Poettering
19c58989f7 repart: don't wipe the disk image if we just created it fresh
Let's avoid some unnecessary work if we the image is freshly created
anyway.
2023-10-05 19:02:53 +02:00
Lennart Poettering
2c07d314b2 fileio: revamp search_and_fopen()
Let's modernize and clean up search_and_fopen a bit: let's add support
for regular open() (instead of fopen()), as well as access() (if caller
just wants to check if a file exists without opening it.

This unifies much of the code involved, which previously was duplicated
in search_and_fopen() and search_and_fopen_nulstr()
2023-10-05 19:01:28 +02:00
Lennart Poettering
27a1719bba
Merge pull request #29455 from poettering/scope-pidref
pid1: allow creating scope units based on pidfds (as opposed to numeric pids)
2023-10-05 18:40:32 +02:00
Mike Yuan
ba96ba0420 docs/HACKING: Arch has dropped asp in favor of pkgctl
Prompted by #29461

See also: https://wiki.archlinux.org/title/Arch_build_system#Using_the_pkgctl_tool
2023-10-05 17:54:37 +02:00
Lennart Poettering
ed287b87d2 update TODO 2023-10-05 17:11:03 +02:00
Lennart Poettering
7eda208ffe tree-wide: prefer sending pifds over pids when creating scope units 2023-10-05 17:10:00 +02:00
Lennart Poettering
b0ae589b3e pidref: add trivial helper pidref_set_self() to set pidref to our handle to our own process 2023-10-05 17:08:35 +02:00
Lennart Poettering
7595fed92d pid1: allow creating scope units based in pidfds instead of plain pids 2023-10-05 17:07:06 +02:00
Daan De Meyer
6e24a9dc7f mkosi: Update to latest
We have to set the image runtime size explicitly now so that's it's
grown a bit when we boot in nspawn or qemu.
2023-10-05 16:57:10 +02:00
Daan De Meyer
d852352b9c mountpoint-util: Check hardcoded list before asking kernel if option is supported
mount_option_supported() will call fsopen() which will probe the
kernel filesystem module. This means that we'll suddenly start
probing filesystem modules when running generators as those determine
which mount options to use. To prevent generators from loading kernel
filesystem modules as much as possible, let's always first check the
hardcoded list of filesystem which we know support a feature before
falling back to asking the kernel.
2023-10-05 16:50:30 +02:00
Lennart Poettering
c6711da087
Merge pull request #29454 from poettering/cg-pidref-get-path
cgroup-util: add cg_pidref_get_path() helper and use it
2023-10-05 15:44:25 +02:00
Lennart Poettering
2db8278a81
Merge pull request #29458 from poettering/serialize-pidref
pid1: serialize pidref as pidfd if possible
2023-10-05 15:43:02 +02:00
Daan De Meyer
32a1d321d4
Merge pull request #29439 from yuwata/mmap-cache-cleanups-part2
mmap-cache: several cleanups (part2)
2023-10-05 14:49:48 +02:00
Emil Velikov
ef4976dc25 man: document LoaderEntryLastBooted
The option was introduced with systemd v250 although it went
undocumented. It effectively sits between Default and OneShot, in term
of priority.

It is repeatedly updated as long as loader.conf default is "@saved" and
the OneShot is not set.

v2:
 - squash some typos

v3:
 - special mention to default @saved + loader.conf reference
 - reword update side, to avoid misleading that it's needlessly
   overwritten

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2023-10-05 13:40:40 +01:00
Lennart Poettering
289c816952
Merge pull request #29453 from poettering/cgroup-no-controller
cgroup-util: drop "controller" argument from various cgroup helper calls
2023-10-05 13:31:02 +02:00
Lennart Poettering
1523d91939 update TODO 2023-10-05 13:28:01 +02:00
Lennart Poettering
a906224288 cgroup-util: add cg_pidref_get_path() helper and use it 2023-10-05 13:26:25 +02:00
Luca Boccassi
9482d34fb6
Merge pull request #29442 from yuwata/network-dhcp4-preferred-address
network: introduce [DHCPv4] PreferredAddress= setting
2023-10-05 12:25:42 +01:00
Lennart Poettering
68d0adea4f update TODO 2023-10-05 12:57:49 +02:00
Lennart Poettering
2a7451dc5d pid1: serialize pidrefs as pidfds if possible
One major step towards total pidfdification of systemd.
2023-10-05 12:57:05 +02:00
Daan De Meyer
0e70150be3 repart: Mention that xattrs are not copied when populating XFS with protofile 2023-10-05 12:54:02 +02:00
Emil Velikov
b207ad6344 man: document LoaderConfigConsoleMode
The variable was introduced with systemd v250 although it went
completely undocumented, even though sd-boot will honour and print it
separately (from the loader.conf one) in the boot help screen.

Document it in the systemd-boot and hint about it in loader.conf manual
pages.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2023-10-05 11:50:51 +01:00
Emil Velikov
976904bf26 bootctl: remove all our non-volatile variables on uninstall
Grepping around showed a few extra entries that are not listed in the
remove_loader_variables() function. Namely:
 - BootNext
 - OsIndications
 - LoaderConfigConsoleMode
 - LoaderEntryLastBooted

Of which the latter two are systemd specific, even though they are
undocumented. Ensure they're removed - follow-up commits will add
documentation references.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-10-05 11:50:48 +01:00
Daan De Meyer
f20c07d5ad journal-file-util: Prefer punching holes instead of truncating
It seems truncating might cause SIGBUS (#24320). Let's play it safe
and always prefer punching holes over truncating.
2023-10-05 19:15:55 +09:00
Yu Watanabe
46e98dfcc7 journal-file-util: do not fail when journal_file_set_offline() called more than once
Previously, if journal_file_set_offline() is called twice with 'wait = false',
the second call triggered segfaults, as the offline_state is OFFLINE_DONE,
and journal_file_set_offline_thread_join() tries to call pthread_join()
with NULL.
2023-10-05 19:15:55 +09:00
Yu Watanabe
ff95b60d1a test: modernize test-journal-flush 2023-10-05 19:15:55 +09:00
Lennart Poettering
b30da1c632 cgroup-util: make sure cg_get_owner() only works for cgroups, not cgroup attribute files 2023-10-05 11:12:38 +02:00
Lennart Poettering
bd1791b597 cgroup-util: drop "controller" argument from various cgroup helper calls
systemd's own cgroup hierarchy is special to us, we use it to actually
manage processes. Because of that many calls tha apply to cgroups are
only ever called with the SYSTEMD_CGROUP_CONTROLLER as controller
argument. Let's hence remove the argument altogether.

This in particular touches the kill and xattr routines.

This changes no behaviour, we just drop an argument that is always set
to the same value anyway.

This is preparation to eventually getting rid of the cgroupvs1, because
on cgroupvs2 the cgroup paths do not change for different controllers,
there's only a single hierarchy there.
2023-10-05 11:11:04 +02:00
Emil Velikov
5ee3c914a4 sd-boot: introduce and use efivar_unset()
Currently some of the code base check for the variable presence before
removing it, and some do not.

More so, in all cases (being updated) we're dealing with non-volatile
variables where changing those attribute to NVRAM wear out.

From what information I could find, there is no definitive answer if the
UEFI implementation will write to the NVRAM even when the variable is
missing.

So add a simple helper that checks for the variable presence before
removing it. While also having a bit cleaner API than the current
efivar_set(..., NULL, ...);

efivar_unset() follows the design from efivar_set*() where it returns an
EFI_STATUS even though its (presently) unused.

v2:
 - add inline comment, use early return

v3:
 - typos? typos!

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2023-10-05 09:13:37 +01:00
Yu Watanabe
6b524d70e3 test-network: add tests for [DHCPv4] RequestAddress= setting 2023-10-05 11:14:29 +09:00