Commit graph

73077 commits

Author SHA1 Message Date
Mike Yuan 844863c61e
core/manager: add unmerged-bin taint 2024-04-24 08:43:08 +08:00
Mike Yuan ea81442892
core/manager: rearrange taint tags 2024-04-24 08:40:25 +08:00
Mike Yuan 2b28dfe6e6
core/manager: drop obsolete cgroup taint string
Wwe can't boot on systems without cgroup anyway
(even cgroup v1 will be gone pretty soon).
2024-04-24 08:39:29 +08:00
Mike Yuan 21f8e749a1
mount-setup: use mount_verbose_full where appropriate 2024-04-24 08:39:26 +08:00
Luca Boccassi 5e1124b510
Merge pull request #32437 from keszybz/notify-fixups-split-out
Two fixups for sd-notify split out from #32093
2024-04-23 19:36:53 +02:00
Luca Boccassi e1e81c0920
Merge pull request #32434 from poettering/cryptenroll-prefer-var
cryptenroll: prefer looking at /var/ instead of /
2024-04-23 18:45:43 +02:00
Simon Fowler 557c04a382 Add self-contained Python sd_notify example.
This complements the existing C example.
2024-04-23 17:03:01 +02:00
Antonio Alvarez Feijoo 8ebfef5c96 sysext: do not return 0 if unmerge() fails in the refresh() function.
Actually, return the result of `unmerge()` if it is called in the `refresh()`
function.

Fixes 8662fcbcf1
2024-04-23 16:15:55 +02:00
Zbigniew Jędrzejewski-Szmek a4acc2528f
Merge pull request #32435 from YHNdnzj/followup
Some follow-ups for recent PRs
2024-04-23 15:47:57 +02:00
Lennart Poettering 6645dc053d update NEWS 2024-04-23 15:23:44 +02:00
Lennart Poettering cd4eda525d cryptenroll: use [] in --help text to indicate block device argument is now optional 2024-04-23 15:23:44 +02:00
Lennart Poettering 8518f4a814 cryptenroll: default to block device backing /var/ rather than /
With 1df4b21abd we started to default to
enrolling into the LUKS device backing the root fs if none was specified
(and no wipe operation is used). This changes to look for /var/ instead.

On most systems /var/ is going to be on the root fs, hence this change
is with little effect.

However, on systems where / and /var/ is separate it makes more sense to
default to /var/ because that's where the persistent and variable data
is placed (i.e.  where LUKS should be used) while / doesn't really have
to be variable, could as well be immutable, or ephemeral. Hence /var/
should be a safer default.

Or to say this differently: I think it makes sense to support systems
with /var/ being on / well. I also think it makes sense to support
systems with them being separate, and /var/ being variable and
persistent. But any other kind of system I find much less interesting to
support, and in that case people should just specify the device name.

Also, while we are at it, tighten the checks a bit, insist on a dm-crypt
+ LUKS superblock before continuing.

And finally, let's print a short message indicating the device we
operate on.
2024-04-23 15:23:44 +02:00
Yu Watanabe bd0ec61ae3 journal: do not rotate unrelated journal files when full or corrupted
When we fail to add an entry to a journal file, typically when the file
is full or corrupted, it is not necessary to rotate other journal files.

Not only that's unnecessary, rotating all journal files allows
unprivileged users to wipe system or other user's journals by writing
many journal entries to their own user journal file.

Let's rotate all journal files only when
- it is really requested by a privileged user (e.g. by journalctl --rotate), or
- the system time jumps backwards.
And, otherwise rotate only the journal file we are currently writing.
2024-04-23 15:13:05 +02:00
Daan De Meyer 00bc83a275 core: Limit terminal reset using ANSI sequences to /dev/console
Doing this in reset_terminal_fd() is a bit too invasive, see
https://github.com/systemd/systemd/pull/32406#issuecomment-2070923583.

Let's only do this for /dev/console so that we work around weird firmwares
disabling line-wrapping, but avoid messing too much with other things.

While we're at it, let's handle more than just line wrapping, and do a
more general reset of stuff to get the terminal into a sane state.
2024-04-23 15:05:50 +02:00
Mike Yuan 66ec03061a
network: suggest using "networkctl edit" instead of copying manually 2024-04-23 20:02:19 +08:00
Mike Yuan 3d9099f23d
cryptenroll: sort includes
Follow-up for 1df4b21abd
2024-04-23 20:01:02 +08:00
Mike Yuan 31197c684a
core/service: also allow updating main pid when SERVICE_STOP
Follow-up for f5b72af50d

See also: https://github.com/systemd/systemd/pull/32120#discussion_r1575992623
2024-04-23 20:01:01 +08:00
Zbigniew Jędrzejewski-Szmek 1b47cfab7f
Merge pull request #32428 from poettering/sd-notify-reboot-param
pid1: send shutdown type and reboot argument to supervisor via sd_notify()
2024-04-23 13:31:40 +02:00
Ludwig Nussel 1df4b21abd cryptenroll: use root device by default 2024-04-23 12:29:32 +02:00
Daan De Meyer b954d22e60
Merge pull request #32433 from DaanDeMeyer/fix
mkosi: Fix Arch Linux package glob
2024-04-23 12:28:48 +02:00
Adrian Vovk 7923e9493c manager: Improve freeze/thaw for unrealized cgroup
This is a follow-up for e50bfc89ce

In that commit, we made Freeze/Thaw work with unrealized cgroups.
However, the unit was left in a strange state: it would be frozen by the
kernel but systemd would be unaware, and it remained possible to try and
realize the cgroup while the unit is supposed to be frozen. This commit
fixes the state tracking and prevents cgroups from being realized when
the unit is frozen.
2024-04-23 12:27:38 +02:00
Lennart Poettering 2a52385108
Merge pull request #32427 from poettering/systemctl-help-missing
systemctl: add missing --help entries
2024-04-23 12:11:53 +02:00
dependabot[bot] 7b36569461 build(deps): bump pkg/debian from 30c77a7 to 733ac7c
Bumps pkg/debian from `30c77a7` to `733ac7c`.

---
updated-dependencies:
- dependency-name: pkg/debian
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-23 12:05:45 +02:00
Daan De Meyer 5841b5af48 mkosi: Configure lower retention limit for package artifacts
This is more than 0.5G per job, so let's drop the retention to
4 days to make sure we don't hit github's limits.
2024-04-23 11:58:44 +02:00
Daan De Meyer 279b3d4690 mkosi: Fix Arch Linux package glob 2024-04-23 11:53:28 +02:00
Michal Sekletar f5b72af50d service: allow MainPID= updates during stop of the service
Example use case is a migration of MainPID to an auxiliary scope.
2024-04-23 11:41:10 +02:00
Daan De Meyer 622678edd7
Merge pull request #32352 from DaanDeMeyer/test
test: Various mkosi integration test improvements
2024-04-23 11:27:23 +02:00
Lennart Poettering d58997e684 update TODO 2024-04-23 11:04:09 +02:00
Lennart Poettering c65bd6cc7e systemctl: set reboot argument for most forms of shutdown, not just plain reboots
This doesn't hurt anyway, and is useful now that we propagate the string
via sd_notify() too.
2024-04-23 11:04:08 +02:00
Lennart Poettering 8c081ae84b shutdown: send an sd_notify() message on shutdown with the shutdown reason and boot param
This is kinda nice in containers, to exfiltrate a string from the
container on shutdown.
2024-04-23 11:04:08 +02:00
Daan De Meyer 422124072d mkosi: Run integration tests in CI
We do the image build and run the tests in a btrfs loopback so we
can make use of btrfs subvolumes and COW to keep the disk space
requirements to a minimum and speed up the ephemeral copies we make
of the image to run the tests.

We also switch to building debug packages and publishing the built
packages as artifacts.
2024-04-23 10:33:08 +02:00
Daan De Meyer b85e54961c test: Various mkosi integration test improvements
- Stop using logging module since the default output formatting is
  pretty bad. Prefer print() for now.
- Log less, logging the full mkosi command line is rather verbose,
  especially when it contains multi-line dropins.
- Streamline the journalctl command we output for debugging failed
  tests.
- Don't force usage of the disk image format.
- Don't force running without unit tests.
- Don't force disabling RuntimeBuildSources.
- Update documentation to streamline the command for running a single
  test and remove sudo as it's not required anymore.
- Improve the console output by having the test unit's output logged
  to both the journal and the console.
- Disable journal console log forwarding as we have journal forwarding
  as a better alternative.
- Delete existing journal file before running test.
- Delete journal files of succeeded tests to reduce disk usage.
- Rename system_mkosi target to just mkosi
- Pass in mkosi source directory explicitly to accomodate arbitrary
  build directory locations.
- Add test interactive debugging if stdout is connected to a tty
- Stop explicitly using the 'system' image since it'll likely be
  dropped soon.
- Only forward journal if we're not running in debugging mode.
- Stop using testsuite.target and instead just add the necessary
  extras to the main testsuite unit via the credential dropin.
- Override type to idle so test output is not interleaved with
  status output.
- Don't build mkosi target by default
- Always add the mkosi target if mkosi is found
- Remove dependency of the integration tests on the mkosi target
  as otherwise the image is always built, even though we configure
  it to not be built by default.
- Move mkosi output, cache and build directory into build/ so that
  invocations from meson and regular invocations share the same
  directories.
- Various aesthetic cleanups.
2024-04-23 10:32:42 +02:00
Daan De Meyer 89b44cbb4d mkosi: Deal with ubuntu's special debug packages
Building debug packages on ubuntu requires the "debug" option to be
specified explicitly. Debug packages on Ubuntu have the .ddeb extension,
so let's make sure we handle that by copying the .ddeb packages in the
build script as well.
2024-04-23 10:25:02 +02:00
Daan De Meyer 388dcc785b mkosi: Use -fdebug-prefix-map= instead of -ffile-prefix-map=
-ffile-prefix-map= implies -fmacro-prefix-map= which is incompatible
with our definition of PROJECT_FILE.

See https://github.com/systemd/systemd/issues/32417.

-fdebug-prefix-map= only affects debuginfo without affecting macros.
2024-04-23 10:25:02 +02:00
Daan De Meyer e3cd320021 mkosi: Update to latest 2024-04-23 10:24:59 +02:00
Lennart Poettering 965d7f6eaa systemctl: add forgotten --after/--before to --help text
Follow-up for: afba41995d
2024-04-23 10:02:17 +02:00
Lennart Poettering ede3a1461e systemctl: add forgotten --reboot-argument= to --help text
Follow-up for: dae710bef1
2024-04-23 10:02:17 +02:00
Lennart Poettering fd0b87757e systemctl: add forgotten --message= to --help text
Follow-up for: 9ef15026c0
2024-04-23 09:59:39 +02:00
Luca Boccassi 41fb4dc334 mkosi: mask isc-dhcp-server
isc-dhcp-server does not ship units, only sysv scripts, so the mkosi
presets that disable it have no effect. The generated unit is started on
each boot and fails, causing delays and noise.

Mask it so that the generated unit is overridden. It is installed only
to bring in binaries used by the networkd tests anyway.
2024-04-23 07:04:27 +02:00
Luca Boccassi 8d1d8dfaed
Merge pull request #32413 from yuwata/network-radv-validator
network/radv: several cleanups for validating configs
2024-04-23 01:02:34 +02:00
Lennart Poettering 6bd675a659 network: add .link file to match 80-namespace.network
This file makes clear the interface shall be owned by networkd.

This does what 658169e6d3 did for nspawn's
regular devices for the devices defined through
8aee931e7a too.
2024-04-22 23:49:57 +02:00
Lennart Poettering 0f5a529217 network: add "mac" to alternatives name policy by default
Alternative names are basically free, hence add "mac" there too, to make
it easier to see what names could be used as primary options too.
2024-04-22 22:44:20 +02:00
Mike Yuan 4a77d4ceb9 kernel-install/60-ukify: also search in {/run,/usr/local/lib}/kernel/
After db26d8025e,
kernel-install takes config files under /run/
and /usr/local/lib/ into account too. The same
should apply to ukify.

Note that ukify when invoked alone searches under
/run/systemd/, /etc/systemd/, /usr/local/lib/systemd/,
and /usr/lib/systemd/, respectively, which is against
our usual order...
2024-04-22 22:38:11 +02:00
Sam Leonard c9e89db860 machined: fix invalid edge case in machine_new 2024-04-22 22:37:05 +02:00
Guido Leenders f445ed3c5f Document effective owner of stdout/stderr log file upon creation
The log files defined using file:, append: or truncate: inherit the owner and other privileges from the effective user running systemd.

The log files are NOT created using the "User", "Group" or "UMask" defined in the service.
2024-04-22 20:46:25 +02:00
Yu Watanabe c6aadfdd32 ukify: swap the ordering of config search paths
Let's follow our usual ordering.

Follow-up for a05fa30f88.
2024-04-22 20:38:16 +02:00
Lennart Poettering 8b2f2a568d test: ensure all architecture ids we define definitely fit into .v/ patterns
Just some safety checks so that we never regress on this: make sure all
architectur IDs we define are embeddable safely in .v/ entry file names.
2024-04-22 20:28:33 +02:00
Frantisek Sumsal 707a578865
Merge pull request #32412 from weblate/weblate-systemd-main
Translations update from Fedora Weblate
2024-04-22 20:02:32 +02:00
Daan De Meyer 741d59b326 test: Rework TEST-02-UNITTESTS
Currently, A large amount of unit test output is logged directly
to the console instead of to the per test log file as any subprocesses
executed by a test manager will detect that stderr is not connected
to the journal and log directly to /dev/console instead.

To solve this issue, let's make sure all tests are connected directly
to the journal by running them with systemd-run. We also simplify the
entire test script by getting rid of the custom queue and replicating
it with xargs instead. By using bash's function export feature, we can
make our run_test() function available to the bash subprocess spawned
by xargs.

Once a test is finished, we read its logs from the journal and put them
in the appropriate file if needed.
2024-04-22 19:37:13 +02:00
Daan De Meyer e660fee2d0
Merge pull request #32392 from DaanDeMeyer/executor-log-level
core: Set a sensible systemd-executor log level in test runs
2024-04-22 19:26:52 +02:00