summaryrefslogtreecommitdiff
path: root/units
Commit message (Collapse)AuthorAgeFilesLines
* Revert "units: Add missing dependencies on initrd-switch-root.target"Daan De Meyer2023-05-158-16/+16
| | | | This reverts commit f0ad3e6b9652fe785245934ff8604cc897d3b8f4.
* units: Add missing dependencies on initrd-switch-root.targetDaan De Meyer2023-05-138-16/+16
| | | | | | | These are all services that valid to be run in the initrd, so let's make sure they have the appropriate dependencies on initrd-switch-root.target so that they are stopped when we're about to switch root.
* units: Add CAP_NET_ADMIN condition to systemd-networkd-wait-online@.service ↵Daan De Meyer2023-05-091-0/+1
| | | | | | | as well It was added to CAP_NET_ADMIN but we forgot to add it to the template service as well.
* units: add/fix Documentation= about bus interfaceYu Watanabe2023-05-094-1/+4
|
* core/systemctl: when switching root default to /sysroot/Lennart Poettering2023-04-281-1/+1
| | | | | | | | | We hardcode the path the initrd uses to prepare the final mount point at so many places, let's also imply it in "systemctl switch-root" if not specified. This adds the fallback both to systemctl and to PID 1 (this is because both to — different – checks on the path).
* nspawn: port over to /supervisor/ subcgroup being delegated to nspawnLennart Poettering2023-04-271-0/+1
| | | | | | Let's make use of the new DelegateSubgroup= feature and delegate the /supervisor/ subcgroup already to nspawn, so that moving the supervisor process there is unnecessary.
* udev: port to DelegateSubgroup=Lennart Poettering2023-04-271-0/+1
|
* units: make system service manager create init.scope subcgroup for user ↵Lennart Poettering2023-04-271-0/+1
| | | | | | | | service manager This one is basically for free, since the service manager is already prepared for being invoked in init.scope. Hence let's start it in the right cgroup right-away.
* units: restrict hugepages fs a bitLennart Poettering2023-04-271-0/+1
| | | | | | | | | | suid binaries and device nodes should not be placed there, hence forbid it. Of all the API VFS we mount from PID 1 or via a unit file this one is the only one where we didn't add MS_NODEV/MS_NOSUID. Let's address that, since there's really no reason why device nodes or suid binaries would be placed in hugetlbfs.
* Support /etc/system-update for OSTree systemsEric Curtin2023-04-251-1/+3
| | | | | | This is required when / is immutable and cannot be written at runtime. Co-authored-by: Richard Hughes <richard@hughsie.com>
* Merge pull request #25608 from poettering/dissect-moarLennart Poettering2023-04-121-0/+1
|\ | | | | dissect: add dissection policies
| * discover-image: automaticaly pick up sysext images from /.extra/sysextLennart Poettering2023-04-051-0/+1
| |
* | systemd-sysext/confext.service: Refresh on start/reloadKai Lueke2023-04-062-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding a sysext image to the system and manuall merging it, a later "systemctl (re)start systemd-sysext" won't work because "merge" refuses to work when something is merged already. Another problem with "merge" at start plus "unmerge" at stop is that a service restart can't make use of the new MOVE_MOUNT_BENEATH in the future even which would only be available in "refresh". It also prepares us for setting up the merged overlay for the sysroot from the initrd already, which also would lead to the mentioned start problem of the service (One optimization could be to skip the loading but only if we are sure that all images were loaded and weren't modified since - this assumption is hard because early services could want to inject a sysext, too). Use "refresh" on service start to fix the problem that the service can't start as soon as a manual merge was done. Also add a reload action that allows to issue "systemctl reload systemd-sysext" and it will make use of MOVE_MOUNT_BENEATH once we implement this in systemd-sysext refresh (and it's available from the kernel).
* | confext: add the systemd-confext.service filemaanyagoenka2023-04-052-0/+34
|/
* sysext: stop storing under /usr/lib[/local]/extensions/Luca Boccassi2023-03-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysexts are meant to extend /usr. All extension images and directories are opened and merged in a single, read-only overlayfs layer, mounted on /usr. So far, we had fallback storage directories in /usr/lib/extensions and /usr/local/lib/extensions. This is problematic for three reasons. Firstly, technically, for directory-based extensions the kernel will reject creating such an overlay, as there is a recursion problem. It actively validates that a lowerdir is not a child of another lowerdir, and fails with -ELOOP if it is. So having a sysext /usr/lib/extensions/myextdir/ would result in an overlayfs config lowerdir=/usr/lib/extensions/myextdir/usr/:/usr which is not allowed, as indicated by Christian the kernel performs this check: /* * Check if this layer root is a descendant of: * - another layer of this overlayfs instance * - upper/work dir of any overlayfs instance */ <...> /* Walk back ancestors to root (inclusive) looking for traps */ while (!err && parent != next) { if (is_lower && ovl_lookup_trap_inode(sb, parent)) { err = -ELOOP; pr_err("overlapping %s path\n", name); Secondly, there's a confusing aspect to this recursive storage. If you have /usr/lib/extensions/myext.raw which contains /usr/lib/extensions/mynested.raw 'systemd-sysext merge' will only pick up the first one, but both will appear in the merged root under /usr/lib/extensions/. So you have two extension images, both appear in your merged filesystem, but only one is actually in use. Finally, there's a conceptual aspect: the idea behind sysexts and hermetic /usr is that the /usr tree is not modified locally, but owned by the vendor. Dropping extensions in /usr thus goes contrary to this foundational concept.
* units: let's establish the coredump socket before writting core_pattern sysctlLennart Poettering2023-03-301-1/+1
| | | | | | | | | | | | | | | | It's a bit nicer if we only write the sysctl core_pattern once the coredump socket is established, since it's the backend for the handler. Given the systemd-coredump.socket basically has no dependencies that run before it this should not really make things slower or so, it just removes the tiny window where core pattern is in effect that wants to connect to the backend socket but cannot. The status quo isn't terrible, and not too different in effect: either way, until the socket unit is up we won't process coredumps. It's mostly what kind of behaviour you get then: an error due to /bin/false being invoked, or an error because systemd-coredump can't connect to its socket. After this patch we'll exclusively see the former.
* unit: sysext: update unit name for sd-tmpfiles-setupMike Yuan2023-03-191-1/+1
| | | | Fixes #26882
* units: Order user@.service after systemd-oomd.serviceDaan De Meyer2023-03-181-1/+1
| | | | | | | | | | | | The user manager connects to oomd over varlink. Currently, during shutdown, if oomd is stopped before any user manager, the user manager will try to reconnect to the socket, leading to a warning from pid 1 about a conflicting transaction. Let's fix this by ordering user@.service after systemd-oomd.service, so that user sessions are stopped before systemd-oomd is stopped, which makes sure that the user sessions won't try to start oomd via its socket after systemd-oomd is stopped.
* journald-console: Add colors when forwarding to consoleDaan De Meyer2023-03-161-0/+1
| | | | | | Let's color output when we're forwarding to the console. To make this work, we inherit TERM from pid 1 and use it to decide whether we should output colors or not.
* tree-wide: Drop gnu-efiJan Janssen2023-03-101-9/+9
| | | | | | | This drops all mentions of gnu-efi and its manual build machinery. A future commit will bring bootloader builds back. A new bootloader meson option is now used to control whether to build sd-boot and its userspace tooling.
* doc: correct wrong use "'s" contractionsJan Engelhardt2023-03-071-1/+1
|
* units: let systemd --user manage its own memory pressure handlingLennart Poettering2023-03-011-0/+1
| | | | | | | | | | | Let's make things systematic: the per-user and the per-system manager should manage their own memory pressure, as they are, well, managers of things. This is particularly relevant and the per-user service manager should watch its own "init.scope" subcgroup, instead of the main service unit cgroup, and hence $MEMORY_PRESSURE_WATCH as set by the per-system service manager would simply be wrong.
* units: change assert to condition to skip running in initrd/osLuca Boccassi2023-02-096-6/+6
| | | | | | | These units are also present in the initrd, so instead of an assert, just use a condition so they are skipped where they need to be skipped. Fixes https://github.com/systemd/systemd/issues/26358
* core: split system/user job timeouts and make them configurableZbigniew Jędrzejewski-Szmek2023-02-011-1/+1
| | | | | | | | | | | | | | | | Config options are -Ddefault-timeout-sec= and -Ddefault-user-timeout-sec=. Existing -Dupdate-helper-user-timeout= is renamed to -Dupdate-helper-user-timeout-sec= for consistency. All three options take an integer value in seconds. The renaming and type-change of the option is a small compat break, but it's just at compile time and result in a clear error message. I also doubt that anyone was actually using the option. This commit separates the user manager timeouts, but keeps them unchanged at 90 s. The timeout for the user manager is set to 4/3*user-timeout, which means that it is still 120 s. Fedora wants to experiment with lower timeouts, but doing this via a patch would be annoying and more work than necessary. Let's make this easy to configure.
* units: don't install pcrphase-related units without gnu-efiFrantisek Sumsal2023-01-171-2/+2
| | | | | | | | | | | | | | | since we don't have systemd-pcrphase built anyway, which breaks the tests: ... I: Attempting to install /usr/lib/systemd/systemd-networkd-wait-online (based on unit file reference) I: Attempting to install /usr/lib/systemd/systemd-network-generator (based on unit file reference) I: Attempting to install /usr/lib/systemd/systemd-oomd (based on unit file reference) I: Attempting to install /usr/lib/systemd/systemd-pcrphase (based on unit file reference) W: Failed to install '/usr/lib/systemd/systemd-pcrphase' make: *** [Makefile:4: setup] Error 1 make: Leaving directory '/root/systemd/test/TEST-01-BASIC' Follow-up to 04959faa632272a8fc9cdac3121b2e4af721c1b6.
* generators: optionally, measure file systems at bootLennart Poettering2023-01-173-0/+51
| | | | | | If we use gpt-auto-generator, automatically measure root fs and /var. Otherwise, add x-systemd.measure option to request this.
* units: rework growfs units to be just a regular unit that is instantiatedLennart Poettering2023-01-173-0/+47
| | | | | | | | | | | | | | | | The systemd-growfs@.service units are currently written in full for each file system to grow. Which is kinda pointless given that (besides an optional ordering dep) they contain always the same definition. Let's fix that and add a static template for this logic, that the generator simply instantiates (and adds an ordering dep for). This mimics how systemd-fsck@.service is handled. Similar to the wait that for root fs there's a special instance systemd-fsck-root.service we also add a special instance systemd-growfs-root.service for the root fs, since it has slightly different deps. Fixes: #20788 See: #10014
* units: measure /etc/machine-id into PCR 15 during early bootLennart Poettering2023-01-172-0/+25
| | | | | | | We want PCR 15 to be useful for binding per-system policy to. Let's measure the machine ID into it, to ensure that every OS we can distinguish will get a different PCR (even if the root disk encryption key is already measured into it).
* journal: give the ability to enable/disable systemd-journald-audit.socketFranck Bui2023-01-113-3/+9
| | | | | | | | | | Before this patch the only way to prevent journald from reading the audit messages was to mask systemd-journald-audit.socket. However this had main drawback that downstream couldn't ship the socket disabled by default (beside the fact that masking units is not supposed to be the usual way to disable them). Fixes #15777
* logind: implement Type=notify-reload protocol properlyLennart Poettering2023-01-101-0/+1
| | | | | | So close already. Let's add the two missing notifications too. Fixes: #18484
* udevd: implement the full Type=notify-reload protocolLennart Poettering2023-01-101-2/+1
| | | | | | We are basically already there, just need to add MONOTONIC_USEC= to the RELOADING=1 message, and make sure the message is generated in really all cases.
* networkd: implement Type=notify-reload protocolLennart Poettering2023-01-101-2/+1
|
* pid1: make sure we send our calling service manager RELOADING=1 when reloadingLennart Poettering2023-01-101-1/+1
| | | | | | | | And send READY=1 again when we are done with it. We do this not only for "daemon-reload" but also for "daemon-reexec" and "switch-root", since from the perspective of an encapsulating service manager these three operations are not that different.
* Merge pull request #25947 from poettering/resolved-dns-credsDaan De Meyer2023-01-061-1/+2
|\ | | | | resolved: add support for reading DNS config from kernel cmdline + service credentials
| * resolved: read DNS conf also from creds and kernel cmdlineLennart Poettering2023-01-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | Note that this drops ProtectProc=invisible from systemd-resolved.service. This is done because othewise access to the booted "kernel" command line is not necessarily available. That's because in containers we want to read /proc/1/cmdline for that. Fixes: #24103
* | units: condition systemd-networkd-wait-online.service like ↵Lennart Poettering2023-01-051-0/+1
|/ | | | | | | | | | systemd-networkd.service This adds the same condition that systemd-networkd.service already carries also to systemd-networkd-wait-online.service. Otherwise we'll potentially see some logs we'd rather not see about a service we BindTo= not running. Or in other words, if service X binds to Y then X should be at least as conditioned as Y.
* vconsole: permit configuration of vconsole settings via credentialsLennart Poettering2023-01-051-0/+5
|
* units: rename/rework systemd-boot-system-token.service → ↵Lennart Poettering2023-01-044-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | systemd-boot-random-seed.service This renames systemd-boot-system-token.service to systemd-boot-random-seed.service and conditions it less strictly. Previously, the job of the service was to write a "system token" EFI variable if it was missing. It called "bootctl --graceful random-seed" for that. With this change we condition it more liberally: instead of calling it only when the "system token" EFI variable isn't set, we call it whenever a boot loader interface compatible boot loader is used. This means, previously it was invoked on the first boot only: now it is invoked at every boot. This doesn#t change the command that is invoked. That's because previously already the "bootctl --graceful random-seed" did two things: set the system token if not set yet *and* refresh the random seed in the ESP. Previousy we put the focus on the former, now we shift the focus to the latter. With this simple change we can replace the logic f913c784ad4c93894fd6cb2590738113dff5a694 added, but from a service that can run much later and doesn't keep the ESP pinned.
* bootctl: downgrade graceful messages to LOG_NOTICELennart Poettering2023-01-041-0/+0
|
* units: pull in loop.ko and dm-mod.ko before repartLennart Poettering2022-12-231-1/+2
| | | | | | | | | | | | | | | 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
* units: change modprobe@dm-mod.service → modprobe@dm_mod.serviceLennart Poettering2022-12-231-1/+1
| | | | Follow-up for 8f1359bf854e9683e4e0b89fd3a537e0d82d4b95
* units: allow systemd-userdbd to change process nameMichal Sekletar2022-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rename_process() requires CAP_SYS_RESOURCE so let's make sure it is in our permitted set after execve() by adding in to the bounding set. Previously, systemd-userdbd.service - User Database Manager Loaded: loaded (/usr/lib/systemd/system/systemd-userdbd.service; indirect; preset: disabled) Active: active (running) since Mon 2022-12-19 17:07:21 CET; 17min ago TriggeredBy: ● systemd-userdbd.socket Docs: man:systemd-userdbd.service(8) Main PID: 1880 (systemd-userdbd) Status: "Processing requests..." Tasks: 4 (limit: 2272) Memory: 5.2M CPU: 244ms CGroup: /system.slice/systemd-userdbd.service ├─1880 /usr/lib/systemd/systemd-userdbd ├─2270 systemd-userwork ├─2271 systemd-userwork └─2272 systemd-userwork Now, Loaded: loaded (/usr/lib/systemd/system/systemd-userdbd.service; indirect; preset: disabled) Active: active (running) since Mon 2022-12-19 17:27:02 CET; 15s ago TriggeredBy: ● systemd-userdbd.socket Docs: man:systemd-userdbd.service(8) Main PID: 2404 (systemd-userdbd) Status: "Processing requests..." Tasks: 4 (limit: 2272) Memory: 5.5M CPU: 89ms CGroup: /system.slice/systemd-userdbd.service ├─2404 /usr/lib/systemd/systemd-userdbd ├─2407 "systemd-userwork: waiting..." ├─2408 "systemd-userwork: waiting..." └─2409 "systemd-userwork: waiting..."
* unit: use underbar for module nameYu Watanabe2022-12-191-1/+1
| | | | For consistency with src/core/unit.c.
* pcrphase: gracefully exit if TPM2 support is incompleteLennart Poettering2022-12-153-6/+6
| | | | | | | | If everything points to the fact that TPM2 should work, but then the driver fails to initialize we should handle this gracefully and not cause failing services all over the place. Fixes: #25700
* unit: check more specific path to be written by systemd-binfmtYu Watanabe2022-12-151-1/+1
| | | | | Follow-up for 41807efb1594ae8e71e0255e154ea7d17be2251a. Replaces #25690.
* units: change Requires=systemd-networkd.service → BindsTo= one more timeLennart Poettering2022-11-291-1/+1
| | | | | | Follow-up for da15f8406e9aeb7908e1d92c02d2ff5147c7788a which did the change for systemd-networkd-wait-online.service, let's also do this for systemd-networkd-wait-online@.service
* units: Use BindsTo=systemd-networkd in systemd-networkd-wait-online.serviceDaan De Meyer2022-11-261-1/+1
| | | | | | We don't want systemd-networkd-wait-online to start if systemd-networkd is skipped due to condition failures. This is only guaranteed by BindsTo= and not Requires=, so let's use BindsTo=
* units: fix typo in Condition in systemd-boot-system-tokenLuca Boccassi2022-11-241-2/+2
| | | | | | /lib/systemd/system/systemd-boot-system-token.service:20: Unknown key name 'ConditionPathExists|' in section 'Unit', ignoring Follow-up for 0a1d8ac77a21ae0741bdf4af08f3a71354805ff1
* stub: handle random seed like sd-boot doesJason A. Donenfeld2022-11-231-1/+2
| | | | | | | | | sd-stub has an opportunity to handle the seed the same way sd-boot does, which would have benefits for UKIs when sd-boot is not in use. This commit wires that up. It refactors the XBOOTLDR partition discovery to also find the ESP partition, so that it access the random seed there.
* bootctl: install system token on virtualized systemsJason A. Donenfeld2022-11-211-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Removing the virtualization check might not be the worst thing in the world, and would potentially get many, many more systems properly seeded rather than not seeded. There are a few reasons to consider this: - In most QEMU setups and most guides on how to setup QEMU, a separate pflash file is used for nvram variables, and this generally isn't copied around. - We're now hashing in a timestamp, which should provide some level of differentiation, given that EFI_TIME has a nanoseconds field. - The kernel itself will additionally hash in: a high resolution time stamp, a cycle counter, RDRAND output, the VMGENID uniquely identifying the virtual machine, any other seeds from the hypervisor (like from FDT or setup_data). - During early boot, the RNG is reseeded quite frequently to account for the importance of early differentiation. So maybe the mitigating factors make the actual feared problem significantly less likely and therefore the pros of having file-based seeding might outweigh the cons of weird misconfigured setups having a hypothetical problem on first boot.