1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00
Commit Graph

56012 Commits

Author SHA1 Message Date
Yu Watanabe
85771e8df5 sysusers: also add root group
Follow-up for 49bb7fe5f8.

Fixes an issue reported at
https://github.com/systemd/systemd/pull/26270#issuecomment-1428945403.

(cherry picked from commit 9361a712f8)
(cherry picked from commit e91a304274)
(cherry picked from commit f32581ac80)
2023-02-16 20:59:05 +00:00
Daan De Meyer
2b068e24ba test-boot-timestamp: Handle ERANGE error
Timestampfs from sysfs files can be zero in which case ERANGE will
be returned so let's make sure we catch that.

(cherry picked from commit 0da4cc97b4)
(cherry picked from commit ef96e60f18)
(cherry picked from commit 18a2aaf2f6)
2023-02-16 15:02:59 +00:00
ml
1b7b67d22a man: fix directory for user home bind mounts
(cherry picked from commit f39d7d00a3)
(cherry picked from commit bfaf02348e)
(cherry picked from commit 067b5b7e89)
2023-02-16 15:02:59 +00:00
ml
b98d71f53c nspawn: fix directory in logged error
(cherry picked from commit 7b03b44ed9)
(cherry picked from commit cad1e9c53d)
(cherry picked from commit 3a44be9ad0)
2023-02-16 15:02:59 +00:00
Lennart Poettering
54b580e1a7 core: when isolating to a unit, also keep units running that are triggered by units we keep running
Inspired by: #26364

(this might even "fix" #26364, but without debug logs it's hard to make
such claims)

Fixes: #23055
(cherry picked from commit 32d6707dd1)
(cherry picked from commit c973e2295c)
(cherry picked from commit bfe6d1d197)
2023-02-13 21:10:07 +00:00
Samuel Cabrero
dde473ed45 userdb: Use json_dispatch_user_group_name() to parse GetMembership fields
It allows to relax the checks and allow characters like '\', used by
windows to split the domain name and user name.

For reference, discussion in the systemd-devel mailing list:
https://lists.freedesktop.org/archives/systemd-devel/2023-February/048804.html

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
(cherry picked from commit edd5ec2373)
(cherry picked from commit 68d11465e4)
(cherry picked from commit 132e153b90)
2023-02-13 21:10:07 +00:00
Luca Boccassi
3271bc9bec README: explicitly note that util-linux's mount/swap are required
These are the most visible and hard requirements, as we use options that
busybox does not provide, so list them explicitly to avoid surprises

(cherry picked from commit 164070e497)
(cherry picked from commit 0dc9f7335d)
(cherry picked from commit facb134183)
2023-02-13 21:10:07 +00:00
Zbigniew Jędrzejewski-Szmek
1734d9629d man: fix section number
Fixes #26376.

(cherry picked from commit 359c14368e)
(cherry picked from commit ebada36b7b)
(cherry picked from commit a05470812a)
2023-02-13 21:10:07 +00:00
Zbigniew Jędrzejewski-Szmek
4502e7928c manager: "downgrade" message about command vanishing from the unit file
We would print "Current command vanished from the unit file, execution of
the command list won't be resumed." as a warning, but most of the time there
is nothing to resume, because a unit has just one command. So let's detect
the case where the command that was active is the last command in the sequence
and skip the warning.

I was considering how to store the information that the command is last. An
important consideration is not to use a format that would confuse older versions
of systemd. (It wouldn't be a big problem if older systemd just refused the
new serialization, since we require systemd to be newer, but we should avoid
the case where the deserialization is "successful", but actually incorrect.)
Similarly, the deserialization from the old systemd must not confuse new systemd.
For this command, we have a list of arguments at the end, so just adding a
new field either in the middle or at the end is problematic because it's hard
to ensure that we don't mix up the positional and variable arguments.

We actually need to store just one bit of information, so '+' is prefixed on
the index of the last command and used by new systemd to skip the warning.
When deserializing from older systemd, '+' is not present, so we detect all
commands as "not last", and still emit the warning, so we err on the side of
caution. If the user were to deserialize from newer to older systemd, nothing
untoward would happen, because the '+' is ignored. (Users shouldn't do this,
but we know that this occasionally happens with initrds or exitrds and package
downgrades.)

(cherry picked from commit a99bd455b5)
(cherry picked from commit 9bb72a4e96)
(cherry picked from commit a71be850b5)
2023-02-13 21:10:07 +00:00
Zbigniew Jędrzejewski-Szmek
eeb9299eee test-parse-util: add tests with explicit plus character
I expected this to work, but our tests did not cover this
explicitly.

(cherry picked from commit 8eb491f499)
(cherry picked from commit 7c0ac515c8)
(cherry picked from commit 36c35e765d)
2023-02-13 21:10:07 +00:00
Zbigniew Jędrzejewski-Szmek
c20388003e core/service: constify ExecCommand* in two functions
(cherry picked from commit 502096b565)
(cherry picked from commit e811aead84)
(cherry picked from commit b4df64597b)
2023-02-13 21:10:07 +00:00
Luca Boccassi
0a3a54c069 core: imply DeviceAllow=/dev/tpmrm0 with LoadCredentialEncrypted
If the device access policy is restricted, add implicitly access to the TPM
if at least one encrypted credential needs to be loaded.

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

(cherry picked from commit 398dc7d39b)
(cherry picked from commit f0126ad7f9)
(cherry picked from commit 158760941f)
2023-02-13 21:10:07 +00:00
Yu Watanabe
4d447fb910 udevd: configure a child process name for worker processes
This effectively reverts commit ff86c92e30,
and re-apply 49f3ee7e74.

The change was dropped due to the process name was not correctly logged,
but the issue was fixed by dd15e4cb57.
Let's set the child process name again.

(cherry picked from commit e955a7f460)
(cherry picked from commit 62055cfd4b)
(cherry picked from commit a87c01d202)
2023-02-13 21:10:07 +00:00
Lennart Poettering
125655d13d journal: print a useful error message if we hit the journal file open limit
See: #20921
(cherry picked from commit 763c46defa)
(cherry picked from commit 1187340c9d)
(cherry picked from commit 2c984010bc)
2023-02-13 21:10:07 +00:00
Yu Watanabe
9fbbd7bf28 argv-util: also update program_invocation_short_name
Our logging uses program_invocation_short_name. Without this patch,
logs from forked client may become broken; spuriously truncated or
the short invocation name is not completely shown in the log.

(cherry picked from commit dd15e4cb57)
(cherry picked from commit ce4726468d)
(cherry picked from commit 7a862d9d1a)
2023-02-13 21:10:07 +00:00
Zbigniew Jędrzejewski-Szmek
53be27c44b repart: fix invalid errno in log
(cherry picked from commit 375ffdba43)
(cherry picked from commit 31b7785814)
(cherry picked from commit 828e73a7bb)
2023-02-13 21:10:07 +00:00
Robin Humble
a2dc9e3be9 pid1: fix segv triggered by status query (#26279)
If any query makes it to the end of install_info_follow() then I think symlink_target is set to NULL.
If that is followed by -EXDEV from unit_file_load_or_readlink(), then that causes basename(NULL)
which segfaults pid 1.

This is triggered by eg. "systemctl status crond" in RHEL9 if

/etc/systemd/system/crond.service
  -> /ram/etc/systemd/system/crond.service
  -> /usr/lib/systemd/system/.crond.service.blah.blah
  -> /usr/lib/systemd/system/crond.service

(cherry picked from commit 19cfda9fc3)
(cherry picked from commit 015b0ca928)
(cherry picked from commit 9a906fae89)
2023-02-13 21:10:07 +00:00
Jan Janssen
8523187071 meson: Install missing bash-completions
(cherry picked from commit 7b2f84e3f2)
(cherry picked from commit 6d8885af57)
(cherry picked from commit 3ae3405989)
2023-02-13 21:10:07 +00:00
Jan Janssen
0691c16e34 meson: Install missing network file
(cherry picked from commit 17be6f2709)
(cherry picked from commit aa79d157af)
(cherry picked from commit 8a91017dad)
2023-02-13 21:10:07 +00:00
Jan Janssen
9c232539c7 meson: Install all catalogs
(cherry picked from commit 3774ff06f2)
(cherry picked from commit 5bad071f73)
(cherry picked from commit 4aa6be359f)
2023-02-13 21:10:07 +00:00
Rudi Heitbaum
078ce6450a glibc: Conditionally #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
(cherry picked from commit 1bb6ba08b1)
(cherry picked from commit a8b9c4766d)
(cherry picked from commit f048fba73f)
2023-02-13 21:10:07 +00:00
Zbigniew Jędrzejewski-Szmek
1adad5d279 sysusers: insist that root group is 0
In https://bugzilla.redhat.com/show_bug.cgi?id=2156900 sysusers was reporting a
conflict between the following lines:
  u root 0:0 "Super User" /root /bin/bash
  u root    0     "Super User" /root

The problem is that those configurations are indeed not equivalent. If group 0
exists with a different name, the first line would just create the user, but the
second line would create a 'root' group with a different GID. The second
behaviour seems definitely wrong. (Or at least more confusing in practice than
the first one. The system is in a strange shape, but the second approach takes
an additional step than is worse than doing nothing.)

When this line was initially added, we didn't have the uid:gid functionality for
'u', so we didn't think about this too much. But now we do, so we should use it.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'g foobar 0'
Creating group 'foobar' with GID 0.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0 "Zuper zuper"'
src/sysusers/sysusers.c:1365: Creating group 'root' with GID 999.
src/sysusers/sysusers.c:1115: Suggested user ID 0 for root already used.
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 999 and GID 999.

vs.

$ build/systemd-sysusers --root=/var/tmp/inst7 --inline 'u root 0:0 "Zuper zuper"'
src/sysusers/sysusers.c:1183: Creating user 'root' (Zuper zuper) with UID 0 and GID 0.

(cherry picked from commit 49bb7fe5f8)
(cherry picked from commit 8ad3d68acd)
(cherry picked from commit c8b6bc7530)
2023-02-13 21:10:07 +00:00
Arsen Arsenović
5d8283f77d importd: Always specify file unpacked by tar
Despite popular belief, the default file extracted by GNU tar is not stdin.  It
is the value of the TAPE environment variable, falling back on a compile-time
constant.  On my system, the default value is /dev/full, which causes tar to
just spin forever due to --ignore-zeros.  Always specifying this flag is the
safe thing to do.

  ~$ tar --show-defaults
  --format=gnu -f/dev/full -b20 --quoting-style=escape
  --rmt-command=/usr/sbin/grmt

See also: ``(tar)defaults'', available via Info viewers, and in HTML form at:
https://www.gnu.org/s/tar/manual/html_node/defaults.html

(cherry picked from commit 181eea677d)
(cherry picked from commit 817b8441c4)
(cherry picked from commit 48f3e2d5c5)
2023-02-13 21:10:07 +00:00
Yu Watanabe
37d4bf1cd2 sd-dhcp-server: allow to send header only message
If we receive a header only message, and the server is running in relay
mode, then the assertion was triggered.

Fixes #26151.

(cherry picked from commit b52031dbbc)
(cherry picked from commit 7aeb2a8d4e)
(cherry picked from commit 41fdc8ed32)
2023-02-13 21:10:07 +00:00
Daan De Meyer
b5ab57bd6f resolve: Skip creating stubs if missing CAP_NET_BIND_SERVICE
If we don't have CAP_NET_BIND_SERVICE, we won't be able to bind
the stub listener socket, so let's skip creating it and log a warning.

We do the same for the extra stubs if they're configured on privileged
ports.

(cherry picked from commit 0398c084ef)
(cherry picked from commit ab877f7072)
(cherry picked from commit 2a36784277)
2023-02-13 21:10:07 +00:00
Daan De Meyer
92bed29fdd nspawn: Drop CAP_NET_BIND_SERVICE when in userns but not in netns
If we're in a user namespace but not unsharing the network namespace,
we won't be able to bind any privileged ports even with
CAP_NET_BIND_SERVICE, so let's drop it from the retained capabilities
so services can condition themselves on that.

(cherry picked from commit 2642d22adc)
(cherry picked from commit 3a49291f4b)
(cherry picked from commit 5037e0d27b)
2023-02-13 21:10:07 +00:00
Nick Rosbrook
70dcc16bc2 sd-netlink: add a test for rtnl_set_link_name()
Add a test that verifies a deleted alternative name is restored on error
in rtnl_set_link_name().

(cherry picked from commit b338a8bb40)
(cherry picked from commit 7299341bd1)
(cherry picked from commit 37df773b23)
2023-02-13 21:10:07 +00:00
Nick Rosbrook
00cdc7b300 sd-netlink: restore altname on error in rtnl_set_link_name
If a current alternative name is to be used to rename a network
interface, the alternative name must be removed first. If interface
renaming fails, restore the alternative name that was deleted if
necessary.

(cherry picked from commit 4d600667f8)
(cherry picked from commit 42d8817bd6)
(cherry picked from commit a536073a62)
2023-02-13 21:10:07 +00:00
Nick Rosbrook
be8b55dfcf sd-netlink: do not swap old name and alternative name
Commit 434a348380 ("netlink: do not fail when new interface name is
already used as an alternative name") added logic to set the old
interface name as an alternative name, but only when the new name is
currently an alternative name. This is not the desired outcome in most
cases, and the important part of this commit was to delete the new name
from the list of alternative names if necessary.

(cherry picked from commit 080afbb57c)
(cherry picked from commit 3dc5b19f10)
(cherry picked from commit facb873e6f)
2023-02-13 21:10:07 +00:00
Nick Rosbrook
d57acef8ce udev/net: allow new link name as an altname before renaming happens
When configuring a link's alternative names, the link's new name to-be
is not allowed to be included because interface renaming will fail if
the new name is already present as an alternative name. However,
rtnl_set_link_name will delete the conflicting alternative name before
renaming the device, if necessary.

Allow the new link name to be set as an alternative name before the
device is renamed. This means that if the rename is later skipped (i.e.
because the link is already up), then the name can at least still be
present as an alternative name.

(cherry picked from commit d0b31efc1a)
(cherry picked from commit 7918496dcf)
(cherry picked from commit ba896a6de0)
2023-02-13 21:10:07 +00:00
msizanoen1
71f9e1fab8 unit: always return 1 in log_kill
This ensures that cg_kill_items returns the correct value to let the
manager know that a process was killed.

(cherry picked from commit 500cd2e83b)
(cherry picked from commit 86686e4292)
(cherry picked from commit 64d7289214)
2023-02-13 21:10:07 +00:00
Ilya Leoshkevich
d8d3106ea8 bpf: fix restrict_fs on s390x
Linux kernel's bpf-next contains BPF LSM support for s390x. systemd's
test-bpf-lsm currently fails with this kernel.

This is an endianness issue: in the restrict_fs bpf program,
magic_number has type unsigned long (64 bits on s390x), but magic_map
keys are uint32_t (32 bits). Accessing magic_map using 64-bit keys may
work by accident on little-endian systems, but fails hard on big-endian
ones.

Fix by casting magic_number to uint32_t.

(cherry picked from commit 907046282c)
(cherry picked from commit f62e7b4704)
(cherry picked from commit 25cb55890e)
2023-02-13 21:10:07 +00:00
Yu Watanabe
3dd120c2ea network: dhcp-server: do not create DHCPServer object when the DHCP server is running in relaying mode
Follow-up for c95df5879e.

Fixes #26196.

(cherry picked from commit 2cb1cabb41)
(cherry picked from commit 318b6f60b8)
(cherry picked from commit 0f967fba15)
2023-02-13 21:10:07 +00:00
Tuetuopay
1568716193 network/dhcp4: accept local subnet routes from DHCP
RFC3442 specifies option 121 (Classless Static Routes) that allow a DHCP
server to push arbitrary routes to a client. It has a Local Subnet
Routes section expliciting the behavior of routes with a null (0.0.0.0)
gateway.

Such routes are to be installed on the interface with a Link scope, to
mark them as directly available on the link without any gateway.

Networkd currently drops those routes, which is against the RFC, as
Linux has proper support for such routes.

Fixes: 7f20627 ("network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network")
(cherry picked from commit 1d84a3c779)
(cherry picked from commit b0f514ba56)
(cherry picked from commit ee6475d318)
2023-02-13 21:10:07 +00:00
Lennart Poettering
18440f9b91 resolvectl: don't filter loopback DNS server from global DNS server list
"resolvectl status" shows per-link DNS servers separately from global
ones. When querying the global list, it will contain both per-link and
global servers however. Thus, to not show duplicate info we filter all
entries that actually have a non-zero ifindex set (under the assumption
that that's a per-link server).

This doesn't work if people configured 127.0.0.1 as global server
though, as we'll add ifindex 1 to it since
6e32414a66 unconditionally even for global
servers.

Let's address that by excluding entries with ifindex 1 from suppression.
This is safe as resolved ignores loopback ifaces, hence never will have
per-link servers on ifindex 1.

Note that this splits up the "with_ifindex" parameter into a second
parameter "only_global", since they semantically do two different
things. One controls whether we shall expect/parse an ifindex dbus
field. The other controls whether we shall filter all ifindex values set
!= 0. These are effectively always used in conjunction hence making them
the same actually worked. However this is utterly confusing I think,
which as I guess is resulting in the confusion around #25796 (which
removes the whole check)

Replaces: #25796
(cherry picked from commit 889a1b9f4e)
(cherry picked from commit b71ade8779)
(cherry picked from commit fa04709a3d)
2023-02-13 21:10:07 +00:00
Lennart Poettering
2e6d400fd8 resolvectl: fix type of ifindex D-Bus field, and make sure to initialize to zero in all code paths
(cherry picked from commit a5e6c8498c)
(cherry picked from commit ed26f98f2f)
(cherry picked from commit 87307bfdd1)
2023-02-13 21:10:07 +00:00
msizanoen1
1c36c0b5a1 udev: match device tags in rules using current device tags
This ensures that udev scripts using `TAG-="..."` and expecting later
udev rules to honor it will work properly. An use case is removing the
`uaccess` tag from a device without overriding the original file and
ensuring that `73-seat-uaccess.rules` won't run the uaccess builtin later.

(cherry picked from commit 3102499039)
(cherry picked from commit 7d4ea095d5)
(cherry picked from commit ca948c9601)
2023-02-13 21:10:07 +00:00
Lennart Poettering
0d315ca6e7 docs: remove /dev/tty* confusion
The text said /dev/tty* as a whole was the VT subsystem and that VT is
not supported in containers.

But that's not accurate as /dev/tty* will match /dev/tty too and that
one device node is special and is not related to VT: it always points to
the current process own controlling tty, regardless what that is.

hence, rewrite /dev/tty* as /dev/tty[0-9]*.

(cherry picked from commit 6ae5c39af1)
(cherry picked from commit f3d620f5d2)
(cherry picked from commit b4e56b13a9)
2023-02-13 21:10:07 +00:00
Lennart Poettering
230ade8bff units: pull in loop.ko and dm-mod.ko before repart
We want to make use of that when formatting file systems, hence let's
pull in these modules explicitly.

(This is necessary because we are an early boot service that might run
before systemd-tmpfiles-dev.service, which creates /dev/loop-control and
/dev/mapper/control.)

Alternatively we could just order ourselves after
systemd-tmpfiles-dev.service, but I think there's value in adding an
explicit minimal ordering here, since we know what we'll need.

Fixes: #25775
(cherry picked from commit ce7dcfd6b0)
(cherry picked from commit 3856b97f8b)
(cherry picked from commit 208153c32b)
2023-02-13 21:10:07 +00:00
Lennart Poettering
9a2d8e4620 units: change modprobe@dm-mod.service → modprobe@dm_mod.service
Follow-up for 8f1359bf85

(cherry picked from commit 143a1f1039)
(cherry picked from commit 67467efd58)
(cherry picked from commit 923264e034)
2023-02-13 21:10:07 +00:00
Nishal Kulkarni
54743fff8d shell-completion: Add completion for oomctl
Added bash and zsh completions for oomctl arguments and commands.

Related To: #22118

(cherry picked from commit de0988f9d2)
2023-01-28 00:50:04 +00:00
Lennart Poettering
e4fccaf370 mkosi: pull in libbpf1 instead of legacy libbpf0 on debian
(cherry picked from commit 0d9e6d76be)
(cherry picked from commit 31bb2ef7ea)
(cherry picked from commit 1ee30b0ea9)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
96be2340d6 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 610eb3f826)
(cherry picked from commit 31cfa1cc96)
(cherry picked from commit 4fbf69fd1b)
2023-01-28 00:50:04 +00:00
Daan De Meyer
18b7b6a38a test-execute: Skip when /sys is read-only
The test depends on /sys being writable, so let's skip it when /sys
is read-only.

(cherry picked from commit 34b5977015)
(cherry picked from commit 4dc37994e2)
(cherry picked from commit 0acf4d71e0)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
077aeaf270 partition: fix build with newer linux/btrfs.h uapi header
linux/btrfs.h needs  to be included after sys/mount.h, as since [0]
linux/btrfs.h includes linux/fs.h causing build errors:

```
In file included from /usr/include/linux/fs.h:19,
                 from ../src/basic/linux/btrfs.h:29,
                 from ../src/partition/growfs.c:6:
/usr/include/sys/mount.h:35:3: error: expected identifier before numeric constant
   35 |   MS_RDONLY = 1,                /* Mount read-only.  */
      |   ^~~~~~~~~
[1222/2169] Compiling C object systemd-creds.p/src_creds_creds.c.o
ninja: build stopped: subcommand failed.
```

See: https://github.com/systemd/systemd/issues/8507

[0] a28135303a

(cherry picked from commit ed614f17fc)
(cherry picked from commit 8f84df0da3)
(cherry picked from commit 1fc632e151)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
442ee8c50d basic/linux: update linux uapi headers
IPPROTO_L2TP was moved from linux/l2tp.h to linux/in.h [0], so let's
reflect that change to fix build with newer kernels:

```
In file included from ../src/libsystemd/sd-netlink/netlink-types-genl.c:10:
../src/basic/linux/l2tp.h:16: error: "IPPROTO_L2TP" redefined [-Werror]
   16 | #define IPPROTO_L2TP            115
      |
In file included from ../src/libsystemd/sd-netlink/netlink-types-genl.c:3:
/usr/include/netinet/in.h:85: note: this is the location of the previous definition
   85 | #define IPPROTO_L2TP            IPPROTO_L2TP
      |
cc1: all warnings being treated as errors
```

When at it, update the rest of the headers we ship as well.

[0] 65b32f801b

(cherry picked from commit a95ff98ec4)
(cherry picked from commit 240513ceca)
(cherry picked from commit 4bc291c1d4)
2023-01-28 00:50:04 +00:00
Nick Rosbrook
24a8928a26 test: make sure mount point exists in testsuite-64.sh
(cherry picked from commit 84e5b9225d)
(cherry picked from commit 07e4787106)
(cherry picked from commit bd32bbebd5)
2023-01-28 00:50:04 +00:00
Luca Boccassi
02332752b3 core: ensure init.scope is realized after drop-ins have been loaded
If we add a drop-in for init.scope (e.g.: to set some memory limit),
it will be loaded long after the cgroup has already been realized.
Do it again when creating the special unit.

(cherry picked from commit 020b2e41ea)
(cherry picked from commit 786b7a7208)
(cherry picked from commit ffa329c45c)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
e014c02f57 test: bump the client-side timeout in sd-bus as well
Since c78d18215b D-Bus services now have 60s to start, but the client
side (sd-bus) still waits only for 25s before giving up:

```
[  226.196380] testsuite-71.sh[556]: + assert_in 'Static hostname: H' ''
[  226.332965] testsuite-71.sh[576]: + set +ex
[  226.332965] testsuite-71.sh[576]: FAIL: 'Static hostname: H' not found in:
[  228.910782] sh[577]: + systemctl poweroff --no-block
[  232.255584] hostnamectl[565]: Failed to query system properties: Connection timed out
[  236.827514] systemd[1]: end.service: Consumed 2.131s CPU time.
[  237.476969] dbus-daemon[566]: [system] Successfully activated service 'org.freedesktop.hostname1'
[  237.516308] systemd[1]: system-modprobe.slice: Consumed 1.533s CPU time.
[  237.794635] systemd[1]: testsuite-71.service: Main process exited, code=exited, status=1/FAILURE
[  237.818469] systemd[1]: testsuite-71.service: Failed with result 'exit-code'.
[  237.931415] systemd[1]: Failed to start testsuite-71.service.
[  238.000833] systemd[1]: testsuite-71.service: Consumed 5.651s CPU time.
[  238.181030] systemd[1]: Reached target testsuite.target.
```

Let's override the timeout in sd-bus as well to mitigate this.

Follow-up to c78d18215b.

(cherry picked from commit e0cbb73911)
(cherry picked from commit e4ed752f23)
(cherry picked from commit f69dc64d38)
2023-01-28 00:50:04 +00:00
Michal Koutný
ff542dcd1a core: mount namespaces: Remove auxiliary bind mounts directory after unit termination
Unit that requires its own mount namespace creates a temporary directory
to implement dynamic bind mounts (org.freedesktop.systemd1.Manager.BindMountUnit).
However, this directory is never removed and they will accumulate for
each unique unit (e.g. templated units of systemd-coredump@).

Attach the auxiliary runtime directory existence to lifetime of other
"runtime" only per-unit directories.

(cherry picked from commit b9f976fb45)
(cherry picked from commit 80e8340ec4)
(cherry picked from commit fd260cb37e)
2023-01-28 00:50:04 +00:00