summaryrefslogtreecommitdiff
path: root/units
Commit message (Collapse)AuthorAgeFilesLines
* scripts: use 4 space indentationZbigniew Jędrzejewski-Szmek2019-04-121-12/+12
| | | | | | | | | | | | | | | | | | We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed. 4 sp was the most common, in particular the majority of scripts under test/ used that. Let's standarize on 4 sp, because many commandlines are long and there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp also seems to be the default indentation, so this will make it less likely that people will mess up if they don't load the editor config. (I think people often use vi, and vi has no support to load project-wide configuration automatically. We distribute a .vimrc file, but it is not loaded by default, and even the instructions in it seem to discourage its use for security reasons.) Also remove the few vim config lines that were left. We should either have them on all files, or none. Also remove some strange stuff like '#!/bin/env bash', yikes.
* man: add a page for systemd-udev-settle.serviceZbigniew Jędrzejewski-Szmek2019-04-101-1/+1
|
* units: add time-set.targetPeter A. Bigot2019-04-085-3/+19
| | | | | | | | | | | | | time-sync.target is supposed to indicate system clock is synchronized with a remote clock, but as used through 241 it only provided a system clock that was updated based on a locally-maintained timestamp. Systems that are powered off for extended periods would not come up with accurate time. Retain the existing behavior using a new time-set.target leaving time-sync.target for cases where accuracy is required. Closes #8861
* core: imply NNP and SUID/SGID restriction for DynamicUser=yes serviceLennart Poettering2019-04-022-2/+0
| | | | | | | | | Let's be safe, rather than sorry. This way DynamicUser=yes services can neither take benefit of, nor create SUID/SGID binaries. Given that DynamicUser= is a recent addition only we should be able to get away with turning this on, even though this is strictly speaking a binary compatibility breakage.
* units: turn on RestrictSUIDSGID= in most of our long-running daemonsLennart Poettering2019-04-0211-1/+12
|
* meson: stop creating enablement symlinks in /etc during installationZbigniew Jędrzejewski-Szmek2019-04-011-20/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch was initially prompted by a report on a Fedora update [1], that the upgrade causes systemd-resolved.service and systemd-networkd.service to be re-enabled. We generally want to preserve the enablement of all services during upgrades, so a reset like this is not expected. Both services declare two symlinks in their [Install] sections, for their dbus names and for multi-user.target.wants/. It turns out that both services were only partially enabled, because their dbus unit symlinks /etc/systemd/system/dbus-org.freedesktop.{resolve1,network1}.service were created, by the symlinks in /etc/systemd/system/multi-user.target.wants/ were not. This means that the units could be activated by dbus, but not in usual fashion using systemctl start. Our tools make it rather hard to figure out when something like this happens, and it is definitely an area for improvement on its own. The symlink in .wants/ was filtered out by during packaging, but the dbus symlink was left in (I assume by mistake). Let's simplify things by not creating the symlinks statically during 'ninja install'. This means that the units shipped by systemd have to be enabled in the usual fashion, which in turns means that [Install] section and presets become the "single source of truth" and we don't have two sets of conflicting configuration. Let's consider a few cases: - developer: a developer installs systemd from git on a running system, and they don't want the installation to reset enablement of anything. So this change is either positive for them, or has no effect (if they have everything at defaults). - package creation: we want to create symlinks using 'preset-all' and 'preset' on upgraded packages, we don't want to have any static symlinks. This change will remove the need to filter out symlinks in packaging and of course fix the original report. - installation of systemd from scratch: this change means that without 'preset-all' the system will not be functional. This case could be affected negatively by this change, but I think it's enough of a corner case to accept this. In practice I expect people to build a package, not installl directly into the file system, so this might not even matter in practice. Creating those symlinks was probably the right thing in the beginning, but nowadays the preset system is very well established and people expect it to be honoured. Ignoring the presets and doing static configuration is not welcome anymore. Note: during package installation, either 'preset-all' or 'preset getty@.service machines.target remote-cryptsetup.target remote-fs.target systemd-networkd.service systemd-resolved.service systemd-networkd-wait-online.service systemd-timesyncd.service' should be called. [1] https://bodhi.fedoraproject.org/updates/FEDORA-2019-616045ca76
* meson: indentationZbigniew Jędrzejewski-Szmek2019-04-011-1/+1
|
* units: set nodev,nosuid,noexec flags for various secondary API VFSLennart Poettering2019-03-255-0/+5
| | | | | | | A couple of API VFS we mount via .mount units. Let's set the three flags for those too, just in case. This is just paranoia, nothing else, but shouldn't hurt.
* Revert "Revert "units: lock down logind with fs namespacing options""Zbigniew Jędrzejewski-Szmek2019-03-191-1/+9
| | | | | | | This reverts commit 28f38a76345b7548700d2337dd8b9a8c3f5b0643. The revert was done because Ubuntu CI was completely broken with it. Let's see if it fares better now.
* units: turn off keyring handling for user@.serviceLennart Poettering2019-03-191-0/+1
| | | | | | | | | This service uses PAM anyway, hence let pam_keyring set things up for us. Moreover, this way we ensure that the invocation ID is not set for this service as key, and thus can't confuse the user service's invocation ID. Fixes: #11649
* man,units: document what user "default.target" is a bitZbigniew Jędrzejewski-Szmek2019-03-151-1/+1
|
* units: update catalog after systemd-tmpfiles runsJonathan Lebon2019-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | `systemd-journal-catalog-update.service` writes to `/var`. However, it's not explicitly ordered wrt `systemd-tmpfiles-setup.service`, which means that it may run before or after. This is an issue for Fedora CoreOS, which uses Ignition. We want to be able to prepare `/var` on first boot from the initrd, where the SELinux policy is not loaded yet. This means that the hierarchy under `/var` is not correctly labeled. We add a `Z /var - - -` tmpfiles entry so that it gets relabeled once `/var` gets mounted post-switchroot. So any service that tries to access `/var` before `systemd-tmpfiles` relabels it is likely to hit `EACCES`. Fix this by simply ordering `systemd-journal-catalog-update.service` after `systemd-tmpfiles-setup.service`. This is also clearer since the tmpfiles entries are the canonical source of how `/var` should be populated. For more context on this, see: https://github.com/coreos/ignition/issues/635#issuecomment-446620297
* units: turn of ProtectHostname= again for services hat need to know about ↵Lennart Poettering2019-03-083-3/+0
| | | | | | | | | | | | | | system hostname changes ProtectHostname= turns off hostname change propagation from host to service. This means for services that care about the hostname and need to be able to notice changes to it it's not suitable (though it is useful for most other cases still). Let's turn it off hence for journald (which logs the current hostname) for networkd (which optionally sends the current hostname to dhcp servers) and resolved (which announces the current hostname via llmnr/mdns).
* units: fix systemd.special man page reference in system-update-cleanup.serviceMichael Biebl2019-03-071-1/+1
|
* logind: add support for booting into the boot menu or a specific boot menu entryLennart Poettering2019-03-051-1/+1
| | | | | | This behaves similar to the "boot into firmware" logic, and also allows either direct EFI operation (which sd-boot supports and others might support eventually too) or override through env var.
* units: re-drop ProtectHostname from systemd-hostnamed.service (#11792)Martin Pitt2019-02-221-1/+0
| | | | | | | | This was an overzealous setting from commit 99894b867f. Without this, `hostnamectl set-hostname` fails with Could not set property: Access denied as `sethostname()` fails with `EPERM`.
* man,units: link up new documentation about temporary directoriesLennart Poettering2019-02-201-1/+2
|
* Merge pull request #11682 from topimiettinen/private-utsnameLennart Poettering2019-02-2016-0/+16
|\ | | | | core: ProtectHostname feature
| * units: enable ProtectHostname=yesTopi Miettinen2019-02-2016-0/+16
| |
* | Merge pull request #11226 from keszybz/enable-remount-fs-dynamicallyLennart Poettering2019-02-182-3/+1
|\ \ | | | | | | Enable systemd-remount-fs.service dynamically
| * | Pull in systemd-remount-fs.service only when requiredZbigniew Jędrzejewski-Szmek2019-01-032-3/+1
| | | | | | | | | | | | | | | | | | Instead of enabling it unconditionally and then using ConditionPathExists=/etc/fstab, and possibly masking this condition if it should be enabled for auto gpt stuff, just pull it in explicitly when required.
* | | units: add usb-gadget targetAndrzej Pietrasiewicz2019-02-151-0/+12
| |/ |/| | | | | | | | | | | | | | | | | Linux can be run on a device meant to act as a USB peripheral. In order for a machine to act as such a USB device it has to be equipped with a UDC - USB Device Controller. This patch adds a target reached when UDC becomes available. It can be used for activating e.g. a service unit which composes a USB gadget with configfs and activates it.
* | units: make sure initrd-cleanup.service terminates before switching to rootfsFranck Bui2019-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A follow-up for commit a8cb1dc3e0fa81aff. Commit a8cb1dc3e0fa81aff made sure that initrd-cleanup.service won't be stopped when initrd-switch-root.target is isolated. However even with this change, it might happen that initrd-cleanup.service survives the switch to rootfs (since it has no ordering constraints against initrd-switch-root.target) and is stopped right after when default.target is isolated. This led to initrd-cleanup.service entering in failed state as it happens when oneshot services are stopped. This patch along with a8cb1dc3e0fa81aff should fix issue #4343. Fixes: #4343
* | units: drop conditionalization of systemd-tmpfiles-setup-dev.serviceLennart Poettering2019-01-261-1/+0
|/ | | | | | | | | | | | | | | | Currently, tmpfiles runs in two separate services at boot. /dev is populated by systemd-tmpfiles-setup-dev.service and everything else by systemd-tmpfiles-setup.service. The former was so far conditionalized by CAP_SYS_MODULES. The reasoning was that the primary purpose of populating /dev was to create device nodes based on the static device node info exported in kernel modules through MODALIAS. And without the privs to load kernel modules doing so is unnecessary. That thinking is incomplete however, as there might be reason to create stuff in /dev outside of the static modalias usecase. Thus, let's drop the conditionalization to ensure that tmpfiles.d rules are always executed at least once under all conditions. Fixes: #11544
* units: replace symlinks in units/user/ by real filesZbigniew Jędrzejewski-Szmek2018-12-138-8/+105
| | | | | | | | | | | | | | We already *install* those as real files since de78fa9ba0be55b01066ca5a716c6673d76b817b. Meson will start to copy symlinks as-is, so we would get dangling symlinks in /usr/lib/systemd/user/. I considered the layout in our sources to match the layout in the installation filesystem (i.e. creating units/system/ and moving all files from units/ to units/system/), but that seems overkill. By using normal files for both we get some duplication, but those files change rarely, so it's not a big downside in practice. Fixes #9906.
* units: drop units/user/busnames.targetZbigniew Jędrzejewski-Szmek2018-12-131-1/+0
| | | | It seems this was missed in 0ba89873372c3ab508852b4e0071da0719bcea0a.
* Merge pull request #10357 from poettering/import-fsZbigniew Jędrzejewski-Szmek2018-11-291-1/+6
|\ | | | | machinectl import-fs command and other fixes
| * import: drop logic of setting up /var/lib/machines as btrfs loopback mountLennart Poettering2018-11-261-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's simplify things and drop the logic that /var/lib/machines is setup as auto-growing btrfs loopback file /var/lib/machines.raw. THis was done in order to make quota available for machine management, but quite frankly never really worked properly, as we couldn't grow the file system in sync with its use properly. Moreover philosophically it's problematic overriding the admin's choice of file system like this. Let's hence drop this, and simplify things. Deleting code is a good feeling. Now that regular file systems provide project quota we could probably add per-machine quota support based on that, hence the btrfs quota argument is not that interesting anymore (though btrfs quota is a bit more powerful as it allows recursive quota, i.e. that the machine pool gets an overall quota in addition to per-machine quota).
* | units: make fsck/grows/makefs/makeswap units conflict against shutdown.targetLennart Poettering2018-11-262-0/+2
|/ | | | | | They are the only units we shipped/generated where this was missing really. Let's fix these. Follow-up for: #10933
* units: order systemd-rfkill.socket after /var/lib/systemd/rfkill (#10904)Lennart Poettering2018-11-241-1/+2
| | | | | | | | Otherwise we might install the socket unit early, but the service backing it late, and then end up in strange loops when we enter rescue mode, because we saw an event on /dev/rfkill but really can't dispatch it nor flush it. Fixes: #9171
* units: fix Description= of systemd-exit.serviceLennart Poettering2018-11-161-1/+1
| | | | | This file was probably copied from the --user version, let's use some more appropriate wording for the --system version.
* units: use correct command to exitLennart Poettering2018-11-161-1/+1
| | | | Otherwise we'll end a cyclic loop.
* units: add the same ordering deps for systemd-exit.service as for ↵Lennart Poettering2018-11-161-2/+2
| | | | | | | systemd-poweroff.service and friends This stuff runs in containers, and should really behave the same everywhere.
* Revert "units: lock down logind with fs namespacing options"Zbigniew Jędrzejewski-Szmek2018-11-151-9/+1
|
* Merge pull request #10744 from poettering/logind-lock-downLennart Poettering2018-11-131-1/+9
|\ | | | | units: lock down logind with fs namespacing options
| * units: lock down systemd-logind.service with various fs namespacing optionsLennart Poettering2018-11-121-0/+8
| | | | | | | | | | | | now that logind doesn't mount $XDG_RUNTIME_DIR anymore we can lock down the service using fs namespacing (as we don't need the mount to propagate to the host namespace anymore).
| * logind: drop CAP_KILL from caps bounding setLennart Poettering2018-11-121-1/+1
| | | | | | | | | | logind doesn't kill any processes anymore, hence let's drop the capability.
* | units: also change portabled's syscall filter to a whitelistLennart Poettering2018-11-131-1/+1
|/
* units: set NoNewPrivileges= for all long-running servicesLennart Poettering2018-11-1215-171/+186
| | | | | | | | | | | | | | | | | Previously, setting this option by default was problematic due to SELinux (as this would also prohibit the transition from PID1's label to the service's label). However, this restriction has since been lifted, hence let's start making use of this universally in our services. On SELinux system this change should be synchronized with a policy update that ensures that NNP-ful transitions from init_t to service labels is permitted. An while we are at it: sort the settings in the unit files this touches. This might increase the size of the change in this case, but hopefully should result in stabler patches later on. Fixes: #1219
* units: remove unused busnames.targetAlan Jenkins2018-10-311-12/+0
| | | | | | I found zero references to busnames.target, using git grep "busnames". (And we do not install using a wildcard units/*.*. There is no busnames.target installed on my Fedora 28 system).
* units: drop systemd-user-sessions.service ordering dep on ↵Lennart Poettering2018-10-251-3/+2
| | | | | | | | | systemd-journal-flush.service (#10502) THis dep existed since the unit was introduced, but I cannot see what good it would do. Hence in the interest of simplifying things, let's drop it. If breakages appear later we can certainly revert this again. Fixes: #10469
* units: add simple boot check unitLennart Poettering2018-10-192-0/+25
| | | | | | | | | This is might be useful in some cases, but it's primarily an example for a boot check service that can be plugged before boot-complete.target. It's disabled by default. All it does is check whether the failed unit count is zero
* add new systemd-bless-boot.service that marks boots as successfulLennart Poettering2018-10-192-0/+23
| | | | | | This is the counterpiece to the boot counting implemented in systemd-boot: if a boot is detected as successful we mark drop the counter again from the booted snippet or kernel image.
* units: add generic boot-complete.targetLennart Poettering2018-10-192-0/+15
|
* Merge pull request #10428 from keszybz/failure-actionsLennart Poettering2018-10-176-20/+8
|\ | | | | Implement manager status changes using SuccessAction=
| * units: allow and use SuccessAction=exit-force in system systemd-exit.serviceZbigniew Jędrzejewski-Szmek2018-10-172-5/+2
| | | | | | | | | | | | | | | | | | C.f. 287419c119ef961db487a281162ab037eba70c61: 'systemctl exit 42' can be used to set an exit value and pulls in exit.target, which pulls in systemd-exit.service, which calls org.fdo.Manager.Exit, which calls method_exit(), which sets the objective to MANAGER_EXIT. Allow the same to happen through SuccessAction=exit. v2: update for 'exit' and 'exit-force'
| * units: use SuccessAction=poweroff-force in systemd-poweroff.serviceZbigniew Jędrzejewski-Szmek2018-10-172-5/+2
| | | | | | | | | | | | | | Explicit systemctl calls remain in systemd-halt.service and the system systemd-exit.service. To convert systemd-halt, we'd need to add SuccessAction=halt-force. Halting doesn't make much sense, so let's just leave that is. systemd-exit.service will be converted in the next commit.
| * units: use SuccessAction=reboot-force in systemd-reboot.serviceZbigniew Jędrzejewski-Szmek2018-10-172-5/+2
| |
| * units: use SuccessAction=exit-force in systemd-exit.serviceZbigniew Jędrzejewski-Szmek2018-10-172-5/+2
| | | | | | | | | | | | | | | | Fixes #10414. v2: - rename .service.in to .service - rename 'exit' to 'exit-force'
* | meson: define @HIGH_RLIMIT_NOFILE@ and use it everywhereZbigniew Jędrzejewski-Szmek2018-10-175-5/+5
| |