Daan De Meyer [Fri, 3 Jan 2025 19:27:05 +0000 (20:27 +0100)]
mkosi: Handle directories in debian/not-installed correctly (#35832)
If a directory is specified without a glob pattern, we have to exclude
all files in that directory, so add a recursive glob to every directory
and enable the bash globstar feature when globbing to '**/*' matches all
files and directories beneath the given directory.
Daan De Meyer [Fri, 3 Jan 2025 15:45:50 +0000 (16:45 +0100)]
core: do not disconnect from bus when failed to install signal match (#35779)
If bus_add_match_full() is called without install callback and we failed
to install the signal match e.g. by timeout, then add_match_callback()
will disconnect from the bus. Let's use a custom install handler and
handle failures gracefully.
This does not *solve* the root cause of issue
https://github.com/systemd/systemd/issues/30573, but should improve the
situation when the issue is triggered.
The new json_dispatch_const_path() is to json_dispatch_path() what
sd_json_dispatch_const_string() is to sd_json_dispatch_ string(), i.e.
doesn't implicitly strdup() the string, but gives you the pointer into
the JSON structure, and thus requires you to keep it pinned.
Daan De Meyer [Fri, 3 Jan 2025 12:54:09 +0000 (13:54 +0100)]
vmspawn: Switch to virtconsole for headless console (#35836)
virtconsole is the modern way to set up a headless serial connection
to a virtual machine so let's make use of it instead of -serial. This
also allows us to get rid of the per architecture serial console device
names and makes vmspawn more consistent with mkosi qemu which already
uses
virtconsole.
Daan De Meyer [Fri, 3 Jan 2025 09:20:45 +0000 (10:20 +0100)]
mkosi: Handle directories in debian/not-installed correctly
If a directory is specified without a glob pattern, we have to exclude
all files in that directory, so add a recursive glob to every directory
and enable the bash globstar feature when globbing to '**/*' matches all
files and directories beneath the given directory.
Otherwise the code was measuring the content of hwdids into dtbauto
section and vice-versa.
Found this while adding the new `dtbauto` and `.hwdids` fields in the go
implementation of `sd-measure` at
https://github.com/siderolabs/talos/blob/main/internal/pkg/secureboot/measure/measure.go.
Daan De Meyer [Fri, 3 Jan 2025 10:14:44 +0000 (11:14 +0100)]
vmspawn: Switch to virtconsole for headless console
virtconsole is the modern way to set up a headless serial connection
to a virtual machine so let's make use of it instead of -serial. This
also allows us to get rid of the per architecture serial console device
names and makes vmspawn more consistent with mkosi qemu which already uses
virtconsole.
tpm2-util: refuse hash algorithm/value specification when we only parse a mask
tpm2_parse_pcr_argument_to_mask() is supposed to parse a PCR mask
string, and uses the full blown tpm2_parse_pcr_argument() call at its
core, which parses more than just a mask, i.e. values and algorithms
too. Which is very confusing at times, because commands such as
"systemd-cryptenroll --tpm2-device=auto
--tpm2-public-key-pcrs=1:sha1=09dbdbc7f6cdd8029cc90b57a915c19a0ac21bce"
are very confusing, since they suggest enrollment with a specific
algorithm and has value, but this is not in fact what happens: both are
entirely ignored.
That this was accepted this way was more an accident than intended,
which is already visible in the fact that extensive test case entirely
ignores the fact that strings like this are accepted.
tpm2-util: optionally do wildcard hash check in tpm2_pcr_values_to_mask()
If TPM2_ALG_ERROR (aka "0") is specified as algorithm in
tpm2_pcr_values_to_mask() we'll simply match all algorithms. This allows
us to shorten tpm2_parse_pcr_argument_to_mask() a bit. The function
accepts but ignores a hash algorithm specification currently, hence this
should not really much effect.
Daan De Meyer [Fri, 3 Jan 2025 08:19:55 +0000 (09:19 +0100)]
network/dhcp: introduce global setting for DHCPv4 client identifier (#35783)
Typically, the same client identifier setting is used for all
interfaces. Hence, better to provide the system-wide setting to specify
the client identifier.
- Set `RefuseManualStart=yes`.
- Order before shutdown.target and emergency.target.
- Remove wrong `Wants=remote-fs.target` dependency from
breakpoint-pre-switch-root.service.
- Remove unneeded `After=sysroot.mount` from breakpoint-pre-switch-root.service
(implied by initrd.target).
Mike Yuan [Thu, 2 Jan 2025 19:03:33 +0000 (20:03 +0100)]
random-util: our baseline includes getrandom() (v3.17) now
Plus, linux/random.h never defined getrandom(), hence remove
the custom machinery for sys/random.h vs linux/random.h
in favor of single HAVE_GETRANDOM.
Mike Yuan [Thu, 2 Jan 2025 18:59:56 +0000 (19:59 +0100)]
random-util: drop needless conditionalization of sys/auxv.h
We assume its existence in basic/build-path.c, shared/userdb.c,
and coredump/coredump.c already, for which nothing has been reported
so far. So this seems safe to drop.
ask-password: add Varlink API for querying passwords from the user
This turns systemd-ask-password into a small Varlink service, so that
there's an standard IPC way to ask for a password. It mostly directly
exposes the functionality of the Varlink service.
Mike Yuan [Thu, 2 Jan 2025 03:32:00 +0000 (04:32 +0100)]
shared/hibernate-util: drop support for kernels lacking /sys/power/resume_offset
The current fallback path is actually unreliable, given
the kernel *supports* setting the resume offset through
cmdline after all, but just not exposed under /sys/.
For v258 let's drop it hence.
I didn't bump the baseline to 4.17, but merely documented
new requirement in README, because there's certainly more
compat stuff to drop between 4.3 and 4.17, and README is
a useful list for things to kill. We'll get to 5.4 eventually.
Mike Yuan [Thu, 2 Jan 2025 03:17:47 +0000 (04:17 +0100)]
shared/hibernate-util: handle the case where no swap has available backing dev
This also makes find_suitable_hibernation_device() report
more accurate error (ENOSPC -> ESTALE) if there's
no swap space on the system at all but resume= is set.