1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-28 11:21:59 +03:00
Commit Graph

69493 Commits

Author SHA1 Message Date
Michal Koutný
4fb0d2dc14 cgroup: Add EffectiveMemoryMax=, EffectiveMemoryHigh= and EffectiveTasksMax= properties
Users become perplexed when they run their workload in a unit with no
explicit limits configured (moreover, listing the limit property would
even show it's infinity) but they experience unexpected resource
limitation.

The memory and pid limits come as the most visible, therefore add new
unit read-only properties:
- EffectiveMemoryMax=,
- EffectiveMemoryHigh=,
- EffectiveTasksMax=.

These properties represent the most stringent limit systemd is aware of
for the given unit -- and that is typically(*) the effective value.

Implement the properties by simply traversing all parents in the
leaf-slice tree and picking the minimum value. Note that effective
limits are thus defined even for units that don't enable explicit
accounting (because of the hierarchy).

(*) The evasive case is when systemd runs in a cgroupns and cannot
reason about outer setup. Complete solution would need kernel support.
2024-01-03 13:37:08 +01:00
Mike Yuan
bc9e592c4f systemctl: configure boot loader options only when going through firmware
Fixes #30497
2023-12-21 01:35:55 +09:00
Yu Watanabe
c780591bba
Merge pull request #30538 from poettering/ptyfwd-reset-color
ptyfwd: reset colors when we exit the pty forwarding logic
2023-12-21 01:17:00 +09:00
Yu Watanabe
0d1290977d
Merge pull request #30543 from YHNdnzj/execute-cleanup
core/execute: trivial cleanup
2023-12-21 01:16:34 +09:00
Lennart Poettering
518c4f0488 ptyfwd: make sure pty_forward_free() follows our usual semantics regarding NULL 2023-12-20 15:49:59 +01:00
Lennart Poettering
e7d2b00e0d ptyfwd: reset colors when we exit the pty forwarding logic
Just in case there was still a color set, make sure to reset things.
2023-12-20 15:49:09 +01:00
Yu Watanabe
760e7a3cb1
Merge pull request #30537 from poettering/run-arg-service-type-fix
run: arg_service_type is not supposed to be allocated from heap
2023-12-20 23:46:11 +09:00
Yu Watanabe
63d0491bbc
Merge pull request #30536 from yuwata/network-bridge-vlan-debugging-logs
network/bridge-vlan: add debugging logs and documentation update
2023-12-20 23:46:01 +09:00
Mike Yuan
e03975b90f
core/execute: use assertion for _done function
As per our usual coding style.
2023-12-20 21:56:49 +08:00
Mike Yuan
a7774a8ccb
core/execute: remove unneeded brackets
I did not merge the if-s, since I think it's easier to read
in the current form with those long socketpair() calls.
2023-12-20 21:52:59 +08:00
Daan De Meyer
929f41c652 bootctl: update/list/remove all instances of systemd-boot in /EFI/BOOT
systemd-boot might be installed in /EFI/BOOT under more names than
just /EFI/BOOT/BOOTX64.efi. The prime example is shim which loads
its second stage binary from /EFI/BOOT/grubx64.efi. To accomodate
use cases where systemd-boot is installed as /EFI/BOOT/grubx64.efi,
let's always check the entire /EFI/BOOT directory for binaries that
identify as systemd-boot and list/update/remove those as well.

Let's keep this somewhat generic though and not install ourselves as
grubx64.efi since that would mean having to check for shim which is
a can of worms we probably don't want to open.
2023-12-20 13:56:02 +01:00
Franck Bui
3553fddb1e rules: set up tty permissions and group for /dev/hvc* nodes
Before b4bf9007cb, the permissions and group of the hypervisor consoles were
set by agetty(8).
2023-12-20 21:01:05 +09:00
Yu Watanabe
8f876e8d98
Merge pull request #30525 from YHNdnzj/networkctl-mask
networkctl: introduce verb mask and unmask
2023-12-20 21:00:36 +09:00
Lennart Poettering
e132be4642 run: underline section titles in --help as we usually do 2023-12-20 12:14:24 +01:00
Lennart Poettering
4b5baf7514 run: arg_service_type is not supposed to be allocated from heap 2023-12-20 12:13:18 +01:00
Yu Watanabe
1e67047f99 network/bridge-vlan: add debugging logs about set or removed VLAN IDs
Addresses https://github.com/systemd/systemd/pull/29987#issuecomment-1863937968.
2023-12-20 19:47:08 +09:00
Yu Watanabe
03a46b5eca man,NEWS: mention that all previously assigned VLAN IDs are cleared
Addresses https://github.com/systemd/systemd/pull/29987#issuecomment-1863934902.
2023-12-20 19:22:53 +09:00
Yu Watanabe
b9e6e92510 man: fix indentation 2023-12-20 19:21:11 +09:00
Yu Watanabe
89cc97d30d
Merge pull request #30534 from yuwata/man-page-update-and-fix-typo
Man page update and fix typo
2023-12-20 18:43:32 +09:00
Frantisek Sumsal
92ee875a31 test: trigger /boot mount if it's an automount
If the target mount point is an automount, checking it for writeability
without triggering it first is iffy and yields different results based
on kernel version:

~# systemd-run --wait --pipe -p ProtectSystem=yes bash -xec 'uname -r; mount -l | grep boot; test ! -w /boot'
Running as unit: run-u36.service; invocation ID: f948ff4f3c8e4bcfba364ead94bd0ad9
+ uname -r
4.18.0-529.el8.x86_64
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=43,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=356096)
+ test '!' -w /boot
Finished with result: exit-code
Main processes terminated with: code=exited/status=1

~# systemd-run --wait --pipe -p ProtectSystem=yes bash -xec 'uname -r; mount -l | grep boot; test ! -w /boot'
Running as unit: run-u274.service; invocation ID: ccc53ed63c3249348cf714f97a3a7026
+ uname -r
6.6.7-arch1-1
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=95,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=730583)
+ test '!' -w /boot
Finished with result: success
Main processes terminated with: code=exited/status=0

One solution would be to use /boot/ instead of just /boot, which triggers
the automount during the check, but in that case the mount would happen
_after_ we apply the ProtectSystem= stuff, so the mount point would
be unexpectedly writable:

~# systemd-run --wait --pipe -p ProtectSystem=yes bash -xec 'uname -r; mount -l | grep boot; test ! -w /boot/ || mount -l | grep boot'
Running as unit: run-u282.service; invocation ID: 2154f6b4cbd34ddeb3e246cb7c991918
+ uname -r
6.6.7-arch1-1
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=95,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=730583)
+ test '!' -w /boot/
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=95,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=730583)
/dev/vda2 on /boot type vfat (rw,nosuid,nodev,noexec,relatime,nosymfollow,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)

Let's just trigger the (possible) automounts explicitly before we do any
checks to avoid all this stuff.

Also, when at it, check that ProtectSystem=yes|full correctly protects
the ESP mount as well.

Follow-up for 97bbb9cfbd.
2023-12-20 18:15:35 +09:00
Yu Watanabe
d562667f7d userdb: fix typo
Follow-up for 523121d543.
2023-12-20 15:12:10 +09:00
Yu Watanabe
044149e615 man: environment value -> udev property
These are not environment variables, but udev properties.

Follow-up for 3b2e7dc5a2.
2023-12-20 15:08:52 +09:00
Mike Yuan
28bb29cbb4
networkctl: introduce verb mask and unmask
Suggested in https://github.com/systemd/systemd/pull/29928#discussion_r1386626565
2023-12-20 12:46:46 +08:00
Mike Yuan
7ce6a0960f
networkctl-config-file: check for masked config before editing/showing 2023-12-20 12:46:46 +08:00
Mike Yuan
078fad363e
networkctl-config-file: split out reload_daemons 2023-12-20 12:46:46 +08:00
Mike Yuan
c5f51d5f3f
networkctl-cat: insert a newline between different config files 2023-12-20 12:46:45 +08:00
Mike Yuan
15fde154f8
networkctl: split out networkctl-config-file.[ch] 2023-12-20 12:46:43 +08:00
Mike Yuan
2886cadc72
shared/install: use RET_GATHER more 2023-12-20 12:44:50 +08:00
Yu Watanabe
e2ceb696d6
Merge pull request #30493 from teknoraver/main
Add verbose output on unit start #5717
2023-12-20 13:42:59 +09:00
Frantisek Sumsal
68785c7d6a test: reset systemd-resolved.service's restart counter
Otherwise we might occasionally hit the start rate limit, as we restart
the service a bunch of times:

[ 3702.280886] testsuite-75.sh[1135]: + tee /tmp/tmp.wUL8bkJwrt
[ 3702.283684] testsuite-75.sh[1135]: {}
[ 3702.284254] testsuite-75.sh[46]: + restart_resolved
[ 3702.284302] testsuite-75.sh[46]: + systemctl stop systemd-resolved.service
[ 3702.310678] testsuite-75.sh[1140]: + systemctl is-failed systemd-resolved.service
[ 3702.316766] testsuite-75.sh[1141]: inactive
[ 3702.316998] testsuite-75.sh[46]: + systemctl start systemd-resolved.service
[ 3702.322315] systemd[1]: systemd-resolved.service: Start request repeated too quickly.
[ 3702.322343] systemd[1]: systemd-resolved.service: Failed with result 'start-limit-hit'.
[ 3702.322609] systemd[1]: Failed to start systemd-resolved.service - Network Name Resolution.
[ 3702.323619] systemctl[1142]: Job for systemd-resolved.service failed.
[ 3702.323839] systemctl[1142]: See "systemctl status systemd-resolved.service" and "journalctl -xeu systemd-resolved.service" for details.
[ 3702.325035] systemd[1]: testsuite-75.service: Failed with result 'exit-code'.
[ 3702.325391] systemd[1]: Failed to start testsuite-75.service - Tests for systemd-resolved.

Follow-up for b1384db11b and 6ef512c0bb.
2023-12-20 13:42:08 +09:00
Lennart Poettering
1a424b0721 varlink: these two errors where added to the spec, we aren't squatting the namespace anymore
4443c57f1e
2023-12-20 12:22:05 +08:00
Luca Boccassi
08542781e2
Merge pull request #30531 from yuwata/trivial-cleanups
Trivial cleanups
2023-12-19 23:19:25 +01:00
Yu Watanabe
5d889f3ab8 signal-util: align table 2023-12-20 03:07:46 +09:00
Yu Watanabe
97df9fa065 time-util: make usleep_safe() return earlier if 0 is passed 2023-12-20 03:07:46 +09:00
Daan De Meyer
06cfce8671
Merge pull request #30527 from DaanDeMeyer/sys
test: Skip various tests when /sys is not mounted
2023-12-19 18:59:09 +01:00
Daan De Meyer
a412a1b92a test: Skip various tests when /sys is not mounted
When running tests in a container, /sys might not be mounted, so
let's make sure we skip tests that depend on /sys in this case.
2023-12-19 16:38:57 +01:00
Daan De Meyer
79f44fb8a1 test: Make sure SYSTEMD_HWDB_UPDATE_BYPASS is disabled in the hwdb test
Let's make this test independent on what's in the environment.
2023-12-19 16:01:54 +01:00
Daan De Meyer
53ea4d7a47 mkosi: Add strace and gdb to base image build packages
For debugging failing tests in combination with mkosi's --debug-shell.
2023-12-19 15:59:16 +01:00
Matteo Croce
b408d46b83 systemctl: show success messages when showing transaction
Extend `--show-transaction` so it shows a success message when an unit
is successfully started.
2023-12-19 04:52:41 -08:00
Matteo Croce
e22ad53d5c dbus-wait-for-jobs: change 'quiet' flag to enum
Change the 'quiet' flag to `bus_wait_for_jobs()` to an enum, so we can
select with more granularity the type of information logged.
2023-12-19 04:52:41 -08:00
Frantisek Sumsal
97e52d62fb Revert "mkosi: pin CentOS8 kernel to working version"
A fixed kernel finally landed on mirrors, so let's revert the C8S kernel
pin.

This reverts commit a64398b2ca.
2023-12-19 12:48:55 +00:00
Yu Watanabe
422d8905c0 find-esp: add debugging log about failure in parsing env variable
Addresses https://github.com/systemd/systemd/pull/30321#discussion_r1429716344.
2023-12-19 12:01:26 +01:00
Lukas Nykryn
3b2e7dc5a2 udev: allow/denylist for reading sysfs attributes when composing a NIC name
Users can currently pick specific versions of NIC naming, but that
does not guarantee that NIC names won't change after the kernel adds
a new sysfs attribute.

This patch allows for an allow/deny list of sysfs attributes
that could be used when composing the name.

These lists can be supplied as an hwdb entry in the form of
/etc/udev/hwdb.d/50-net-naming-allowlist.hwdb
net:naming:drvirtio_net
  ID_NET_NAME_ALLOW=0
  ID_NET_NAME_ALLOW_ACPI_INDEX=1
  ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1
  ID_NET_NAME_ALLOW_ADDRESS=1
  ID_NET_NAME_ALLOW_ARI_ENABLED=1
  ID_NET_NAME_ALLOW_DEV_PORT=1
  ID_NET_NAME_ALLOW_FUNCTION_ID=1
  ID_NET_NAME_ALLOW_IFLINK=1
  ID_NET_NAME_ALLOW_INDEX=1
  ID_NET_NAME_ALLOW_LABEL=1
  ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1
  ID_NET_NAME_ALLOW_TYPE=1
2023-12-19 19:15:52 +09:00
Yu Watanabe
91436851d5
Merge pull request #30491 from fbuihuu/vconsole-handle-kd-grahpics-mode
vconsole-setup: handle the case where the vc is in KD_GRAPHICS mode m…
2023-12-19 11:49:31 +09:00
Lennart Poettering
8722c7e7bc siphash: make sure siphash24_compress_usec_t() works the same on LE/BE archs
Let's be systematic here, and always hash LE values. It doesn't matter
in our current codebase, but it might one day.
2023-12-19 11:48:53 +09:00
Yu Watanabe
03251a0b40
Merge pull request #30518 from mrc0mmand/assorted-tweaks
A couple of assorted tweaks
2023-12-19 11:48:40 +09:00
Lennart Poettering
e22ca70008 ether-addr-util: split out logic to mark MAC addresses as random 2023-12-19 11:48:05 +09:00
Frantisek Sumsal
32c376a46c test: add missing operators
Without them only the last expression's return value is honored, causing
unexpected CI fails:

[   26.006721] testsuite-04.sh[1191]: + for _ in {0..9}
[   26.007672] testsuite-04.sh[1191]: + setterm --term linux --dump --file /tmp/console.dump
[   26.008871] testsuite-04.sh[1233]: + SYSTEMD_COLORS=256
[   26.009606] testsuite-04.sh[1233]: + /usr/lib/systemd/systemd-bsod
[   26.063296] systemd[1]: session-1.scope: Deactivated successfully.
[   26.124789] testsuite-04.sh[1191]: + grep -aq 'Press any key to exit' /tmp/console.dump
[   26.131509] testsuite-04.sh[1191]: + grep -aq 'Root emergency message' /tmp/console.dump
[   26.137882] testsuite-04.sh[1191]: + grep -aq 'The current boot has failed' /tmp/console.dump
[   26.141650] testsuite-04.sh[1191]: + return 0
[   26.144816] testsuite-04.sh[1191]: + grep -aq 'Scan the QR code' /tmp/console.dump
[   26.153591] testsuite-04.sh[1191]: + at_exit
[   26.154744] testsuite-04.sh[1191]: + local EC=1
[   26.155697] testsuite-04.sh[1191]: + [[ 1 -ne 0 ]]
[   26.156787] testsuite-04.sh[1191]: + [[ -e /tmp/console.dump ]]
[   26.157799] testsuite-04.sh[1191]: + cat /tmp/console.dump
[   26.158858] testsuite-04.sh[1244]:    The current boot has failed!
[   26.159858] testsuite-04.sh[1244]:    Root emergency message

I'm genuinely impressed that this worked at all.
2023-12-19 11:47:17 +09:00
Ronan Pigott
d4fd7fb5d7 typo: transer -> transfer 2023-12-19 11:46:47 +09:00
Frantisek Sumsal
e80c6ea740 pcrlock: use empty_or_dash() more 2023-12-18 17:26:19 +01:00