summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* pam: cache sd-bus separately per moduleLuca Boccassi2023-04-244-15/+30
| | | | | | | | | | | | | | | | sd-bus connection is cached by the two pam modules globally, but this can lead to issues due to hashmaps (used by sd-bus) using a global static variable for the shared hash key, which is different per module as both modules are loaded in the same process. This happens because the sd-bus object is create in one module, but used in the other, so global state does not match. Use a different pam cache identifier for the sd-bus pointer, so that each module uses a different sd-bus connection as a workaround. Fixes https://github.com/systemd/systemd/issues/27216 Fixes https://github.com/systemd/systemd/issues/17266
* pam_systemd_home: clean up sd-bus when called about something else's userLuca Boccassi2023-04-241-1/+2
| | | | | | | | | | | | | | acquire_home() takes a reference to a sd-bus object, which the open_session hook cleans on success. But only when handling a user actually owned by homed, it did not clean it up when skipping because it is being invoked on a system user. We need to be careful with sd-bus here as pam_sm_open_session is the last hook before forking, and we want to clean up sd-bus before that happens, or we'll have a broken reference (FDs are cloexec) in the child process, which will then assert when attempting to close them, or leak the bus connection which causes dbus to complain loudly: dbus-daemon[62]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30020ms)
* Merge pull request #27367 from bluca/mkosi_resolveDaan De Meyer2023-04-244-5/+5
|\ | | | | mkosi: add tmpfiles to handle locale/resolve.conf in Debian
| * mkosi: add tmpfiles to create debian/ubuntu /etc/default/locale linkLuca Boccassi2023-04-241-0/+1
| |
| * mkosi: move debian/ubuntu ignore preset to config directoryLuca Boccassi2023-04-242-5/+1
| |
| * mkosi: move debian/ubuntu common conf under common directoryLuca Boccassi2023-04-241-0/+0
| |
| * mkosi: delete /etc/resolv.conf to let tmpfiles handle itLuca Boccassi2023-04-241-0/+3
| | | | | | | | In case the distribution creates or ships resolv.conf, delete it and let tmpfiles handle it
* | Merge pull request #27357 from bluca/example_logcontrolZbigniew Jędrzejewski-Szmek2023-04-243-7/+254
|\ \ | | | | | | man: add working example to LogControl1 manpage
| * | man: clarify sd_bus_defaultLuca Boccassi2023-04-221-7/+8
| | | | | | | | | | | | It picks the bus based on the cgroup slice.
| * | man: add working example to LogControl1 manpageLuca Boccassi2023-04-222-0/+246
| | | | | | | | | | | | Add fully working and documented example that can be copied and pasted
* | | stub: add comment on measurement of io.systemd.stub.kernel-cmdline-extraLuca Boccassi2023-04-241-0/+1
| |/ |/|
* | mkosi: Update to latestDaan De Meyer2023-04-247-343/+198
| | | | | | | | | | | | Let's use the new support for matching against any distribution in a list of distributions to start sharing most things between the ubuntu/debian configs and centos/fedora configs.
* | a colloquial abbreviation 'btw' in TEMPORARY_DIRECTORIES.md (#27365)074162023-04-231-1/+1
|/ | | * Update TEMPORARY_DIRECTORIES.md
* sulogin-shell: Start initrd.target on exit in the initrdDaan De Meyer2023-04-211-11/+13
| | | | | sulogin is documented to continue booting up on exit. To do that in the initrd, we need to start initrd.target and not default.target.
* Merge pull request #27352 from poettering/devnum-moreLennart Poettering2023-04-216-11/+15
|\ | | | | devnum-util: port more things over
| * tre-wide: use FORMAT_DEVNUM() a bit moreLennart Poettering2023-04-212-3/+5
| |
| * tree-wide: convert more cases do DEVNUM_FORMAT_STR()/DEVNUM_FORMAT_VAL()Lennart Poettering2023-04-214-8/+10
| | | | | | | | | | | | Let's use our nice macros a bit more. (Not comprehensive)
* | mkosi: Use authselect minimal if authselect is installedDaan De Meyer2023-04-211-0/+8
| | | | | | | | | | | | | | We dropped this logic from mkosi itself, so let's configure it in our postinst script instead. We also enable the with-homed feature if we can find it. It doesn't exist for the minimal profile yet, but might be added in the future.
* | mkosi: remove ?priority(required) from debian pkg listLuca Boccassi2023-04-211-1/+1
|/ | | | | | Requires apt 2.3.10 which is not available in stable, and also doesn't seem necessary, same packages are installed anyway Add tzdata manually, as that doesn't seem to be pulled in via the CI.
* Merge pull request #27349 from mrc0mmand/codespellLuca Boccassi2023-04-2019-26/+27
|\ | | | | tree-wide: code spelling fixes
| * README: add a Weblate badgeFrantisek Sumsal2023-04-201-0/+1
| |
| * tree-wide: code spelling fixesFrantisek Sumsal2023-04-2018-26/+26
| | | | | | | | As reported by Fossies.
* | detect-virt: add message at debug levelZbigniew Jędrzejewski-Szmek2023-04-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normal users do not have permissions to access /proc/1/root, so 'systemd-detect-virt -r' fails, but the output, even at debug level is cryptic: $ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r Failed to check for chroot() environment: Permission denied Let's make this a bit easier to figure out: $ SYSTEMD_LOG_LEVEL=debug build/systemd-detect-virt -r Cannot stat /proc/1/root: Permission denied Failed to check for chroot() environment: Permission denied I looked over other users of files_same(), and I think in general the message at debug level is OK for them too.
* | Apply known iocost solutions to block devicesGustavo Noronha Silva2023-04-207-0/+452
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Meta's resource control demo project[0] includes a benchmark tool that can be used to calculate the best iocost solutions for a given SSD. [0]: https://github.com/facebookexperimental/resctl-demo A project[1] has now been started to create a publicly available database of results that can be used to apply them automatically. [1]: https://github.com/iocost-benchmark/iocost-benchmarks This change adds a new tool that gets triggered by a udev rule for any block device and queries the hwdb for known solutions. The format for the hwdb file that is currently generated by the github action looks like this: # This file was auto-generated on Tue, 23 Aug 2022 13:03:57 +0000. # From the following commit: # https://github.com/iocost-benchmark/iocost-benchmarks/commit/ca82acfe93c40f21d3b513c055779f43f1126f88 # # Match key format: # block:<devpath>:name:<model name>: # 12 points, MOF=[1.346,1.346], aMOF=[1.249,1.249] block:*:name:HFS256GD9TNG-62A0A:fwver:*: IOCOST_SOLUTIONS=isolation isolated-bandwidth bandwidth naive IOCOST_MODEL_ISOLATION=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATION=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_ISOLATED_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_ISOLATED_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_BANDWIDTH=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_BANDWIDTH=rpct=0.00 rlat=8807 wpct=0.00 wlat=59023 min=100.00 max=100.00 IOCOST_MODEL_NAIVE=rbps=1091439492 rseqiops=52286 rrandiops=63784 wbps=192329466 wseqiops=12309 wrandiops=16119 IOCOST_QOS_NAIVE=rpct=99.00 rlat=8807 wpct=99.00 wlat=59023 min=75.00 max=100.00 The IOCOST_SOLUTIONS key lists the solutions available for that device in the preferred order for higher isolation, which is a reasonable default for most client systems. This can be overriden to choose better defaults for custom use cases, like the various data center workloads. The tool can also be used to query the known solutions for a specific device or to apply a non-default solution (say, isolation or bandwidth). Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>
* | Merge pull request #27327 from DaanDeMeyer/hotplugLennart Poettering2023-04-2010-33/+112
|\ \ | | | | | | kmod-setup: Add early loading for virtio_console
| * | kmod-setup: Add early loading for virtio_consoleDaan De Meyer2023-04-201-8/+33
| | | | | | | | | | | | | | | | | | | | | getty-generator enables serial-getty@.service for virtualizer consoles that it can find in /sys/class/tty. To make sure this works for virtio consoles, let's make sure we load the module is loaded early so that the /sys/class/tty/hvc0 exists before we run getty-generator.
| * | core: Parse logging environment earlierDaan De Meyer2023-04-201-4/+10
| | | | | | | | | | | | | | | | | | Let's make sure we parse the logging environment ASAP so that the options apply to more code. e.g. to allow debugging kmod-setup.c for example.
| * | kmod-setup: Introduce match_modalias_recurse_dir_cb()Daan De Meyer2023-04-201-4/+5
| | | | | | | | | | | | Let's make the logic around matching a modalias a bit more generic.
| * | string-util: Add startswith_strv()Daan De Meyer2023-04-203-12/+17
| | | | | | | | | | | | | | | | | | This is the function version of STARTSWITH_SET(). We also move STARTSWITH_SET() to string-util.h as it fits more there than in strv.h and reimplement it using startswith_strv().
| * | mkosi: Disable kmsg ratelimitingDaan De Meyer2023-04-201-0/+1
| | |
| * | log: Log when kmsg is being ratelimitedDaan De Meyer2023-04-201-2/+6
| | | | | | | | | | | | | | | | | | Let's avoid confusing developers and users when log messages suddenly stop getting logged to kmsg because of ratelimiting by logging an additional message if we start ratelimiting log messages to kmsg.
| * | log: Add knob to disable kmsg ratelimitingDaan De Meyer2023-04-204-4/+41
| | | | | | | | | | | | | | | This allows us to disable kmsg ratelimiting in the integration tests and mkosi for easier debugging.
* | | dissect: let's check for crypto_LUKS before fstype allowlist checkLennart Poettering2023-04-201-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to mount a partition that is encrypted without the encryption first having been set up we want to return a recognizable error (EUNATCH). This was broken by 80ce8580f5aa6b03fa13a0b3b30207bc9b5c5fe0 which added an allowlist check for permissible file systems first. Let's reverse the check order, so that we get EUNATCH again, as before. (And leave EIDRM as error for the failed allowlist check).
* | | ratelimit: handle counter overflows somewhat sanelyLennart Poettering2023-04-201-9/+11
| | | | | | | | | | | | | | | | | | | | | An overflow here (i.e. the counter reaching 2^32 within a ratelimit time window) is not so unlikely. Let's handle this somewhat sanely and simply stop counting, while remaining in the "limit is hit" state until the time window has passed.
* | | man: try to make clearer that /var/ is generally not available in ↵Lennart Poettering2023-04-201-32/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /usr/lib/systemd/system-shutdown/ callouts I made the mistake to look into what is installed into /usr/lib/systemd/system-shutdown/ on Fedora. fwdupd among other things assumes /var/ is available from these callouts, though it is not in the general case. Hence, let's emphasize this in the documentation a bit more.
* | | dissect-image: issue BLKFLSBUF before probing an fs at block device offset != 0Lennart Poettering2023-04-201-0/+15
| | | | | | | | | | | | | | | | | | | | | See added code comment for a longer explanation. TLDR: Linux maintains distinct block device caches for partition and "whole" block devices, and a simply BLKFLSBUF should make the worst confusions this causes go away.
* | | networkd: fallback to chaddr for static lease lookup when not foundRobert Meijers2023-04-201-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DHCP static leases are looked up by the client identifier as send by the client, while configured based on MAC. As RFC 2131 states the client identifier is an opaque key and must not be interpreted by the server this means that DHCP clients can (/will) also use a client identifier which is not a MAC address. One of these clients actually is systemd-networkd which uses an RFC 4361 by default to generate the client identifier. For these kind of DHCP clients static leases thus don't work because of this mismatch between configuring a MAC address but the server matching based on client identifier. This adds a fallback to try to look up a configured static lease based on the "chaddr" of the DHCP message as this will always contain the MAC address of the client. Fixes #21368
* | | core/device: rewrite how device unit is removed from Manager.devices_by_sysfsYu Watanabe2023-04-201-7/+14
| | | | | | | | | | | | | | | | | | | | | If the device unit is not the head of the list saved in Manager.devices_by_sysfs, then it is not necessary to replace the existing hashmap entry. This should not change any behavior, just refactoring.
* | | list: fix double evaluationYu Watanabe2023-04-201-3/+6
| | |
* | | Merge pull request #27299 from yuwata/chase-absoluteDaan De Meyer2023-04-2011-109/+194
|\ \ \ | | | | | | | | chase: return absolute path when dir_fd points to the root directory
| * | | test: add regression tests for find_esp() and friendYu Watanabe2023-04-191-0/+9
| | | |
| * | | chase: replace path_prefix_root_cwd() with chaseat_prefix_root()Yu Watanabe2023-04-198-72/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function path_prefix_root_cwd() was introduced for prefixing the result from chaseat() with root, but - it is named slightly generic, - the logic is different from what chase() does. This makes the name more explanative and specific for the result of the chaseat(), and make the logic consistent with chase(). Fixes https://github.com/systemd/systemd/pull/27199#issuecomment-1511387731. Follow-up for #27199.
| * | | fd-util: skip to check mount ID if kernel is too old and /proc is not mountedYu Watanabe2023-04-191-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, dir_fd_is_root() is heavily used in chaseat(), which is used at various places. If the kernel is too old and /proc is not mounted, then there is no way to get the mount ID of a directory. In that case, let's silently skip the mount ID check. Fixes https://github.com/systemd/systemd/pull/27299#issuecomment-1511403680.
| * | | mountpoint-util: check /proc is mounted on failureYu Watanabe2023-04-191-2/+4
| | | |
| * | | chase: prefix with the root directory only when it is not "/"Yu Watanabe2023-04-191-8/+16
| | | |
| * | | chase: drop repeated call of empty_to_root()Yu Watanabe2023-04-191-13/+12
| | | |
| * | | chase: update outdated comment about result pathYu Watanabe2023-04-191-6/+20
| | | |
| * | | chase: make the result absolute when a symlink is absoluteYu Watanabe2023-04-192-1/+15
| | | | | | | | | | | | | | | | As the path may be outside of the specified dir_fd.
| * | | chase: make chaseat() provides absolute path also when dir_fd points to the ↵Yu Watanabe2023-04-192-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | root directory Usually, we pass the file descriptor of the root directory to chaseat() when `--root=` is not specified. Previously, even in such case, the result was relative, and we need to prefix the path with "/" when we want to pass the path to other functions that do not support dir_fd, or log or show the path. That's inconvenient.
* | | | hwdb: disable entry for Logitech USB receiver used by G502 XYu Watanabe2023-04-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Fixes a bug introduced by dede07d3d04007c70c78653a73e2bcd8616564a5. Fixes #27118.