Commit graph

74196 commits

Author SHA1 Message Date
Mike Yuan 88188e1ff1 core/mount: stop generating mount units for cred mounts
While @poettering wants to keep mount units for credential
mounts, this has brought nothing but pain in real life.

By generating mount units for each cred mount, we had trouble
with default dependencies on them, which causes their stop jobs
to race with unmounting through exec_context_destroy_credentials().
There were several attempts to workaround the problem, but
none seems very graceful: #26959, #28787, #28957, #31360, #32011.
Also, we want to carry over credentials for services that
survive soft-reboot to the new mount tree, and during the practice
the stop of mount units are irritating.

The mentioned problems are ultimately resolved by disabling
default deps: #32799. But after doing that, maybe the next question
should be "why do we generate these mount units at all?"

Let's revisit the whole concept here. First of all, the credential
dirs are supposed to be opaque to users, and hence nobody should
really reference to these mounts directly. Secondly, the lifetime
of credentials is strictly bound to the service units, but nothing
else. Moreover, as more and more users of credentials pop up,
we could end up with hundreds of such mount units, which is
something we handle poorly. And we emit useless UnitRemoved signals,
etc...

As discussed, it seems that eliminating these mount units
is the correct way to go. No real use cases are impacted,
and the lifetime management becomes sane again.

Replaces #32011
2024-06-12 00:54:26 +01:00
Ian Abbott c8596cc640 udev: tag MTD devices for systemd
Allow systemd units to require/bind to MTD devices.  One use case is for
using a systemd service to attach an MTD device to an UBI controller,
which cannot be done until the MTD device has been probed.

Fixes #33096
2024-06-12 00:18:33 +01:00
Matthieu Baerts (NGI0) 3f69070598 core/socket: allow MPTCP protocol
Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths. It allows a device
to make use of multiple interfaces at once to send and receive TCP
packets over a single MPTCP connection. MPTCP can aggregate the
bandwidth of multiple interfaces or prefer the one with the lowest
latency, it also allows a fail-over if one path is down, and the traffic
is seamlessly re-injected on other paths.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [2]. To
use it on Linux, an application must explicitly enable it when creating
the socket:

  int sd = socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP);

No need to change anything else in the application.

This patch allows MPTCP protocol in the Socket unit configuration. So
now, a <unit>.socket can contain this to use MPTCP instead of TCP:

  [Socket]
  SocketProtocol=mptcp

MPTCP support has been allowed similarly to what has been already done
to allow SCTP: just one line in core/socket.c, a very simple addition
thanks to the flexible architecture already in place.

On top of that, IPPROTO_MPTCP has also been added in the list of allowed
protocols in two other places, and in the doc. It has also been added to
the missing_network.h file, for systems with an old libc -- note that it
was also required to include <netinet/in.h> in this file to avoid
redefinition errors.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.mptcp.dev [2]
2024-06-12 00:14:08 +01:00
Kamil Szczęk 608bfe76c1 core: populate $REMOTE_ADDR for AF_UNIX sockets
Set the $REMOTE_ADDR environment variable for AF_UNIX socket connections
when using per-connection socket activation (Accept=yes). $REMOTE_ADDR
will now contain the remote socket's file system path (starting with a
slash "/") or its address in the abstract namespace (starting with an
at symbol "@").

This information is essential for identifying the remote peer in AF_UNIX
socket connections, but it's not easy to obtain in a shell script for
example without pulling in a ton of additional tools. By setting
$REMOTE_ADDR, we make this information readily available to the
activated service.
2024-06-12 00:11:10 +01:00
Mike Yuan bd6e5b4d93 core/manager: enclose debug info acquirement in 'if (DEBUG_LOGGING)' 2024-06-12 00:10:12 +01:00
Daan De Meyer dc38f9addd rules: Limit the number of device units generated for serial ttys
As per the suggestion in https://github.com/systemd/systemd/issues/33242.

This reduces the number of /dev/ttySXX device units generated in
mkosi from 32 to 4.
2024-06-12 00:09:26 +01:00
Yu Watanabe 442c6bd4ba udev: rewrite token_match_attr() to make it easier for Coverity to understand
No functional change.

Closes CID#1469719.
2024-06-12 00:07:33 +01:00
Yu Watanabe 40f9fa0af4 sd-dhcp-server: clear buffer before receive
I do not think this is necessary, but all other places in
libsystemd-network we clear buffer before receive. Without this,
Coverity warns about use-of-uninitialized-values.
Let's silence Coverity.

Closes CID#1469721.
2024-06-12 00:06:46 +01:00
Luca Boccassi 1ea7bda77f meson: update version to 257~devel 2024-06-11 22:55:29 +01:00
Luca Boccassi 870a8a3cc5 NEWS: add placeholder for 257 2024-06-11 22:55:03 +01:00
Luca Boccassi 5c79cdec10 Finalize NEWS and version for v256 2024-06-11 22:42:06 +01:00
Luca Boccassi 8b884bdf36 Update hwdb
ninja -C build update-hwdb
2024-06-11 22:40:37 +01:00
Lennart Poettering a5139b1415 tpm2-util: tighten rules on the nvindex handle range we allocate from
Let's follow the conventions set by "Registry of Reserved TPM 2.0 Handles
and Localities" and only allocate nvindex currently not assigned to any
vendor.

For details see:

https://trustedcomputinggroup.org/resource/registry/

Section 2.2
2024-06-11 22:40:23 +01:00
Tobias Jakobi 9afc6ac87c hwdb: add keyboard mappings for the Ayaneo Kun face buttons
See comment in hwdb file for details.
2024-06-12 02:49:06 +09:00
Yu Watanabe 7b88bf087f shared: fix typo: dito -> ditto
Follow-up for bc9e5a4c67 and
3572d3df8f.
2024-06-12 02:34:39 +09:00
Zbigniew Jędrzejewski-Szmek 7b529bfc47 man: document that separate /usr/local/ must not be used for config
Since we document /usr/local/lib/systemd/ and other paths for various things,
add notes that this is not supported if /usr/local is a separate partition. In
systemd.unit, I tried to add the footnote in the table where
/usr/local/lib/systemd/ is listed, but that get's rendered as '[sup]a[/sup]'
with a mangled footnote at the bottom of the table :( .

Also, split paragraphs in one place where the subject changes without any
transition.

Follow-up for 02f35b1c90.
Replaces https://github.com/systemd/systemd/pull/33231.
2024-06-11 18:02:31 +01:00
Zbigniew Jędrzejewski-Szmek 835fbe5f75 bus-unit-util: extend the bus call timeout for UnitFreezer
Follow-up for 1d617b35fe.
Should fix https://github.com/systemd/systemd/issues/33269.

From the logs in the bug:
Jun 10 22:55:37 systemd-logind[909]: The system will suspend now!
Jun 10 22:55:37 ModemManager[996]: <msg> [sleep-monitor-systemd] system is about to suspend
...
Jun 10 22:55:48 systemd-sleep[422408]: Failed to freeze unit 'user.slice': Connection timed out
Jun 10 22:55:48 systemd-sleep[422408]: Performing sleep operation 'suspend'...

The delay is ~11 s, consistent with the patch that set the timeout to 10 s.
Looks like this is not enough. It's the freeze operation that fails, but
thawing might be slow too, so just bump the timeout again.
2024-06-11 14:56:00 +01:00
Daan De Meyer 7efaab482a chase: Tighten "." and "./" check
Currently the check also succeeds if the input path starts with a dot, whereas
we only want it to succeed for "." and "./". Tighten the check and add a test.
2024-06-11 13:55:35 +01:00
Yu Watanabe 8843726ac2 test-network: wait a while for addresses to be dropped
Hopefully fixes the following failure:
```
======================================================================
FAIL: test_ipv6_token_prefixstable (__main__.NetworkdRATests.test_ipv6_token_prefixstable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py", line 5705, in test_ipv6_token_prefixstable
    self.assertNotIn('2002:da8:1:0:b47e:7975:fc7a:7d6e/64', output) # the 1st prefixstable
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '2002:da8:1:0:b47e:7975:fc7a:7d6e/64' unexpectedly found in
  '19: veth99@veth-peer: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000\n
       inet6 2002:da8:1:0:b47e:7975:fc7a:7d6e/64 scope global tentative dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 2002:da8:1:0:da5d:e50a:43fd:5d0f/64 scope global dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 fe80::1034:56ff:fe78:9abc/64 scope link proto kernel_ll \n
          valid_lft forever preferred_lft forever'
----------------------------------------------------------------------
```
2024-06-11 13:52:41 +01:00
Zbigniew Jędrzejewski-Szmek 6eddfeebdb man/systemd-soft-reboot.service: upgrade drop-in to unit file for slice
Follow-up for d91c7c91bf.
Closes https://github.com/systemd/systemd/issues/33260.
2024-06-11 10:36:50 +01:00
Yu Watanabe 18200b426e shell-completion: update bash completion for networkctl 2024-06-11 10:35:55 +01:00
Yu Watanabe ba5e44e26b shell-completion: update bash-completion for udevadm
- Add missing options.
- Show device nodes when supported.

Closes #33265.
2024-06-11 10:35:29 +01:00
Yu Watanabe 60c1fec461 homed: fix typo
Follow-up for c4b5de7eff.
2024-06-11 15:52:13 +09:00
Yu Watanabe 753c896ff9 login: re-used -> reused
Suggested by Fossies.
2024-06-11 15:52:13 +09:00
Luca Boccassi 4800968bb2
Merge pull request #33264 from bluca/mkosi_dlopen_install
mkosi: install dlopen optional dependencies for debian/ubuntu builds
2024-06-10 21:57:04 +01:00
Luca Boccassi 3a46a00a26 mkosi: install dlopen optional dependencies for debian/ubuntu builds 2024-06-10 20:11:16 +01:00
Luca Boccassi 7f105dc1bd mkosi: update to latest 2024-06-10 14:17:15 +01:00
Mike Gilbert 953c60e2f1 user-util: fix fgetxxent_sane on musl
musl's implementation does not set errno to ENOENT when the end of file
is reached. It returns NULL and leaves errno unchanged.
2024-06-10 11:41:55 +02:00
Luca Boccassi fb8e05cc43 mkosi.prepare: do not install build dependencies with NO_BUILD 2024-06-10 09:10:59 +02:00
Luca Boccassi 581269f312 NEWS: fix typo 2024-06-09 22:08:41 +01:00
Luca Boccassi aa7f2246ba
Merge pull request #33241 from DaanDeMeyer/noble
ci: Switch to Ubuntu 24.04
2024-06-08 23:29:56 +01:00
Daan De Meyer 60f1e44ffe mkosi: Stop using tools tree
Noble has all the tooling we need so let's stop using a tools tree
and just install the dependencies we need on the host system.
2024-06-08 12:33:32 +02:00
Daan De Meyer 27cd8a61c1 mkosi: Replace sysusers.d with useradd for test user
sysusers.d is not intended for regular users, so let's use useradd
instead.
2024-06-08 12:33:32 +02:00
Daan De Meyer d5474f78b8 ci: Switch to Ubuntu 24.04 2024-06-08 12:33:32 +02:00
Daan De Meyer f42cb19931 mkosi: Update to latest 2024-06-08 12:33:28 +02:00
Daan De Meyer 4861eace12 presets: Don't enable systemd-homed-firstboot.service by default
Enabling this service by default means every CI image without a
regular user now gets stuck on first boot due to the password prompt
from systemd-homed-firstboot.service. Let's not enable the service
by default but instead require users to enable it explicitly if they
want its behavior.

Fixes #33249
2024-06-08 11:29:55 +01:00
Daan De Meyer 774eb5dbdd dev-setup: Follow /dev/console symlinks when locking /dev/console
systemd-nspawn sets up /dev/console as a symlink to a pty, so let's
make sure we follow the symlink when trying to lock /dev/console so
we don't fail with ELOOP.
2024-06-07 23:36:43 +01:00
Luca Boccassi d91c7c91bf man: note that templated surviving units need a drop-in for their slice
As reported on the mailing list, this is non-obvious, so document it.

https://lists.freedesktop.org/archives/systemd-devel/2024-June/050351.html
2024-06-07 12:33:18 +01:00
Luca Boccassi 3541e5e2a9
Merge pull request #33237 from bluca/dlopen_deps
mkosi: enable noble-backports for ubuntu and update debian packaging commit
2024-06-07 11:18:26 +01:00
Luca Boccassi 9f7f02bc71 mkosi: update debian packaging commit id 2024-06-07 10:02:53 +01:00
Luca Boccassi 46368556af mkosi: enable noble-backports for ubuntu
Required to get the new dh-dlopenlibdeps package
2024-06-07 10:02:53 +01:00
Luca Boccassi 73df6cd3ee Update version and finalize NEWS for 256~rc4 2024-06-06 20:39:50 +01:00
Zbigniew Jędrzejewski-Szmek ddef3ec87c run: do not pass the pty slave fd to transient service in a machine
Follow-up for 28459ba1f4

The pty path returned by OpenMachinePTY() cannot be opened from outside
the machine, hence let's use the plain Standard{Input,Output,Error}=tty
in such a case. This means if --machine= is specified, #32916 would occur.
A comprehensive fix requires a new dbus method in machined, which shall
be material for v257.

See also: https://github.com/systemd/systemd/pull/33216#discussion_r1628020429

Replaces #33216

Co-authored-by: Mike Yuan <me@yhndnzj.com>
2024-06-06 20:37:39 +01:00
Luca Boccassi 7632b8abc4
Merge pull request #33232 from bluca/chores
Chores for RC4
2024-06-06 20:37:11 +01:00
Daan De Meyer d49c09474d mkosi: Stop skipping pkcs11 test on opensuse
A fix was made to the softhsm package so the test now passes.
2024-06-06 18:59:44 +02:00
Luca Boccassi 71ca56efac NEWS: update contributors 2024-06-06 17:57:47 +01:00
Luca Boccassi bed6e7c8b4 Update syscalls tables
ninja -C build update-syscall-tables update-syscall-header
2024-06-06 17:56:12 +01:00
Luca Boccassi 8559030b33 Update hwdb
ninja -C build update-hwdb
2024-06-06 17:54:03 +01:00
Zbigniew Jędrzejewski-Szmek 152c8946b3
Revert "network: add "mac" to alternatives name policy by default" (#33227)
This reverts commit 0f5a529217.

As discussed in https://github.com/systemd/systemd/issues/33104,
that patch caused problems in Debian which has a udev drop-in with

  [Match]
  Path=*-usb-*

  [Link]
  NamePolicy=mac

The rename fails:
   eth0: Policy *mac* yields "enx00*".
   eth0: /usr/lib/udev/rules.d/80-net-setup-link.rules:11 NAME 'enx00*'
   eth0: /usr/lib/udev/rules.d/99-systemd.rules:69 RUN '/usr/lib/systemd/systemd-sysctl --prefix=/net/ipv4/conf/$name --prefix=/net/ipv4/neigh/$
   eth0: sd-device: Created database file '/run/udev/data/n9' for '/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/0000:03:01.0/0000:05:00.0/0000:
   eth0: Failed to rename network interface 9 from 'eth0' to 'enx00*': File exists
   eth0: sd-device: Created database file '/run/udev/data/n9' for '/devices/pci0000:00/0000:00:1c.4/0000:02:00.0/0000:03:01.0/0000:05:00.0/0000:
   eth0: Failed to process device, ignoring: File exists

Two network interfaces have the same MAC and it's not marked NET_ADDR_STOLEN.
In this case the conflict is very visible because it causes the rename to fail,
but it would also occur in other cases, for alternative names.

A patch has been submitted for r8152 to properly set NET_ADDR_STOLEN:
https://lore.kernel.org/linux-usb/20240605153340.25694-1-gmazyland@gmail.com/T/#u

Let's revert this now to avoid a regression. We can try again after the kernel
issue is resolved.

Closes https://github.com/systemd/systemd/issues/33104.
2024-06-06 17:35:46 +01:00
Daan De Meyer 9f2c92e3ba
Merge pull request #33218 from DaanDeMeyer/initrd-modules
mkosi: Include fewer modules in the initramfs
2024-06-06 18:01:00 +02:00