1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-12 08:58:20 +03:00

66254 Commits

Author SHA1 Message Date
Yu Watanabe
4bb0d3cf56 veritysetup-generator: fix ordering of generated units
Fixes a bug introduced by 08b04ec7e72b7327b4803809732b1b8fce8dd069 and
953006dcb0a37a57aed0e762ff6289700e8689e8.

Fixes #28725.

(cherry picked from commit 685e0dd1924cce44327040b08a8980af2192bf59)
2023-08-09 13:51:00 +02:00
Yu Watanabe
7483f75fa6 sd-dhcp-server: propagate error on parsing DHCP packet
Otherwise, we silently ignore the received packet and that makes hard to
debug issue.

(cherry picked from commit 809da721f0167f88234e55a342e82023019e2341)
2023-08-09 13:51:00 +02:00
Yu Watanabe
08c1aff483 resolve: ignore nameserver= and domain= kernel command line options without value
Otherwise, manager_parse_dns_server_string_and_warn() or
manager_parse_search_domains_and_warn() will trigger assertion.

(cherry picked from commit 91acee9906e973365109b1b1d5e880ced9aeae65)
2023-08-09 13:51:00 +02:00
mordner
b4b4caf09f man: fix typo in journalctl
(cherry picked from commit 653c90ec0e6f4d68b68938a20bd8cff492e7a666)
2023-08-09 13:51:00 +02:00
Fabian Vogt
72da03631a units/initrd-parse-etc.service: Conflict with emergency.target
If emergency.target is started while initrd-parse-etc.service/start is queued,
the initrd-parse-etc job did not get canceled. In parallel to the emergency
units, it eventually runs the service, which starts initrd-cleanup.service,
which in turn isolates initrd-switch-root.target. This stops the emergency
units and effectively starts the initrd boot process again, which likely
fails again like the initial attempt. The system is thus stuck in an endless
loop, never really reaching emergency.target.

With this conflict added, starting emergency.target automatically cancels
initrd-parse-etc.service/start, avoiding the loop.

(cherry picked from commit 327cd2d3db703555f8d572b4cd055fbe55e1068b)
2023-08-09 13:51:00 +02:00
Ronan Pigott
dfc0445cb8 zsh: reintroduce pattern argument to uncached verbs
The systemctl completion previously made use of PREFIX as a pattern
argument to list-unit-files and list-units. This had the problem of
erroneously filtering the results that were stored in the cache, and
erroneously filtering results that might have been requested according
to the users configuration (e.g. _correct completer, certain
matcher-lists or tag-orders, etc.).

Unfortunately, the runtime of list-unit-files increases when no pattern
argument is provided, and systemctl show, used to filter those units,
can become unacceptably slow when provided with too many units to
describe.

Let's re-introduce the pattern argument to list-unit-files and
list-units where necessary in order to alleviate these bottlenecks
without poisining the cache. A 'use-pattern' style is introduced that
may be used to disable this behavior if it is undesired. We can still
expect that certain completions, like `systemctl start <TAB>` will be
slow, like before. To fix this we will need systemd to learn a more
efficient way of filtering the units than parsing systemctl show.

(cherry picked from commit 2cbda74862049be2003496c7d432341d53a0fdf9)
2023-08-09 13:51:00 +02:00
Ronan Pigott
9814972198 zsh: use sys_really_all_units for non-template names
The systemctl invocations used for these completions match the ones used
for the _sys_really_all_units parameter, so we should really just use
the cached parameter rather than recomputing the result.

(cherry picked from commit c8e2cd79c155151bcdb983eedd24a6a77082c41b)
2023-08-09 13:51:00 +02:00
Yu Watanabe
9f32329e85 udev: set ID_NAME and ID_SERIAL to MMC/memstick devices again
Fixes a bug introduced by 998db5871fea331ec00b26a3a3f5271df040a905.

Fixes #28671.

(cherry picked from commit 074d90926fec26c305e23a7e9acb3e59c576c859)
2023-08-09 13:51:00 +02:00
Yu Watanabe
1d8cb3c8a0 busctl: fix showing array of dictionary in JSON format
This partially reverts the commit 684bce3d54463b3222246f72adfe82ad5d176fea
and fixes the issue introduced by it.

Fixes #28711.

(cherry picked from commit beddf8ba29152e8b7d8c04b8fc929ac33b693166)
2023-08-09 13:51:00 +02:00
Lennart Poettering
2ad1385110 shutdown: handle gracefully if MD_LEVEL udev propery is not set
See: #28490
(cherry picked from commit ab9617a76624c43a26de7e94424088ae171ebfef)
2023-08-09 13:51:00 +02:00
Lennart Poettering
0ac89e3b3f varlink: don't allocate fd control buffer on each read()
We'll need this on each read() again, hence let's just allocate this
once and then reuse it for subsequent read()s.

Follow-up for: #28639

(cherry picked from commit 3c8680585c698668c4d9774d3801d3446a194113)
2023-08-09 13:51:00 +02:00
Zbigniew Jędrzejewski-Szmek
ec18b6015b manager: fix reloading in reload-or-restart --marked
bus_unit_queue_job_one has two callers:
- bus_unit_queue_job which would do the appropriate transormations
  to turn JOB_TRY_RESTART into JOB_TRY_RELOAD,
- and method_enqueue_marked_jobs which did not.
In effect, method_enqueue_marked_jobs() would queue restart jobs for
units which has Markers= needs-reload or needs-restart.

When the chunk of code which does the transformations is moved from
bus_unit_queue_job to bus_unit_queue_job_one, there is no change for
bus_unit_queue_job, and method_enqueue_marked_jobs is fixed.

The additional checks that are done seem reasonable to do from
method_enqueue_marked_jobs: we shouldn't be restarting units which are
configured to not allow that, or force unwanted start of dbus-broker.

(cherry picked from commit 8ea8e23f4013dbc4f4a66c81eb786f0505434f2e)
2023-08-09 13:51:00 +02:00
Mike Yuan
11dc2717e2 shared/fstab-util: use is_device_path instead of is_device_node
Follow-up for 99299d0d5a722812cedc0a23e4987f90a257c2d2

is_device_node() calls lstat(), causing device node
symlinks under /dev/disk/ not being compared correctly
using devnode_same().

Fixes #28585

(cherry picked from commit cc1e1bb03e49ccb90f36173a3d1ff10ab5676eb0)
2023-08-09 13:51:00 +02:00
Frantisek Sumsal
e497d1b198 ukify: don't panic when prepending to an undefined list
Handle the case when all the arguments are passed in through a
configuration file:

$ cat ukify.conf
[UKI]
Linux = /boot/vmlinuz-linux
Initrd = /boot/initramfs-linux.img

Before:
$ src/ukify/ukify.py --config ukify.conf build
Traceback (most recent call last):
  File "/root/systemd/src/ukify/ukify.py", line 1604, in <module>
    main()
  File "/root/systemd/src/ukify/ukify.py", line 1590, in main
    opts = parse_args()
           ^^^^^^^^^^^^
  File "/root/systemd/src/ukify/ukify.py", line 1584, in parse_args
    apply_config(opts)
  File "/root/systemd/src/ukify/ukify.py", line 1431, in apply_config
    item.apply_config(namespace, section_name, group, key, value)
  File "/root/systemd/src/ukify/ukify.py", line 1123, in apply_config
    self.config_push(namespace, group, dest, value)
  File "/root/systemd/src/ukify/ukify.py", line 1019, in config_list_prepend
    setattr(namespace, dest, value + old)
                             ~~~~~~^~~~~
TypeError: can only concatenate list (not "NoneType") to list

After:
$ src/ukify/ukify.py --config ukify.conf build
Kernel version not specified, starting autodetection 😖.
Found uname version: 6.4.7-arch1-3
Wrote unsigned vmlinuz-linux.unsigned.efi

Resolves: #28688
(cherry picked from commit 0be1de7ffc4a608482e45890425b6fd90f6073f0)
2023-08-09 13:51:00 +02:00
Mike Yuan
182b95cdc9 man/systemd: avoid duplicate variable name
(cherry picked from commit 804c6397bc39a95968366c031082e96e94ef218c)
2023-08-09 13:51:00 +02:00
Dan Streetman
505504c02c tpm2: use ELEMENTSOF() instead of sizeof() for TPML_PCR_SELECTION pcrSelections field
The count field indicates the number of elements in the pcrSelections field,
and the size of each elements is greater than 1 byte, so using sizeof() is
incorrect when verifying the count field is valid; instead ELEMENTSOF() should
be used.

Caught by coverity check: https://github.com/systemd/systemd/pull/26331#pullrequestreview-1556629586

(cherry picked from commit 9afd4dde22f852fa4643799b218bef268a76272c)
2023-08-09 13:51:00 +02:00
Zbigniew Jędrzejewski-Szmek
e91f31e372 journalctl: fix loggging invocation
Fixup for f882a986c271c3de1c622df0f1586946b4a09fef.

(cherry picked from commit 8cb0008977648ba67c35289d81aa2b5a086384f5)
2023-08-09 13:51:00 +02:00
Zbigniew Jędrzejewski-Szmek
dc7d0eb3a6 NEWS: adjust grammar
(cherry picked from commit b77ff21ade31ddd79fcb4120874a9b62e6a9194b)
2023-08-09 13:51:00 +02:00
Zbigniew Jędrzejewski-Szmek
164c3935e4 NEWS: expand list of new Startup* settings
This way users can grep/search the NEWS file for when a given setting was
added.

(cherry picked from commit e9ae4187bb1c1f7718de2384a050b72158a2ca14)
2023-08-09 13:51:00 +02:00
Daan De Meyer
865f0d6e76 test-user-util: Drop tty check in gid_to_name() test
The tty user is not guaranteed to exist, so let's remove the dependency
from the test.

(cherry picked from commit a1fedc613fe90b9f1f253fd02a7a6575351a27cc)
2023-08-09 13:51:00 +02:00
Daan De Meyer
faaa0ee5e9 tmpfiles: Consider ENOPKG as information not available
We already handle the case where /etc/machine-id is empty. Let's make
sure we also handle the case where /etc/machine-id is "uninitialized".

(cherry picked from commit 5dd814d7cd88b9d58c7c5bd79fb27ee2b22e82a3)
2023-08-09 13:51:00 +02:00
Luca Boccassi
0f27d7b9f9 portablectl: fix regression when using --force without extension parameters
c18f4eb9e96836a made it possible to use --force with various verbs, by
going through the newer D-Bus methods. Except it didn't, as it regressed
during PR review refactorings, and nobody noticed because there were no
tests for it. Fix it, and add tests.

Follow-up for c18f4eb9e96836a6a8285ec42fd8a34c8909f6d9

(cherry picked from commit bdfa3f3a5c6d16d56d432e7bc52be0c03a5ce6ad)
2023-08-09 13:51:00 +02:00
Mike Yuan
a165726485 hibernate-resume-generator: escape device path passed to hibernate-resume
Follow-up for #27330

Fixes #28668

(cherry picked from commit caf8d692ed98f557d9f5641bffaf383c8401711a)
2023-08-09 13:51:00 +02:00
Mike Yuan
a5e5d6d64e man/systemd.unit: DefaultTimeoutStartSec= -> DefaultDeviceTimeoutSec=
for device unit job timeouts

Follow-up for #24044

(cherry picked from commit 83d373d213cad0f67c85055bf342d36cef8ed8e6)
2023-08-09 13:51:00 +02:00
Antonio Alvarez Feijoo
9c1b5911af man/systemd-fsck@.service: clarify passno and noauto combination in /etc/fstab
Fixes #28657

(cherry picked from commit 000680a68dbdb07d77807868df0b4f978180e4cd)
2023-08-09 13:51:00 +02:00
Dan Streetman
2bd3537dc3 tpm2: use CreatePrimary() to create primary keys instead of Create()
Older versions used CreatePrimary() to create a transient primary key to use
when creating a sealed data object. That was changed in v254 to use Create()
instead, which should result in the same transient key, but it seems some
hardware TPMs refuse to allow using Create() to generate primary keys.

This reverts to using CreatePrimary() to create primary key.

Fixes: #28654
(cherry picked from commit aff853f8ea29f22b28e3b584807893c528227769)
2023-08-09 13:51:00 +02:00
Yu Watanabe
6068122836 switch-root: reopen target directory after it is mounted
Fixes a bug introduced by f717d7a40a696b351415976f22a4f498c401de41.

(cherry picked from commit 2159662608a00232f94302bd5942d07830c279b4)
2023-08-09 13:51:00 +02:00
Yu Watanabe
c75ca56950 shutdown: do not umount recursively before MS_MOVE
Unmounting filesystem will be done gracefully by shutdown itself.

Follow-up for f2c1d491a539035d6cc1fa53a7cef0cbc8d52902 and
268d1244e87a35ff8dff56c92ef375ebf69d462e.

(cherry picked from commit 6b219b74de53729249956221a971047aab7c96e0)
2023-08-09 13:51:00 +02:00
Yu Watanabe
60046bf2a9 shutdown: disable recursive mount of /run/ on switching root
Mounting /run/ recursively may be harmless, but not necessary on
shutdown as the new root is /run/initramfs.

Follow-up for b12d41a8bb7c99f7d7a1c7821a886d98b42d9ce0.

(cherry picked from commit d709d1b20e2e15ee2ae1b44de94d493e17834235)
2023-08-09 13:51:00 +02:00
Khem Raj
6b03b53bcc include missing sys/file.h for LOCK_EX
(cherry picked from commit ac8db36cbc26694ee94beecc8dca208ec4b5fd45)
2023-08-09 13:51:00 +02:00
Khem Raj
de249cefe9 test/test-sizeof: Include sys/timex.h for struct timex
Fixes

../git/src/test/test-sizeof.c:64:41: error: incomplete definition of type 'struct timex'
   64 |         check(typeof(((struct timex *)0)->freq), SIZEOF_TIMEX_MEMBER);
      |                      ~~~~~~~~~~~~~~~~~~~^

(cherry picked from commit e6456caf7676329abe861e9381f1957794baeabc)
2023-08-09 13:51:00 +02:00
Jan Janssen
8fbfcbadf3 boot: Make file info size a constant
(cherry picked from commit e80037b10fff052357ab0e1fd2169b1cae00f875)
2023-08-09 13:51:00 +02:00
Jan Janssen
b44bd7d7a8 boot: Fix boot counting for XBOOTLDR entries
We were passing the dir handle for the ESP to
config_entry_bump_counters(), which will obviously fail if the entry
actually resides on the XBOOTLDR partition.

Fixes: #28637
(cherry picked from commit 66fd078ba89e90e8aeba6edac52d20456fc2cd5d)
2023-08-09 13:51:00 +02:00
Jan Janssen
ca38c7d81b bless-boot: Actually return successfully
$ journalctl -u systemd-bless-boot.service
systemd[1]: Starting Mark the Current Boot Loader Entry as Good...
systemd-bless-boot[536]: Marked boot as 'good'. (Boot attempt counter is at 2.)
systemd-bless-boot[536]: Can't find boot counter source file for '/loader/entries/arch.conf': Device or resource busy
systemd[1]: Finished Mark the Current Boot Loader Entry as Good.

(cherry picked from commit 8f30a066ff48325c9197ae3b103cd446852b9f3d)
2023-08-09 13:51:00 +02:00
Yu Watanabe
32a1b7aa0f journalctl: do not add io event source for stdout if it is a file
Fixes a bug introduced by 713342d9b09d717e9942ed08bd620c9159a98fb8.

Fixes #28636.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2228089.

(cherry picked from commit f882a986c271c3de1c622df0f1586946b4a09fef)
2023-08-09 13:51:00 +02:00
Frantisek Sumsal
eebf48abfa varlink: allocate the buffer for varlink FDs on the heap
Since it's ~16K, which might cause issues in environments with limited
stack space.

Resolves: #28635
(cherry picked from commit b456f2266afd839f8817235475e57c38e9d76dc9)
2023-08-09 13:51:00 +02:00
Yu Watanabe
d39bfd26d4 network-generator: make network file generated from ip=dhcp matches only physical interfaces
Otherwise, it also matches later created virtual devices, and that
breaks networks generated and managed by container management services,
like docker.

Closes #28626.

(cherry picked from commit c25aa6c8acc6d95eaacae7858a7057907d61a25e)
2023-08-09 13:51:00 +02:00
Khem Raj
c12373dc44 include sys/file.h for LOCK_EX
Fixes
| ../git/src/basic/user-util.c:708:30: error: use of undeclared identifier 'LOCK_EX'; did you mean 'LOCK_BSD'?
|   708 |         r = unposix_lock(fd, LOCK_EX);
|       |                              ^~~~~~~
|       |                              LOCK_BSD

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 213ddf2d0525535533a8d758b50b99fcbd31c17b)
2023-08-09 13:51:00 +02:00
Etienne Dechamps
7f1ee32108 NEWS: PrivateNetwork implies PrivateMounts
This is clearly a change that can break existing units, and broke my
system in at least two different ways. For this reason this should have
been added to NEWS in #26458, specifically c2da3bf, but wasn't.

(cherry picked from commit 6b2d576f2b38c0385bb056af328754ec8966f9fd)
2023-08-09 13:51:00 +02:00
Franck Bui
65d5b3561c test: install systemd-homed for openSUSE
This new sub-package has been recently introduced.

(cherry picked from commit 33ce0a899258ed8dfb4a234a9f67e678127d41f9)
2023-08-09 13:51:00 +02:00
Franck Bui
ca0c8adf9d test: console fonts are located in /usr/share on openSUSE
(cherry picked from commit ba0ff9fc0fa657024edd7a4a0aab01aa95b39ff5)
2023-08-09 13:51:00 +02:00
Daan De Meyer
094c648078 ukify: Only run systemd-measure after adding all sections
We were running systemd-measure before adding the sbat section,
let's fix that.

Also make sure we only pass --linux to systemd-measure once instead
of twice.

(cherry picked from commit d713104abef503708451a8efd88a7f5a78418f91)
2023-08-09 13:51:00 +02:00
Yu Watanabe
f1df09a9fd test: skip tests earlier when we do not have enough privileges
Hopefully fixes #28624.

(cherry picked from commit 46f0a4e7ac97b47c5718b718e3c6db4a8a8e78a0)
2023-08-09 13:51:00 +02:00
Yu Watanabe
a987b0f121 udev-builtin-net_id: fix potential buffer overflow
(cherry picked from commit 5660e68d651545b43e13a51b068e64022637a6c6)
2023-08-09 13:51:00 +02:00
David Rheinsberg
f81fb774e9 basic/memfd: fix memfd_map() seal test
Private mappings are required when F_SEAL_WRITE is set on a memfd,
because otherwise you could end up with writable mappings through
mprotect() and other calls. This is a limitation of the kernel
implementation, and might be lifted by future extensions.

Regardless, the current code tests for the full `is_sealed()` before
using MAP_PRIVATE. This might end up using MAP_SHARED for write-sealed
memfds, which will be refused by the kernel.

Fix this and make memfd_map() check for exactly `F_SEAL_WRITE`.

(cherry picked from commit 69688410566aa9e2a00530abd91e7dfef0212c83)
2023-08-09 13:51:00 +02:00
David Rheinsberg
555b772185 basic/memfd: add fcntl() wrappers
Add wrappers around GET/ADD_SEALS to allow future use outside of the
current `memfd_get/set_sealed()` helpers.

(cherry picked from commit 4d903003715b160acf7bf4baeffee7829ff99f85)
2023-08-09 13:51:00 +02:00
David Rheinsberg
2ca3e3c261 basic/memfd: reduce default seals to historic set
Rather than always setting all seals, make `memfd_set_seals()` employ
the original set of seals, that is: SEAL+GROW+SHRINK+WRITE

Historically, the memfd code was used with the out-of-tree memfd
patches, which merely supported a single seal ("SEALED", which
effectively was GROW+SHRINK+WRITE). When the code was adapted to the
upstream memfd seals, it was extended to the full seal set. With more
and more seals being added upstream, this because more problematic. In
particular, it is unclear what the function really is meant to achieve.

Instead of just adding all seals, the function is returned to its
original purpose: seal the memfd so futher modifications to its content
are prevented.

(cherry picked from commit e1007a928a18baad7726113c9f473dd8b17cc0fe)
2023-08-09 13:51:00 +02:00
David Rheinsberg
97673ddf36 basic/memfd: drop test for F_SEAL_SEAL
With `F_SEAL_SEAL` a memfd can disable further sealing operations,
effectively sealing the set of seals. Testing for it ensures that no
further seals can be added, it never prevents seals from being dropped,
since seals cannot be dropped, ever.

Now testing for `F_SEAL_SEAL` makes sense if you want to ensure that
some seals are *not* set. That is, you either test for the entire set of
seals to match a local set, or you verify that a specific seal is not
set. Neither is what we are doing, so it feels wrong requiring it to be
set.

By dropping the requirement for `F_SEAL_SEAL`, the same FD can be shared
with other entities while retaining the ability to further restrict the
set of seals later on (e.g., being able to mark a region as executable
later on, and then adding `F_SEAL_EXEC`).

(cherry picked from commit d268b22b25f4a911067b3779f06dce8355af6868)
2023-08-09 13:51:00 +02:00
David Tardon
5c47cc3929 core: free the strings in the set in other places too
Follow-up for #28551.

(cherry picked from commit 1a572fd08ff4a01f77d3b8c8465a559971c77466)
2023-08-09 13:51:00 +02:00
Daan De Meyer
9f3fd729a6 kernel-install: Make sure KERNEL_INSTALL_BYPASS is disabled in tests
(cherry picked from commit 4435da1f1732e2078e42b0ee43ad56fde2b021a3)
2023-08-09 12:34:40 +02:00