1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-20 14:03:39 +03:00

60881 Commits

Author SHA1 Message Date
Luca Boccassi
d5e3625a61 repart: respect --discard=no also for block devices
It's only used to avoid BLKDISCARD on individual partitions at the moment.
It can take a lot of time to run on very slow devices, so avoid it for
them too.

(cherry picked from commit 0dce448bbc97c861520c287b01d632b887442925)
2022-11-24 17:38:34 +01:00
Luca Boccassi
79f161ac65 portable: add a few more useful debug log messages
When attaching and /etc/systemd/system.attached can't be created or used
(eg: dead symlink) the logs are pretty much useless as even at debug
level there's no indication of what is going wrong.
Add some debug logs, and return a more specific error string over D-Bus.

(cherry picked from commit 80d95fcd6e1947a7887b96b22a32dbca115baac9)
2022-11-24 17:38:34 +01:00
Nick Rosbrook
bcd42b3c88 oomd: fix unreachable test case in test-oomd-util
This conditional with !empty_or_root(ctx->path) always returns false
because the most recent oomd_cgroup_context_acquire() call was with the
root cgroup. Make sure this test case can be reached by checking cgroup
instead of ctx->path.

While here, use an unused uid (61183) instead of the nobody uid so the
test case does not fail in unprivileged LXD containers.

(cherry picked from commit f05bcc18941eef5c2f93cfa06660eb06e0dc4c55)
2022-11-24 17:38:34 +01:00
Nick Rosbrook
2bdf5b0382 oomd: always allow root-owned cgroups to set ManagedOOMPreference
Commit 652a4efb66a ("oomd: loosen the restriction on ManagedOOMPreference")
made the change to allow ManagedOOMPreference on a cgroup candidate when
the monitored cgroup and cgroup candidate are owned by the same user.

The commit assumed that this check was sufficient to continue allowing
ManagedOOMPreference on all cgroups owned by root. However, it caused a
regression for unprivileged LXD containers where e.g. /sys/fs/cgroup is
owned by nobody (uid=65534).

Fix this by explicitly allowing the ManagedOOMPreference if uid == 0 in
oomd_fetch_cgroup_oom_preference().

(cherry picked from commit 89186093485b52ca957d17842fc1f7c87958454a)
2022-11-24 17:38:34 +01:00
Yu Watanabe
da01d83ab4 network: wifi: try to reconfigure when connected
Sometimes, RTM_NEWLINK message with carrier is received earlier than
NL80211_CMD_CONNECT. To make SSID= or other WiFi related settings in
[Match] section work, let's try to reconfigure the interface.

Fixes a bug introduced by 96f5f9ef9a1ba5146d3357c1548fb675d3bd5b68.

Fixes #25384.

(cherry picked from commit 8a4ad01a72481a6a7c0309064dd2dbd814818c94)
2022-11-24 17:38:34 +01:00
Benjamin Fogle
595dd9b2b9 resolved: Fix OpenSSL error messages
(cherry picked from commit f4a49d1c58578cb8d759dc6266a23d1acabdc38f)
2022-11-24 17:38:34 +01:00
Zbigniew Jędrzejewski-Szmek
2ecb8fc841 basic/strv: check printf arguments to strv_extendf()
The second argument to _printf_() specifies where the arguments start. We need to
use 0 in two cases: when the args in a va_list and can't be checked, and with journald
logging functions which accept multiple format strings with multiple argument sets,
which the _printf_ checker does not understand. But strv_extendf() can be checked.

(cherry picked from commit 400102ec91aa3404848a04f49a43d49e1a181708)
2022-11-24 17:38:34 +01:00
Zbigniew Jędrzejewski-Szmek
81e2c87a47 manager: fix format strings for trigger metadata
Fixup for c8bc7519c888a99134f88f8c82353246d3c0cc5d.

(cherry picked from commit 6457ce15be84cf3c304d1ba47b89bacc2f60bf6e)
2022-11-24 17:38:34 +01:00
Lennart Poettering
d337ac02d6 resolved: when configuring 127.0.0.1 as per-interface DNS server, contact it via "lo" always
ussually if you specify a DNS server on some interface then we'll use
that interface to talk to it. Let's override this for localhost
addresses, as they only really make sense on "lo".

Fixes: #25397
(cherry picked from commit 6e32414a66ff8dbcef233981a7066684d903ee9f)
2022-11-24 17:38:34 +01:00
Lennart Poettering
813d52dbf8 resolved: use right conditionalization when setting unicast ifindex on UDP sockets
(cherry picked from commit 5faaed5b62d5ed88d8df2802c5ab4d3ab2eb755a)
2022-11-24 17:38:34 +01:00
Sam James
2b52748d45 nspawn: allow sched_rr_get_interval_time64 through seccomp filter
We only allow a selected subset of syscalls from nspawn containers
and don't list any time64 variants (needed for 32-bit arches when
built using TIME_BITS=64, which is relatively new).

We allow sched_rr_get_interval which cpython's test suite makes
use of, but we don't allow sched_rr_get_interval_time64.

The test failures when run in an arm32 nspawn container on an arm64 host
were as follows:
```
======================================================================
ERROR: test_sched_rr_get_interval (test.test_posix.PosixTester.test_sched_rr_get_interval)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/python-3.11.0_p1/work/Python-3.11.0/Lib/test/test_posix.py", line 1180, in test_sched_rr_get_interval
    interval = posix.sched_rr_get_interval(0)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 1] Operation not permitted
```

Then strace showed:
```
sched_rr_get_interval_time64(0, 0xffbbd4a0) = -1 EPERM (Operation not permitted)
```

This appears to be the only time64 syscall that isn't already included one of
the sets listed in nspawn-seccomp.c that has a non-time64 variant. Checked
over each of the time64 syscalls known to systemd and verified that none
of the others had a non-time64-variant whitelisted in nspawn other than
sched_rr_get_interval.

Bug: https://bugs.gentoo.org/880131
(cherry picked from commit b9e7f22c2d80930cad36ae53e66e42a2996dca4a)
2022-11-24 17:38:34 +01:00
Li kunyu
5c34bc9bc3 boot/measure: fix oom check
(cherry picked from commit fc0cc6db1ecbaa16513125d3fd1a7d11e391a8ee)
2022-11-24 17:38:34 +01:00
Li kunyu
f68be4fd79 fuzz: fuzz-compress: fix copy-and-paste error: buf -> buf2 (#25431)
(cherry picked from commit f54f6d88b1235487eb7f0c634c488edc7813579a)
2022-11-24 17:38:34 +01:00
Marcus Schäfer
132f0ec7de Handle MACHINE_ID=uninitialized
systemd supports /etc/machine-id to be set to: uninitialized
In this case the expectation is that systemd creates a new
machine ID and replaces the value 'uninitialized' with the
effective machine id. In the scope of kernel-install we
should also enforce the creation of a new machine id in this
condition

(cherry picked from commit 305dd91adfde332e7e5c1b2470edb32774f9a032)
2022-11-24 17:38:34 +01:00
Vitaly Kuznetsov
25fcbdae7e shared/tpm2-util: Fix "Error: Esys invalid ESAPI handle (40000001)" warning
systemd-cryptenroll complains (but succeeds!) upon binding to a signed PCR
policy:

$ systemd-cryptenroll --unlock-key-file=/tmp/passphrase --tpm2-device=auto
  --tpm2-public-key=... --tpm2-signature=..." /tmp/tmp.img

ERROR:esys:src/tss2-esys/esys_iutil.c:394:iesys_handle_to_tpm_handle() Error: Esys invalid ESAPI handle (40000001).
WARNING:esys:src/tss2-esys/esys_iutil.c:415:iesys_is_platform_handle() Convert handle from TPM2_RH to ESYS_TR, got: 0x40000001
ERROR:esys:src/tss2-esys/esys_iutil.c:394:iesys_handle_to_tpm_handle() Error: Esys invalid ESAPI handle (40000001).
WARNING:esys:src/tss2-esys/esys_iutil.c:415:iesys_is_platform_handle() Convert handle from TPM2_RH to ESYS_TR, got: 0x4000000
New TPM2 token enrolled as key slot 1.

The problem seems to be that Esys_LoadExternal() function from tpm2-tss
expects a 'ESYS_TR_RH*' constant specifying the requested hierarchy and not
a 'TPM2_RH_*' one (see Esys_LoadExternal() -> Esys_LoadExternal_Async() ->
iesys_handle_to_tpm_handle() call chain).

It all works because Esys_LoadExternal_Async() falls back to using the
supplied values when iesys_handle_to_tpm_handle() fails:

    r = iesys_handle_to_tpm_handle(hierarchy, &tpm_hierarchy);
    if (r != TSS2_RC_SUCCESS) {
        ...
        tpm_hierarchy = hierarchy;
    }

Note, TPM2_RH_OWNER was used on purpose to support older tpm2-tss versions
(pre https://github.com/tpm2-software/tpm2-tss/pull/1531), use meson magic
to preserve compatibility.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
(cherry picked from commit 155c51293d5bf37f54c65fd0a66ea29e6eedd580)
2022-11-24 17:38:34 +01:00
Jan Janssen
6189505d79 boot: Correctly handle @saved default patterns
(cherry picked from commit 7941f11acb67c4f8ec857a791a51f3148af67b32)
2022-11-24 17:38:34 +01:00
Daan De Meyer
148b2d8ad3 Revert "journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL"
This commit broke backwards compatibility so let's revert it until
we find a better solution.

This reverts commit 977ad21b5b8f6323515297bd8995dcaaca0905df.

(cherry picked from commit 1db6dbb1dcdacfd7d2b4c84562fc6e77bc8c43a5)
2022-11-24 17:38:34 +01:00
Marcus Schäfer
d34ea410f4 Fix reading /etc/machine-id in kernel-install (#25388)
* Fix reading /etc/machine-id in kernel-install

The kernel-install script has code to read the contents of
/etc/machine-id into the MACHINE_ID variable. Depending
on the variable content kernel-install either logs the
value or creates a new machine id via 'systemd-id128 new'.
In that logic there is one issue. If the file /etc/machine-id
exists but is empty, the script tries to call read on an
empty file which return with an exit code != 0. As the
script code also uses 'set -e', kernel-install will exit at
this point which is unexpected.

The condition of an empty /etc/machine-id file exists for
example when building OS images, which should initialize the
system id on first boot but not staticly inside of the image.
afaik an empty /etc/machine-id is also a common approach
to make systemd indicate that it should create a new system
id. Because of this, the commit makes sure the reading of
/etc/machine-id does not fail in any case such that the
handling of the MACHINE_ID variable takes place.

(cherry picked from commit 883e7cbfc0dba6c81338e7924419b5cbb0cba0b2)
2022-11-24 17:38:34 +01:00
Yu Watanabe
7b99f68f1c systemctl: do not show unit properties with --all
Fixes a bug introduced by a6e334649d4bdff0c6f664e98666b2223aa21a8b.

Fixes #25343.

(cherry picked from commit 0b51a1c8c4c77f98a8c234cd2c7a7849329be027)
2022-11-24 17:38:34 +01:00
Yu Watanabe
f791ecd0c5 ac-power: check battery existence and status
If a battery is not present or its status is not discharging, then
the battery should not be used as a power source.
Let's count batteries currently discharging.

Fixes #25316.

(cherry picked from commit 1c03f7f4ba419aa65997e90accc0d935ae1cfbc5)
2022-11-24 17:38:34 +01:00
Zbigniew Jędrzejewski-Szmek
c2620a6bdb pid1: skip cleanup if root is not tmpfs/ramfs
in_initrd() was really doing two things: checking if we're in the initrd, and
also verifying that the initrd is set up correctly. But this second check is
complicated, in particular it would return false for overlayfs, even with an
upper tmpfs layer. It also doesn't support the use case of having an initial
initrd with tmpfs, and then transitioning into an intermediate initrd that is
e.g. a DDI, i.e. a filesystem possibly with verity arranged as a disk image.

We don't need to check if we're in initrd in every program. Instead, concerns
are separated:
- in_initrd() just does a simple check for /etc/initrd-release.
- When doing cleanup, pid1 checks if it's on a tmpfs before starting to wipe
  the old root. The only case where we want to remove the old root is when
  we're on a plain tempory filesystem. With an overlay, we'd be creating
  whiteout files, which is not very useful. (*)

This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=2137631
which is caused by systemd refusing to treat the system as an initrd because
overlayfs is used.

(*) I think the idea of keeping the initrd fs around for shutdown is outdated.
We should just have a completely separate exitrd that is unpacked when we want
to shut down. This way, we don't waste memory at runtime, and we also don't
transition to a potentially older version of systemd. But we don't have support
for this yet.

This replaces 0fef5b0f0bd9ded1ae7bcb3e4e4b2893e36c51a6.

(cherry picked from commit a940f507fbe1c81d6787dc0b7ce232c39818eec9)
2022-11-24 17:38:34 +01:00
Zbigniew Jędrzejewski-Szmek
83a772aae2 Revert "initrd: extend SYSTEMD_IN_INITRD to accept non-ramfs rootfs"
This reverts commit 1f22621ba33f8089d2ae5fbcaf8b3970dd68aaf0.

This is a replacement for b1fd5cd4eda02a323db93d7daa97f5138f89677d. See that
commit for details.
2022-11-24 17:38:34 +01:00
Khem Raj
4d11c9b3cd networkd-ipv4acd.c: Use net/if.h for getting IFF_LOOPBACK definition
This helps in avoiding compiling errors on musl. Definition of
IFF_LOOPBACK is the reason for including linux/if_arp.h, this however
could be obtained from net/if.h glibc header equally and makes it
portable as well.

(cherry picked from commit 239e4a42a69c31e55e58618d800e0d68c68931d3)
2022-11-24 17:38:34 +01:00
Jan Janssen
aff1caf3fd boot: Replace firmware security hooks directly
For some firmware, replacing their own security arch instance with our
override using ReinstallProtocolInterface() is not enough as they will
not use it. This commit goes back to how this was done before by
directly modifying the security protocols.

Fixes: #25336
(cherry picked from commit 967a868563996e928f1fade5bcafc82a7219742b)
2022-11-22 15:00:53 +01:00
Jan Janssen
f9d9a68ecc boot: Rework security arch override
This simplifies the caller interface for security arch overrides by only
having to pass a validator and an optional context.

(cherry picked from commit 5489c13bae119dc5f6e65be8d7f241aa7d54c023)
2022-11-22 15:00:53 +01:00
Jan Janssen
c6d7b4014c boot: Manually convert filepaths if needed
The conversion of a filepath device path to text is needed for the stub
loader to find credential files.

(cherry picked from commit 679007044fbbcf82c66cf20b99f2f5086b7df6b4)
2022-11-22 15:00:53 +01:00
Jan Janssen
c8c5b79fb6 boot: Do not require a loaded image path
If the device path to text protocol is not available (looking angrily at
Apple) we would fail to boot because we cannot get the loaded image
path. As this is only used for cosmetic purposes, we can just silently
continue.

Fixes: #25363
(cherry picked from commit af7ef648cddeb96da525de2410565d166f75cc96)
2022-11-22 15:00:53 +01:00
Jan Janssen
5894d4bd79 boot: Fix memory leak
(cherry picked from commit b7b327f856b3782f28be561d612d66ff406c7789)
2022-11-22 15:00:53 +01:00
Jan Janssen
5c0b918c02 boot: Fix error message
(cherry picked from commit 6ee4aa22140dd8d51b1a18882eb4220629b8dd8f)
2022-11-22 15:00:53 +01:00
Lennart Poettering
542dbc623e tpm2: add some extra validation of device string before using it
Let's add some extra validation before constructing and using the .so
name to load. This isn't really security sensitive, given that we
used secure_getenv() to get the device string (and it thus should have
been come from a trusted source) but let's better be safe than sorry.

(cherry picked from commit 50a085143fa8f5dd6b6b3cef8a6ea2ec7c53ed0d)
2022-11-22 15:00:53 +01:00
Lennart Poettering
b3228085ba tpm2-util: force default TCTI to be "device" with parameter "/dev/tpmrm0"
Apparently some distros default to tss-abmrd. Let's bypass that and
always go to the kernel resource manager.

abmrd cannot really work for us, since we want to access the TPM already
in earliest boot i.e. in environments the abmrd service is not available
in.

Fixes: #25352
(cherry picked from commit 34906680afe60d724ea435b79b9b830a4bf2e7e9)
2022-11-22 15:00:53 +01:00
Zbigniew Jędrzejewski-Szmek
31c2abd305
Create CNAME 2022-11-14 09:25:37 +01:00
Torsten Hilbrich
2ec3187d6c test: compile test-utmp.c only if UTMP is enabled
When compiling with -D utmp=false the compilation fails with:

../../git/systemd/src/test/test-utmp.c: In function ‘test_dump_run_utmp’:
../../git/systemd/src/test/test-utmp.c:21:9: error: cleanup argument not a function
   21 |         _unused_ _cleanup_(utxent_cleanup) bool utmpx = false;
      |         ^~~~~~~~
../../git/systemd/src/test/test-utmp.c:23:17: error: implicit declaration of function ‘utxent_start’ [-Werror=implicit-function-declaration]
   23 |         utmpx = utxent_start();
      |                 ^~~~~~~~~~~~

any many other errors

Add a conditional to compile test-utmp.c only if ENABLE_UTMP is true.

(cherry picked from commit 41cac2a8b98fc5faebe942c697b17e109822342d)
2022-11-08 21:58:42 +00:00
Frantisek Sumsal
60fbeb0b14 test: fix keymaps installation on Arch
Where the keymaps live under /usr/share/kbd/keymaps/.

(cherry picked from commit 1edad89399e7cbee230878589ac618103c157ec7)
v252.1
2022-11-08 14:59:01 +01:00
Frantisek Sumsal
bc9a97d507 test: fix locale installation when locale-gen is used
locale-gen might merge all compiled locales into a simple archive, so we
need to install it as well if necessary.

(cherry picked from commit 0c416ea01bc14adff10f4fc5415a36bd2d48f604)
2022-11-08 14:59:01 +01:00
Frantisek Sumsal
639b416c01 test: don't ignore non-existent paths in inst_recursive()
The process substitution in the while loop hides errors raised by the
find utility, which might (and did), in turn, hide errors in test setup.

(cherry picked from commit eb5d7730e1b3b1bddecb80be37e5a4c938183f61)
2022-11-08 14:59:01 +01:00
Christian Göttsche
7c98589bb1 loop-util: open lock fd read-only
flock(2) works with file descriptors opened with O_RDONLY.

This affects SELinux systems where access to block devices is quite
restricted to avoid bypasses on filesystem objects.

(cherry picked from commit 3e6b7d2626de9c0faf8b34b2629e8d6d8fa85a7d)
2022-11-08 14:59:01 +01:00
Christian Göttsche
2b2845ef6b test: fstab-generator: adjust PATH for fsck
fsck(8) is located in /usr/sib/ on Debian sid:

    stdout:
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-01-dev-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-02-dhcp.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-03-dhcp6.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-04-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-05-nfs4.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-06-ipv4.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-07-ipv6.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-08-implicit-nfs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-09-cifs.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-10-iscsi.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-11-live.input
    *** Running /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-12-dev-sdx.input
    --- /dev/fd/63  2022-11-04 15:39:13.131532174 +0100
    +++ /dev/fd/62  2022-11-04 15:39:13.131532174 +0100
    @@ -6,3 +6,4 @@
     initrd-usr-fs.target.requires
     initrd-usr-fs.target.requires/sysroot.mount
     sysroot.mount
    +systemd-fsck-root.service
    **** Unexpected output for /home/christian/Coding/workspaces/systemd/test/testdata/test-fstab-generator/test-12-dev-sdx.input
    stderr:
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on NFS was requested.
    Skipping root directory handling, as root on CIFS was requested.
    Skipping root directory handling, as root on iSCSI was requested.
    Skipping root directory handling, as root on live image was requested.
    Found entry what=/dev/sdx1 where=/sysroot type=n/a opts=ro
    Checking was requested for /dev/sdx1, but the fsck command does not exist.

(cherry picked from commit a45efc9e4b574a85176610496f2ac7ae769364bb)
2022-11-08 14:59:01 +01:00
Zbigniew Jędrzejewski-Szmek
dbed9051f7 man: add note that network-generator is not a generator
Also fix indentation.

(cherry picked from commit 2fa6574e835566c2aa5cbf4167ecee316f71bf98)
2022-11-08 14:59:01 +01:00
Luca Boccassi
30a120e393 kernel-install: skip 50-depmod if depmod is not available
Images might be built without any kernel module, and without
installing depmod as it is not needed. Skip it.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1023607
(cherry picked from commit cda4d00dfcbcd075cef95341f8a466f0c4ee8e1d)
2022-11-07 22:35:33 +00:00
Antonio Alvarez Feijoo
2ac1203296 kernel-install/90-loaderentry: do not override an existing systemd.machine_id
If the systemd.machine_id command line option is already set, do not override
it.

(cherry picked from commit 802d9219aa19d759113dd6cd1e91b2bb661fe9ba)
2022-11-07 22:35:33 +00:00
Frantisek Sumsal
31cfa1cc96 semaphore: remove the Semaphore repositories recursively
The list of disabled repositories was recently converted from a single
file into a directory with separate repository files, so let's adjust
the setup script accordingly.

```
$ ls -lR /etc/apt/sources.list.d/
/etc/apt/sources.list.d/:
total 36
-rw-r--r-- 1 root root   76 Nov  3 10:28 azure-cli.list
-rw-r--r-- 1 root root   72 Nov  3 10:22 bazel.list
drwxr-xr-x 2 root root 4096 Nov  3 10:31 disabled
-rw-r--r-- 1 root root  113 Nov  3 10:13 docker-source.list
-rw-r--r-- 1 root root  367 Nov  3 10:28 github_git-lfs.list
-rw-r--r-- 1 root root  111 Nov  3 10:25 google-chrome-source.list
-rw-r--r-- 1 root root   64 Nov  3 10:14 google-cloud-sdk.list
-rw-r--r-- 1 root root   54 Nov  3 10:23 helm-stable-debian.list
-rw-r--r-- 1 root root   89 Nov  3 10:29 yarn-source.list

/etc/apt/sources.list.d/disabled:
total 20
-rw-r--r-- 1 root root 100 Nov  3 10:23 devel_kubic_libcontainers_stable.list
-rw-r--r-- 1 root root 103 Nov  3 10:27 git.list
-rw-r--r-- 1 root root 105 Nov  3 10:22 gradle.list
-rw-r--r-- 1 root root 118 Nov  3 10:13 pypy.list
-rw-r--r-- 1 root root 104 Nov  3 10:13 python.list
```

(cherry picked from commit 610eb3f8260ecbb161db5186a5e27417f3110a68)
2022-11-07 19:01:47 +00:00
Daan De Meyer
1757446e8b condition: Check that subsystem is enabled in ConditionSecurity=tpm2
Instead of succeeding when either the firmware reports a TPM device
or we find a TPM device, let's check that the firmware reports a TPM
device and the TPM subsystem is enabled in the kernel.

To check whether the subsystem enabled, we check if the relevant
subdirectory in /sys exists at all.

(cherry picked from commit 300bba79c22e4be1effe2faad0e59ac725d396a1)
2022-11-07 13:16:26 +00:00
Antonio Alvarez Feijoo
80f91fcb19 kernel-install/90-loaderentry: do not add multiple systemd.machine_id options
Do not unconditionally add a new systemd.machine_id command line option, first
check if it already exists with the expected value.

Fixes #25203

(cherry picked from commit 981502c5cc9ce32c3f77ff74aad87cd6f0da3b16)
2022-11-04 23:31:28 +00:00
Luca Boccassi
c4131c39c6 tmpfiles.d: do not fail if provision.conf fails
On a read-only filesystem creating /root/.ssh might fail, but that's ok.
Do not fail the run, as this is only needed to add the credential, which
is a separate step.

(cherry picked from commit e0fc9be37e4d15e2c322eb8281692c2639dac023)
2022-11-04 23:31:28 +00:00
Franck Bui
cf23a522b2 tests: minor simplification in test-execute
No functional change.

(cherry picked from commit 09415aef940f4a471da7cb899b9a66f1504d7c77)
2022-11-04 23:31:28 +00:00
Franck Bui
64036ee871 tests: make test-execute pass on openSUSE
In my understanding user group "3" (aka "sys") is kept for historical reasons
but not really useful these days. That's probably explained why this group
isn't defined on openSUSE.

Hence let's drop reference to this user group, this shouldn't lessen the
revelance of the test since SupplementaryGroups= is still tested with 2 other
groups.

(cherry picked from commit d723b0467d7b8c5c772086d5352442f3fca4368d)
2022-11-04 23:31:28 +00:00
Luca Boccassi
a693cba0c3 firstboot: fix segfault when --locale-messages= is passed without --locale=
\#0  __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:295
No locals.
\#1  0x0000557444eb172b in process_locale () at ../src/firstboot/firstboot.c:342
        etc_localeconf = 0x7ffd40217b80 "/root/root/etc/locale.conf"
        locales = {0x0, 0x0, 0x0}
        i = 0
        r = <optimized out>
        __PRETTY_FUNCTION__ = "process_locale"
        __func__ = "process_locale"
\#2  0x0000557444eaff93 in run (argv=0x7ffd40217d98, argc=3) at ../src/firstboot/firstboot.c:1401
        loop_device = 0x0
        unlink_dir = 0x0
        r = <optimized out>
        loop_device = <optimized out>
        unlink_dir = <optimized out>
        r = <optimized out>
        __func__ = <optimized out>
        __PRETTY_FUNCTION__ = <optimized out>
        enabled = <optimized out>
        _error = <optimized out>
        _level = <optimized out>
        _e = <optimized out>
        _level = <optimized out>
        _e = <optimized out>
\#3  main (argc=3, argv=0x7ffd40217d98) at ../src/firstboot/firstboot.c:1432
        r = <optimized out>
        __PRETTY_FUNCTION__ = "main"

Fixes https://github.com/systemd/systemd/issues/25249

(cherry picked from commit 4c4a73ce068ef16cfe7ad07c7c3386ac1dbc58fe)
2022-11-04 23:31:28 +00:00
Frantisek Sumsal
85cf0a962e test: introduce sanity coverage for auxiliary utils
(cherry picked from commit d1020334fd15e0cffe68cb4d7e862a36253cc481)
2022-11-04 23:31:28 +00:00
Frantisek Sumsal
52db431bdf test: cover a couple of previously missed analyze code paths
(cherry picked from commit 8b1879bcd0ed1168f5ad35a3dd0e213a31a2ee42)
2022-11-04 23:31:28 +00:00