Commit Graph
68945 Commits
Author SHA1 Message Date
Luca Boccassi 61c232dc8b Merge pull request #30145 from poettering/reset-terminal-line-editing
make terminal line editing work with systemd-firstboot
2023-11-22 17:43:51 +00:00
Luca Boccassi 7d4b61d287 Merge pull request #30149 from yuwata/setlocale
locale-util: do not call setlocale() when multi-threaded
2023-11-22 17:43:39 +00:00
Luca Boccassi c1fd45d067 Merge pull request #30143 from poettering/machine-credential-fixes
machine credential fixes
2023-11-22 17:43:14 +00:00
Luca Boccassi 31897753fb Merge pull request #30024 from keszybz/one-doc-thingy
Serialize units ratelimits and document StartLimitIntervalSec=infinity
2023-11-22 17:42:51 +00:00
Lennart Poettering 9b85e90780 fs-util: add comment explaining what xopenat() is for 2023-11-23 02:29:37 +09:00
Yu Watanabe d54a45ad5f locale-util: drop unused init_gettext()
The function has not been used since 96d9117ad2.
2023-11-23 00:50:46 +09:00
Yu Watanabe ca13432d60 locale-util: do not call setlocale() when multi-threaded
Fixes #30141.
2023-11-23 00:50:42 +09:00
Lennart Poettering 2105f79ed3 machine-credential: tweak --load-credential= use a bit
Let's try to recognize paths (i.e. those with a "/") as source for
credentials to load, and then read them from the file system. Also, only read
credentials from an inbound credentials directory if the source
qualifies as valid credential name.

Otherwise print a nice error.
2023-11-22 15:17:18 +01:00
Lennart Poettering 1311946233 machine-credential: simplify code a bit 2023-11-22 15:17:18 +01:00
Lennart Poettering 437f3e156d machine-credential: use word 'Credential' rather than 'MachineCredential'
Probably some search/replace mistake.
2023-11-22 15:17:18 +01:00
Lennart Poettering d66c4d101e machine-credential: fix GREEDY_REALLOC error handling
We must check the return value of GREEDY_REALLOC for OOM, and the
pointer are updated already on success, hence it's a bad idea to make a
copy of the pointer beforehand.
2023-11-22 15:17:18 +01:00
Lennart Poettering 6045958bab machine-credential: fix error logging
Remove duplicate logging: let exclusively
machine_credential_load()/machine_credential_set() log, and not the
caller again.
2023-11-22 15:16:32 +01:00
Yu Watanabe 3197d778e0 journal: sync immediately on shutting down journald
Otherwise, sd_event_add_time_relative() or sd_event_source_set_time_relative()
below will trigger assert_return().

Prompted by #30029.
2023-11-22 14:07:19 +00:00
Zbigniew Jędrzejewski-Szmek 51ad723d20 core: serialize and deserialize trigger ratelimits for socket and path 2023-11-22 12:32:31 +00:00
Zbigniew Jędrzejewski-Szmek fed25720ef core: use uniform style for RateLimit initialization
RateLimit is designed so that we can always initialize only the first two
fields explicitly. All other call sites use a single line for this.
2023-11-22 12:32:31 +00:00
Lennart Poettering 5fee4ac0f4 firstboot: reset terminal settings right before asking a question
We are about to do interactivity on the terminal, hence let's ensure we
are in the TTY mode we expect to be in.
2023-11-22 13:27:53 +01:00
Lennart Poettering d5b6c6e378 terminal-util: drop ECHOPRT flag from TTY settings when resetting
Let's disable ECHOPRT for terminals we reset.

The feature only really makes sense for hardcopy terminals and we sure
as shit don't talk to one of those. It has the effect that when line
editing is on and you hit backspace it outputs "\" followed by the
removed character. This never makes sense on a TTY that can just erase
the character.

Hence turn of this flag.

We have carried this flag along for about forever, but it doesn't really
make sense. I guess we mostly tested the terminal reset stuff for output
only, not for input.

This change is in particular useful for tools such as
"systemd-firstboot" which interactively ask questions on the console,
and where line editing should really work.
2023-11-22 13:27:53 +01:00
Lennart Poettering 68e4c637f8 terminal-util: trivial modernizations for reset_terminal_fd() 2023-11-22 13:27:53 +01:00
Zbigniew Jędrzejewski-Szmek b2bd488e76 core: serialize and deserialize auto start/stop ratelimit
The limit is not configurable, so the logic in the helper will always update
the counters. The helper is a bit overkill, but it doesn't really matter.
2023-11-22 12:12:35 +00:00
Zbigniew Jędrzejewski-Szmek 6ef512c0bb core: serialize and deserialize unit start ratelimits
The logic is taken from dump ratelimit: if the config changes, we discard the
counters. This allows the user apply new limits and "start from scratch" in
that case.

This actually makes StartLimitIntervalSec=infinity (or with a large interval)
work as expected, because the counter is maintained even if daemon-reload
operations are interleaved.
2023-11-22 12:12:35 +00:00
Lennart Poettering 097445d0e4 update TODO 2023-11-22 11:00:30 +01:00
Yaron Shahrabani 97f9a25cfd po: Translated using Weblate (Hebrew)
Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Yaron Shahrabani <sh.yaron@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/he/
Translation: systemd/main
2023-11-22 11:12:49 +09:00
Yu Watanabe a461f81aac Merge pull request #30133 from yuwata/fix-draw-cylon
pid1: fix draw_cylon()
2023-11-22 10:48:49 +09:00
Yu Watanabe 2b43729bf9 sd-journal: warn about seals may not be continuous only when the file is sealed
Follow-up for e375bc5fcc.

Fixes #30118.
2023-11-22 10:48:21 +09:00
Yu Watanabe fa3ab903f3 test: add test for draw_cylon() 2023-11-22 08:59:29 +09:00
Yu Watanabe d61a4dbba9 pid1: move draw_cylong() to pretty-print.[ch] 2023-11-22 08:59:23 +09:00
Yu Watanabe 0fe9604359 pid1: terminate cylon string
Fixes #30121.
2023-11-22 08:49:25 +09:00
Lennart Poettering 5e5d4d36b4 test: make sure pcrlock tests run headless
We want the tests to fail rather than hang if unlock via tpm doesn't
work.
2023-11-21 23:43:23 +00:00
Luca Boccassi 8bff168cb4 Merge pull request #30128 from yuwata/network-rapid-commit-follow-ups
network/dhcp: several follow-ups for RapidCommit=
2023-11-21 23:43:00 +00:00
linuxlion 9023630cb7 Update 60-autosuspend.hwdb (#30131)
* Update 60-autosuspend.hwdb

Framework provides expansion cards. For the HDMI and DisplayPort, these benefit power management via enabling auto suspend.
2023-11-21 23:38:54 +00:00
Yu Watanabe ca49e745c0 pid1: drop unnecessary space 2023-11-22 08:26:34 +09:00
Yu Watanabe b65c539088 test-network: add tests for [DHCPv4] AllowList= and DenyList=
We have not tested if the settings actually filter DHCP servers.
Let's add a test case for the settings.

Note, the .network file used here has been unused since
0730e3767d. So, we can freely reuse it
without changing other test cases.

Closes #30107.
2023-11-22 05:37:04 +09:00
Yu Watanabe cf289b1415 network/dhcp: disable RapidCommit= by default when AllowList=/DenyList= is specified
AllowList= and DenyList= filter only DHCPOFFER messages. So, if
RapidCommit= is enabled, then networkd unconditionally accepts a rapid
ACK message even if its sender is filtered out by the lists.

As AllowList=/DenyList= implemented earlier than RapidCommit=, so
enabling RapidCommit= unconditionally by default may break existing
setups that use AllowList=/DenyList=.

Let's disable RapidCommit= by default when AllowList=/DenyList= is
enabled. Still the setting can be enabled by setting explicitly even
AllowList=/DenyList= is also specified.
2023-11-22 05:24:18 +09:00
Yu Watanabe 24bb67ed12 man: [DHCPv4] RapidCommit= is disabled when Anonymize=yes 2023-11-22 04:57:05 +09:00
Yu Watanabe b6d669d5af systemctl: fix typo
Follow-up for f380473edf.
2023-11-22 04:44:52 +09:00
Nils K 76d2b8da96 Fix references to ReadOnly=
PartitionReadOnly is not a valid property and ReadOnly was meant instead.
2023-11-21 19:16:15 +00:00
Lennart Poettering 07e89d501f tpm2-util: rename json field "tpm2-pcrlock" → "tpm2_pcrlock"
We generally want to avoid to include dashes in json field names. We
historically made a mistake there which is hard to fix. But for new
fields, let's get this right. We already got it right for a bunch of new
fields, hence also make sure to use underscores rather dashes for new
additions.

This field was added post v254, and since we didn't release since then,
let's just rename it.
2023-11-21 16:58:48 +00:00
Frantisek Sumsal 7ec22d7d4b bsod: install the signal handler only just before we need it
Otherwise we might get stuck in sd_journal_wait(), since it handles
EINTR internally.

Resolves: #30084
2023-11-21 16:58:33 +00:00
Yaron Shahrabani 027b34d9fc po: Translated using Weblate (Hebrew)
Currently translated at 37.0% (84 of 227 strings)

po: Translated using Weblate (Hebrew)

Currently translated at 15.8% (36 of 227 strings)

po: Added translation using Weblate (Hebrew)

Co-authored-by: Yaron Shahrabani <sh.yaron@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/he/
Translation: systemd/main
2023-11-21 14:13:56 +00:00
Yu Watanabe 54bc114fec kernel-install: do not resolve symlink in paths passed to plugins
When we resolve symlinks, paths (especially filenames) may be changed,
but plugins may expect to see the kernel added under the name specified,
not under the final name that the symlink chain resolves to.

This makes symlinks in specified paths that passed to plugins are not
resolved when neither --root nor --image specified.

Fixes #29317.
2023-11-21 12:57:00 +00:00
Arian van Putten b0c11b5a0f systemd.pc: Keep support for rootprefix and root_prefix (#30115)
* systemd.pc: Keep support for rootprefix and root_prefix

We dropped support for split-usr in https://github.com/systemd/systemd/commit/b0d3095fd6cc1791a38f57a1982116b4475244ba
but kept the `rootprefix` variable in meson but ignore it to make sure we do
not break downstream builds that depend on systemd.

This is fine because we had logic in our meson.build that rootprefix and prefix need to be the
same when split-usr=false.

However we never had this logic in our systemd.pc.in file. This leads to a nasty breaking problem
downstream. Many packages [0,1,2]  (there might be more!) rely on overriding rootprefix or root_prefix when calling pkg-config to configure where
to install systemd units. This is because before split-usr we installed units in rootprefix. Setting prefix
on the pkg-config file didn't work. Even when split-usr=false people had to set rootprefix to install units
in the right position.

E.g. they have a line like:

    systemdunitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define: ['rootprefix', systemd_root_prefix])

With https://github.com/systemd/systemd/commit/b0d3095fd6cc1791a38f57a1982116b4475244ba landing
This would mean all these downstream packages need to be patched to use `prefix` next to `rootprefix`.
(Both need to be kept to keep backwards compat with using older versions of systemd).

This puts a big burden on downstream packages.
Instead we should not break the existing behaviour and keep the old behaviour of systemd.pc.in around.
I've changed systemd.pc.in such that either setting prefix, rootprefix or root_prefix will all have
the same effect. This way we do not break any downstream packages.

- [0](https://github.com/fwupd/fwupd/blob/caa788b37ff34334d83debb047335fd12f3a7836/meson.build#L464)
- [1](https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blame/main/meson.build#L204)
- [2](https://github.com/PipeWire/pipewire/blob/49cdb468c28ba366dbd08eef9cb6dbf2dea2a2e5/src/daemon/systemd/system/meson.build#L1)
2023-11-21 12:51:08 +00:00
Florian Schmaus f380473edf systemctl-show: only show available memory if it was artifically limited
Systemd 255 changed the semantic of MemoryAvailable with 3565c709f5 ("cgroup:
Fix MemoryAvailable= by considering physical memory"). If there is no
artificial constraint, it will hold the amount of available physical memory,
while it previously contained UINT64_MAX.

While the change in MemoryAvailable's semantic is sensible, it causes
`systemctl status` to always display the available physical memory. This
creates a lot of noise, especially since systemd recently started to also show
the "peak" memory. For example

$ systemctl status foo
…
Memory: 3.9G (available: 21.2G peak: 5.4G)
…

However, while peak memory is a unit specific value, the available memory, when
not derived from artificial memory limits, is a generic property that holds the
same value for all units that are not under memory accounting
constraints. Displaying it under those circumstances can therefore be
considered being noisy.

Before 3565c709f5 ("cgroup: Fix MemoryAvailable= by considering physical
memory") "systemctl status" would only show the available memory if it was
caused by a explicit memory limitation due to MemoryHigh or MemoryMax.

This commit restores this behavior by supressing displaying the available
memory if is is merely the available phyiscal memory. For example

$ systemctl status foo
…
Memory: 3.9G (peak: 5.4G)
…

Fixes #30102.
2023-11-21 12:50:07 +00:00
Lennart Poettering dc78603a58 TODO: register more mime types 2023-11-21 13:12:50 +01:00
Yu Watanabe e00f1dda7d in-addr: improve log message for e.g. [DHCPv4] AllowList=
Closes #30107.
2023-11-21 09:32:50 +00:00
Luca Boccassi b595fd62e4 man: correct version tags in systemd-vmspawn
We ended up merging some changes earlier

Fixes https://github.com/systemd/systemd/issues/30091
2023-11-21 09:01:40 +09:00
Luca Boccassi fe68cbda00 Merge pull request #30108 from mrc0mmand/packit-testing-farm
packit: run tests on Fedora Rawhide via Testing Farm
2023-11-20 23:02:42 +00:00
Frantisek Sumsal 04dc383b40 packit: run tests on Fedora Rawhide via Testing Farm
Let's utilize the full power of Packit and run some tests with the just
built RPMs. This makes use of the Fedora infrastructure provided by
the Testing Farm project [0][1].

With the current configuration, the `tests` job runs tests from the
Fedora tests repository [2] in a very similar fashion like Ubuntu CI
does, just with different metadata all around it. ATTOW there are only
two tests, which are wrappers around unit tests and integration tests;
the latter one currently runs only nspawn-based tests, since there's no
KVM on the test VMs, and, for now, I'd like to see how well the infra is
going to manage our upstream traffic and how stable the whole thing is
end up being before increasing the work load.

[0] https://docs.testing-farm.io/Testing%20Farm/0.1/index.html
[1] https://packit.dev/docs/configuration/upstream/tests
[2] https://src.fedoraproject.org/tests/systemd
2023-11-20 21:45:59 +01:00
Frantisek Sumsal f258a76332 test: don't use ddebug() before it's defined
I'm pretty sure this is not the only case, but it's the one I recently
noticed. Even though we call ddebug() from a function, that function is
called before ddebug() is defined, resulting in the same issue as if we
called just ddebug() in its place, i.e.:

..//test-functions: line 276: ddebug: command not found
2023-11-20 21:26:17 +01:00
Frantisek Sumsal 6162caa288 test: move a couple of binaries to the BASICTOOLS array
As they're not optional.
2023-11-20 21:26:14 +01:00
Frantisek Sumsal 8ddbd9e078 test: support NO_BUILD=yes on Fedora 2023-11-20 21:26:11 +01:00