Commit Graph

28906 Commits

Author SHA1 Message Date
Lennart Poettering bd685faa1a login: include pam_systemd_home.so in the default PAM snippet we ship for user@.service
Let's make sure systemd-homed works out-of-the box as well as possible.
2020-05-06 22:30:07 +02:00
Balint Reczey e48471b948 test: Skip test-boot-timestamps on permission denied
In containers even root can be denied to access the needed files.
2020-05-06 22:01:50 +02:00
Zbigniew Jędrzejewski-Szmek e57ac1b017 tree-wide: use _cleanup_set_free_ where appropriate
If we already have the helper defined, let's use it instead of open-coding.
2020-05-06 17:08:17 +02:00
Zbigniew Jędrzejewski-Szmek 2f063186d5 shared/logs-show: constify Set *fields 2020-05-06 17:03:00 +02:00
Zbigniew Jędrzejewski-Szmek 476a63e9c0 sd-device: get rid of device_enumerator_clear_match_parent
This helper wasn't helping all that much. It seems better to verify args
first, and only then start modifying the state.
2020-05-06 17:02:10 +02:00
Zbigniew Jędrzejewski-Szmek 2204f018cd sd-device: optimize addition of already present matches
Our hashmap and set helpers return a different code whenever an entry
already exists, so let's use this to avoid unsetting scan_uptodate when
not necessary.

Thus, the return convention for
sd_device_enumerator_add_match_subsystem,
sd_device_enumerator_add_match_sysattr,
sd_device_enumerator_add_match_property,
sd_device_enumerator_add_match_sysname,
sd_device_enumerator_add_match_tag,
device_enumerator_add_match_parent_incremental,
sd_device_enumerator_add_match_parent,
sd_device_enumerator_allow_uninitialized,
device_enumerator_add_match_is_initialized
is that "1" is returned if action was taken, and "0" on noop.
2020-05-06 17:01:33 +02:00
Zbigniew Jędrzejewski-Szmek eb1c1dc029 sd-device: use hashmap_put_strdup() 2020-05-06 17:00:45 +02:00
Zbigniew Jędrzejewski-Szmek 25b3e2a835 basic/hashmap: allow NULL values in strdup hashmaps and add test 2020-05-06 16:56:42 +02:00
Zbigniew Jędrzejewski-Szmek c73bb51364 sd-device: use string hash ops in device enumerator
There should be no functional change, except that when the same string is
added more than once, we skip the duplicate entries.
2020-05-06 16:55:50 +02:00
Zbigniew Jędrzejewski-Szmek de747a0008 test-set: make test-set not link to libshared and test test_set_put_strdup*()
The sets are such basic functionality that it is convenient to be able to
build test-set without all the machinery in shared, and to test it without
the mempool to validate memory accesses easier.
2020-05-06 16:55:07 +02:00
Zbigniew Jędrzejewski-Szmek be32732168 basic/set: let set_put_strdup() create the set with string hash ops
If we're using a set with _put_strdup(), most of the time we want to use
string hash ops on the set, and free the strings when done. This defines
the appropriate a new string_hash_ops_free structure to automatically free
the keys when removing the set, and makes set_put_strdup() and set_put_strdupv()
instantiate the set with those hash ops.

hashmap_put_strdup() was already doing something similar.

(It is OK to instantiate the set earlier, possibly with a different hash ops
structure. set_put_strdup() will then use the existing set. It is also OK
to call set_free_free() instead of set_free() on a set with
string_hash_ops_free, the effect is the same, we're just overriding the
override of the cleanup function.)

No functional change intended.
2020-05-06 16:54:06 +02:00
Lennart Poettering 1fab579743 systemctl: underline whole rows, gapless
Just some tweaking of the output.
2020-05-06 15:40:15 +02:00
Lennart Poettering b0395c1176 format-table: support coloring the gap right of each cell individually
This is useful for underlining a whole row of cells: previously we
couldn't underline the gap. Now we can.
2020-05-06 15:40:15 +02:00
Lennart Poettering 45d82c3f1c systemctl: ensure underline for "list-unit-files" empty cells 2020-05-06 15:40:15 +02:00
Lennart Poettering 50098d87fb systemctl: let's tweak how we synthesize a cell for activating unit
Let's create a string cell for the unit if possible (since there can
only be one unit right now, and the JSON alternative output then
generates a string instead of an array for us), an empty cell if empty.
2020-05-06 15:40:15 +02:00
Lennart Poettering bc04bb0d29 systemctl: change column name in "list-sockets" out from "units" to "unit"
All our other tables call the field in singular, hence let's do so here,
too.
2020-05-06 15:40:15 +02:00
Lennart Poettering 0773357ad1 systemctl: show empty cells as '-'
This is mostly relevant for "systemct list-sockets" which can have empty
cells for the activating unit.
2020-05-06 15:40:15 +02:00
Lennart Poettering 557b0841b7 format-table: display an empty strv cell the same way as an empty cell
An empty list conceptually is very close to null, hence let's show it
the same way, i.e. using the defined "empty" string, and greyed out.
2020-05-06 15:40:15 +02:00
Zbigniew Jędrzejewski-Szmek 0894f08bf1 resolve: fix type of parameter and update man page
The "a" got dropped in eff7c2d3c9.
2020-05-06 15:02:38 +02:00
Zbigniew Jędrzejewski-Szmek ba5a389d24 Merge pull request #15473 from keszybz/bus-introspection 2020-05-06 15:00:07 +02:00
Eric Anderson 9e12d5bf63 socket-proxy: Support exit-on-idle
This adds the --exit-idle-time argument that causes
systemd-socket-proxyd to exit when there has been an idle period. An
open connection prevents the idle period from starting, even if there is
no activity on that connection.

When combined with another service that uses StopWhenUnneeded=, the
proxy exiting can trigger a resource-intensive process to exit. So
although the proxy may consume minimal resources, significant resources
can be saved indirectly.

Fixes #2106
2020-05-06 13:58:57 +02:00
Daan De Meyer eff7c2d3c9 sd-bus: Add a nicer way of specifying sd-bus vtable method arguments
SD_BUS_NAMES_WITH_ARGS is a less error-prone way of specifying D-Bus
method arguments.
2020-05-06 10:22:54 +02:00
Lennart Poettering fc58c0c7bf sysusers: be extra careful when locking accounts
Let's use "!*" instead of "!!" as invalid password string.

Generally, any invalid password string can be used to for locking an
account, according to shadow(5). To temporarily lock a password of an
account it is commonly implemented to prefix the original password with
a single "!", so that it can later on be unlocked again by removing the
"!", restoring the original password. Thus, the "!" marker is an
indicator for a locked password; the act of prefixing "!" to a
password string is the locking operation; and the removal of a "!"
prefix is the unlock operation. (This is also suggested in shadow(5)).

If we want to entirely lock an account we previously used "!!" as
password string. This is nice since it indicates the password is locked.
However, it is less than ideal, since applying the password unlock
operation once will change the string to "!", which is still a locked
password. Unlocking the password a second time will result in "", i.e.
the empty password, which will in many cases allow logging in without
password. And that's a problem. Hopefully, tools do not allow such
duplicate unlocking, but it's still not a nice property.

By changing our password string to "!*" we get different behaviour: the
password will appear locked. When it is unlocked the password is "*"
which is an invalid password. In that case the password is hence
unlocked but invalid, which is a much better state to be in than the
above.

This is paranoia hardening. Not more. There's no report that anyone
every unlocked an account twice and people could log in.
2020-05-06 09:44:35 +02:00
Zbigniew Jędrzejewski-Szmek cfd508a9d6 homed: convert to the new scheme and add --bus-introspect 2020-05-06 09:13:42 +02:00
Lennart Poettering c92391f52f
Merge pull request #15692 from keszybz/preset-cleanup
Make systemctl list-unit-files output more useful
2020-05-06 08:19:37 +02:00
Zbigniew Jędrzejewski-Szmek 5c08257b70 pid1: add --bus-introspect 2020-05-05 22:40:44 +02:00
Zbigniew Jędrzejewski-Szmek f6e9aa9e45 pid1: convert to the new scheme
In all the other cases, I think the code was clearer with the static table.
Here, not so much. And because of the existing dump code, the vtables cannot
be made static and need to remain exported. I still think it's worth to do the
change to have the cmdline introspection, but I'm disappointed with how this
came out.
2020-05-05 22:40:37 +02:00
Zbigniew Jędrzejewski-Szmek 4faa530cf6 machined: convert to the new scheme and add --bus-introspect 2020-05-05 22:38:31 +02:00
Zbigniew Jędrzejewski-Szmek 5ceceff170 localed: convert to the new scheme and add --bus-introspect 2020-05-05 22:37:08 +02:00
Zbigniew Jędrzejewski-Szmek 670139db40 hostnamed: convert to the new scheme and add --bus-introspect 2020-05-05 22:36:54 +02:00
Zbigniew Jędrzejewski-Szmek 8b4933973e bus-introspect: list the interfaces with "list"
The output is not very well formatted, but it is still useful when
testing this.
2020-05-05 22:36:38 +02:00
Zbigniew Jędrzejewski-Szmek 8d1280897b resolved: convert to the new scheme 2020-05-05 22:36:37 +02:00
Zbigniew Jędrzejewski-Szmek c4b7d95c46 timedated: convert to the new scheme and add --bus-introspect 2020-05-05 22:34:37 +02:00
Zbigniew Jędrzejewski-Szmek d4cc0edfce importd,logind: add --bus-introspect= option 2020-05-05 22:34:17 +02:00
Zbigniew Jędrzejewski-Szmek 1e9bc92dba bus-util: add wrapper for interface introspection 2020-05-05 22:33:53 +02:00
Zbigniew Jędrzejewski-Szmek c2b178d3ca logind: convert to the new scheme 2020-05-05 22:33:52 +02:00
Zbigniew Jędrzejewski-Szmek a3b7cf5013 importd: convert to the new scheme 2020-05-05 22:31:50 +02:00
Zbigniew Jędrzejewski-Szmek 6a7e98aaca sd-bus: add helper struct for interface definitions
The idea is to have a static table that defines the dbus API. The vtable is
defined right next to the interface name and path because they are logically
connected.
2020-05-05 22:27:03 +02:00
Zbigniew Jędrzejewski-Szmek 31b8895af7 systemctl: do not show preset state for "static"/"alias"/"generated"/"transient" units
This modifies list-unit-files and status.

The output of list-unit-files would contain various lines with "static
disabled", which is just misleading, because systemctl preset will not touch
those files, so the preset configuration is not relevant. Similarly, for
"generated" and "transient" units, preset state is irrelevant. For "alias"
lines, the preset for the alias target would be used. In all cases let's just
skip preset status in those cases.

Diff for a a Fedora rawhide container:

--- $ systemctl --root=/tmp/root2 list-unit-files
+++ $ build/systemctl --root=/tmp/root2 list-unit-files
@@ -1,125 +1,125 @@
 UNIT FILE                                  STATE    VENDOR PRESET
-proc-sys-fs-binfmt_misc.automount          static   disabled
-dev-hugepages.mount                        static   disabled
-dev-mqueue.mount                           static   disabled
-proc-fs-nfsd.mount                         static   disabled
+proc-sys-fs-binfmt_misc.automount          static
+dev-hugepages.mount                        static
+dev-mqueue.mount                           static
+proc-fs-nfsd.mount                         static
 proc-sys-fs-binfmt_misc.mount              disabled disabled
-sys-fs-fuse-connections.mount              static   disabled
-sys-kernel-config.mount                    static   disabled
-sys-kernel-debug.mount                     static   disabled
-sys-kernel-tracing.mount                   static   disabled
-tmp.mount                                  static   disabled
-var-lib-nfs-rpc_pipefs.mount               static   disabled
+sys-fs-fuse-connections.mount              static
+sys-kernel-config.mount                    static
+sys-kernel-debug.mount                     static
+sys-kernel-tracing.mount                   static
+tmp.mount                                  static
+var-lib-nfs-rpc_pipefs.mount               static
 ostree-finalize-staged.path                disabled enabled
-systemd-ask-password-console.path          static   disabled
-systemd-ask-password-plymouth.path         static   disabled
-systemd-ask-password-wall.path             static   disabled
+systemd-ask-password-console.path          static
+systemd-ask-password-plymouth.path         static
+systemd-ask-password-wall.path             static
 abrt-journal-core.service                  enabled  enabled
 abrt-oops.service                          enabled  enabled
 abrt-pstoreoops.service                    disabled disabled
 abrt-vmcore.service                        enabled  enabled
 abrt-xorg.service                          enabled  enabled
 abrtd.service                              enabled  enabled
-anaconda-direct.service                    static   disabled
-anaconda-nm-config.service                 static   disabled
-anaconda-noshell.service                   static   disabled
-anaconda-pre.service                       static   disabled
-anaconda-shell@.service                    static   disabled
-anaconda-sshd.service                      static   disabled
-anaconda-tmux@.service                     static   disabled
-anaconda.service                           static   disabled
+anaconda-direct.service                    static
+anaconda-nm-config.service                 static
+anaconda-noshell.service                   static
+anaconda-pre.service                       static
+anaconda-shell@.service                    static
+anaconda-sshd.service                      static
+anaconda-tmux@.service                     static
+anaconda.service                           static
 arp-ethers.service                         disabled disabled
 atd.service                                enabled  enabled
 auditd.service                             enabled  enabled
-auth-rpcgss-module.service                 static   disabled
+auth-rpcgss-module.service                 static
 autofs.service                             disabled disabled
-autovt@.service                            enabled  disabled
-blivet.service                             static   disabled
+autovt@.service                            alias
+blivet.service                             static
 blk-availability.service                   disabled disabled
 bluetooth.service                          enabled  enabled
-btattach-bcm@.service                      static   disabled
+btattach-bcm@.service                      static
 certmonger.service                         disabled disabled
-chrony-dnssrv@.service                     static   disabled
+chrony-dnssrv@.service                     static
 chrony-wait.service                        disabled disabled
 chronyd.service                            enabled  enabled
-clean-mount-point@.service                 static   disabled
-cockpit-motd.service                       static   disabled
-cockpit-wsinstance-http-redirect.service   static   disabled
-cockpit-wsinstance-http.service            static   disabled
-cockpit-wsinstance-https-factory@.service  static   disabled
-cockpit-wsinstance-https@.service          static   disabled
-cockpit.service                            static   disabled
+clean-mount-point@.service                 static
+cockpit-motd.service                       static
+cockpit-wsinstance-http-redirect.service   static
+cockpit-wsinstance-http.service            static
+cockpit-wsinstance-https-factory@.service  static
+cockpit-wsinstance-https@.service          static
+cockpit.service                            static
 console-getty.service                      disabled disabled
-container-getty@.service                   static   disabled
+container-getty@.service                   static
 dbus-broker.service                        enabled  enabled
 dbus-daemon.service                        disabled disabled
-dbus-org.bluez.service                     enabled  disabled
-dbus-org.fedoraproject.FirewallD1.service  enabled  disabled
-dbus-org.freedesktop.home1.service         static   disabled
-dbus-org.freedesktop.hostname1.service     static   disabled
-dbus-org.freedesktop.locale1.service       static   disabled
-dbus-org.freedesktop.login1.service        static   disabled
-dbus-org.freedesktop.ModemManager1.service enabled  disabled
-dbus-org.freedesktop.nm-dispatcher.service enabled  disabled
-dbus-org.freedesktop.portable1.service     static   disabled
-dbus-org.freedesktop.timedate1.service     static   disabled
-dbus.service                               enabled  disabled
+dbus-org.bluez.service                     alias
+dbus-org.fedoraproject.FirewallD1.service  alias
+dbus-org.freedesktop.home1.service         alias
+dbus-org.freedesktop.hostname1.service     alias
+dbus-org.freedesktop.locale1.service       alias
+dbus-org.freedesktop.login1.service        alias
+dbus-org.freedesktop.ModemManager1.service alias
+dbus-org.freedesktop.nm-dispatcher.service alias
+dbus-org.freedesktop.portable1.service     alias
+dbus-org.freedesktop.timedate1.service     alias
+dbus.service                               alias
 dbxtool.service                            enabled  enabled
 debug-shell.service                        disabled disabled
-dm-event.service                           static   enabled
+dm-event.service                           static
 dmraid-activation.service                  enabled  enabled
-dnf-makecache.service                      static   disabled
+dnf-makecache.service                      static
 dnsmasq.service                            disabled disabled
-dracut-cmdline.service                     static   disabled
-dracut-initqueue.service                   static   disabled
-dracut-mount.service                       static   disabled
-dracut-pre-mount.service                   static   disabled
-dracut-pre-pivot.service                   static   disabled
-dracut-pre-trigger.service                 static   disabled
-dracut-pre-udev.service                    static   disabled
-dracut-shutdown.service                    static   disabled
+dracut-cmdline.service                     static
+dracut-initqueue.service                   static
+dracut-mount.service                       static
+dracut-pre-mount.service                   static
+dracut-pre-pivot.service                   static
+dracut-pre-trigger.service                 static
+dracut-pre-udev.service                    static
+dracut-shutdown.service                    static
 ead.service                                disabled disabled
-emergency.service                          static   disabled
+emergency.service                          static
 fancontrol.service                         disabled disabled
 firewalld.service                          enabled  enabled
-fprintd.service                            static   disabled
-fstrim.service                             static   disabled
+fprintd.service                            static
+fstrim.service                             static
 getty@.service                             enabled  enabled
-grub-boot-indeterminate.service            static   disabled
+grub-boot-indeterminate.service            static
 gssproxy.service                           disabled disabled
 import-state.service                       enabled  enabled
 initial-setup-reconfiguration.service      disabled disabled
 initial-setup.service                      enabled  disabled
-initrd-cleanup.service                     static   disabled
-initrd-parse-etc.service                   static   disabled
-initrd-switch-root.service                 static   disabled
-initrd-udevadm-cleanup-db.service          static   disabled
-instperf.service                           static   disabled
+initrd-cleanup.service                     static
+initrd-parse-etc.service                   static
+initrd-switch-root.service                 static
+initrd-udevadm-cleanup-db.service          static
+instperf.service                           static
 io.podman.service                          disabled disabled
 irqbalance.service                         enabled  enabled
-iscsi-shutdown.service                     static   disabled
+iscsi-shutdown.service                     static
 iscsi.service                              enabled  disabled
 iscsid.service                             disabled disabled
 iscsiuio.service                           disabled disabled
 iwd.service                                disabled disabled
 kdump.service                              disabled disabled
-kmod-static-nodes.service                  static   disabled
-ldconfig.service                           static   disabled
+kmod-static-nodes.service                  static
+ldconfig.service                           static
 lm_sensors.service                         enabled  enabled
 loadmodules.service                        disabled disabled
-logrotate.service                          static   disabled
-lvm2-lvmpolld.service                      static   enabled
+logrotate.service                          static
+lvm2-lvmpolld.service                      static
 lvm2-monitor.service                       enabled  enabled
-lvm2-pvscan@.service                       static   disabled
-man-db-cache-update.service                static   disabled
+lvm2-pvscan@.service                       static
+man-db-cache-update.service                static
 man-db-restart-cache-update.service        disabled disabled
-mdadm-grow-continue@.service               static   disabled
-mdadm-last-resort@.service                 static   disabled
-mdmon@.service                             static   disabled
+mdadm-grow-continue@.service               static
+mdadm-last-resort@.service                 static
+mdmon@.service                             static
 mdmonitor.service                          enabled  enabled
-mlocate-updatedb.service                   static   disabled
+mlocate-updatedb.service                   static
 ModemManager.service                       enabled  enabled
-modprobe@.service                          static   disabled
+modprobe@.service                          static
 multipathd.service                         enabled  enabled
 ndctl-monitor.service                      disabled disabled
 NetworkManager-dispatcher.service          enabled  enabled
@@ -127,53 +127,53 @@
 NetworkManager.service                     enabled  enabled
 nfs-blkmap.service                         disabled disabled
 nfs-convert.service                        enabled  disabled
-nfs-idmapd.service                         static   disabled
-nfs-mountd.service                         static   disabled
+nfs-idmapd.service                         static
+nfs-mountd.service                         static
 nfs-server.service                         disabled disabled
-nfs-utils.service                          static   disabled
-nfsdcld.service                            static   disabled
+nfs-utils.service                          static
+nfsdcld.service                            static
 nftables.service                           disabled disabled
 nis-domainname.service                     disabled disabled
 oddjobd.service                            disabled disabled
 openhpid.service                           disabled disabled
-ostree-finalize-staged.service             static   disabled
-ostree-prepare-root.service                static   disabled
+ostree-finalize-staged.service             static
+ostree-prepare-root.service                static
 ostree-remount.service                     enabled  enabled
-packagekit-offline-update.service          static   disabled
-packagekit.service                         static   disabled
+packagekit-offline-update.service          static
+packagekit.service                         static
 pcscd.service                              indirect disabled
-plymouth-halt.service                      static   disabled
-plymouth-kexec.service                     static   disabled
-plymouth-poweroff.service                  static   disabled
-plymouth-quit-wait.service                 static   disabled
-plymouth-quit.service                      static   disabled
-plymouth-read-write.service                static   disabled
-plymouth-reboot.service                    static   disabled
-plymouth-start.service                     static   disabled
-plymouth-switch-root.service               static   disabled
+plymouth-halt.service                      static
+plymouth-kexec.service                     static
+plymouth-poweroff.service                  static
+plymouth-quit-wait.service                 static
+plymouth-quit.service                      static
+plymouth-read-write.service                static
+plymouth-reboot.service                    static
+plymouth-start.service                     static
+plymouth-switch-root.service               static
 podman.service                             disabled disabled
-polkit.service                             static   enabled
+polkit.service                             static
 psacct.service                             disabled disabled
 qemu-guest-agent.service                   enabled  enabled
-quotaon.service                            static   disabled
+quotaon.service                            static
 raid-check.service                         disabled disabled
-rc-local.service                           static   disabled
+rc-local.service                           static
 rdisc.service                              disabled disabled
-realmd.service                             static   disabled
-rescue.service                             static   disabled
+realmd.service                             static
+rescue.service                             static
 rngd.service                               enabled  enabled
-rpc-gssd.service                           static   disabled
-rpc-statd-notify.service                   static   disabled
-rpc-statd.service                          static   disabled
+rpc-gssd.service                           static
+rpc-statd-notify.service                   static
+rpc-statd.service                          static
 rpcbind.service                            disabled disabled
 rsyslog.service                            enabled  enabled
 selinux-autorelabel-mark.service           enabled  enabled
-selinux-autorelabel.service                static   disabled
+selinux-autorelabel.service                static
 serial-getty@.service                      disabled disabled
 smartd.service                             enabled  enabled
 sshd-keygen@.service                       disabled disabled
 sshd.service                               enabled  enabled
-sshd@.service                              static   disabled
+sshd@.service                              static
 sssd-autofs.service                        indirect disabled
 sssd-kcm.service                           indirect disabled
 sssd-nss.service                           indirect disabled
@@ -182,84 +182,84 @@
 sssd-ssh.service                           indirect disabled
 sssd-sudo.service                          indirect disabled
 sssd.service                               enabled  enabled
-system-update-cleanup.service              static   disabled
-systemd-ask-password-console.service       static   disabled
-systemd-ask-password-plymouth.service      static   disabled
-systemd-ask-password-wall.service          static   disabled
-systemd-backlight@.service                 static   disabled
-systemd-binfmt.service                     static   disabled
-systemd-bless-boot.service                 static   disabled
+system-update-cleanup.service              static
+systemd-ask-password-console.service       static
+systemd-ask-password-plymouth.service      static
+systemd-ask-password-wall.service          static
+systemd-backlight@.service                 static
+systemd-binfmt.service                     static
+systemd-bless-boot.service                 static
 systemd-boot-check-no-failures.service     disabled disabled
-systemd-boot-system-token.service          static   disabled
-systemd-coredump@.service                  static   disabled
-systemd-exit.service                       static   disabled
-systemd-firstboot.service                  static   disabled
-systemd-fsck-root.service                  static   disabled
-systemd-fsck@.service                      static   disabled
-systemd-halt.service                       static   disabled
-systemd-hibernate-resume@.service          static   disabled
-systemd-hibernate.service                  static   disabled
-systemd-homed.service                      static   disabled
-systemd-hostnamed.service                  static   disabled
-systemd-hwdb-update.service                static   disabled
-systemd-hybrid-sleep.service               static   disabled
-systemd-initctl.service                    static   disabled
-systemd-journal-catalog-update.service     static   disabled
-systemd-journal-flush.service              static   disabled
-systemd-journald.service                   static   disabled
-systemd-journald@.service                  static   disabled
-systemd-kexec.service                      static   disabled
-systemd-localed.service                    static   disabled
-systemd-logind.service                     static   disabled
-systemd-machine-id-commit.service          static   disabled
-systemd-modules-load.service               static   disabled
+systemd-boot-system-token.service          static
+systemd-coredump@.service                  static
+systemd-exit.service                       static
+systemd-firstboot.service                  static
+systemd-fsck-root.service                  static
+systemd-fsck@.service                      static
+systemd-halt.service                       static
+systemd-hibernate-resume@.service          static
+systemd-hibernate.service                  static
+systemd-homed.service                      static
+systemd-hostnamed.service                  static
+systemd-hwdb-update.service                static
+systemd-hybrid-sleep.service               static
+systemd-initctl.service                    static
+systemd-journal-catalog-update.service     static
+systemd-journal-flush.service              static
+systemd-journald.service                   static
+systemd-journald@.service                  static
+systemd-kexec.service                      static
+systemd-localed.service                    static
+systemd-logind.service                     static
+systemd-machine-id-commit.service          static
+systemd-modules-load.service               static
 systemd-network-generator.service          disabled disabled
 systemd-networkd-wait-online.service       disabled disabled
 systemd-networkd.service                   disabled disabled
-systemd-portabled.service                  static   disabled
-systemd-poweroff.service                   static   disabled
+systemd-portabled.service                  static
+systemd-poweroff.service                   static
 systemd-pstore.service                     disabled enabled
-systemd-quotacheck.service                 static   disabled
-systemd-random-seed.service                static   disabled
-systemd-reboot.service                     static   disabled
-systemd-remount-fs.service                 static   disabled
-systemd-repart.service                     static   disabled
+systemd-quotacheck.service                 static
+systemd-random-seed.service                static
+systemd-reboot.service                     static
+systemd-remount-fs.service                 static
+systemd-repart.service                     static
 systemd-resolved.service                   disabled disabled
-systemd-rfkill.service                     static   disabled
-systemd-suspend-then-hibernate.service     static   disabled
-systemd-suspend.service                    static   disabled
-systemd-sysctl.service                     static   disabled
-systemd-sysusers.service                   static   disabled
+systemd-rfkill.service                     static
+systemd-suspend-then-hibernate.service     static
+systemd-suspend.service                    static
+systemd-sysctl.service                     static
+systemd-sysusers.service                   static
 systemd-time-wait-sync.service             disabled disabled
-systemd-timedated.service                  static   disabled
+systemd-timedated.service                  static
 systemd-timesyncd.service                  disabled disabled
-systemd-tmpfiles-clean.service             static   disabled
-systemd-tmpfiles-setup-dev.service         static   disabled
-systemd-tmpfiles-setup.service             static   disabled
-systemd-udev-settle.service                static   disabled
-systemd-udev-trigger.service               static   disabled
-systemd-udevd.service                      static   disabled
-systemd-update-done.service                static   disabled
-systemd-update-utmp-runlevel.service       static   disabled
-systemd-update-utmp.service                static   disabled
-systemd-user-sessions.service              static   disabled
-systemd-userdbd.service                    static   disabled
-systemd-vconsole-setup.service             static   disabled
-systemd-volatile-root.service              static   disabled
-teamd@.service                             static   disabled
+systemd-tmpfiles-clean.service             static
+systemd-tmpfiles-setup-dev.service         static
+systemd-tmpfiles-setup.service             static
+systemd-udev-settle.service                static
+systemd-udev-trigger.service               static
+systemd-udevd.service                      static
+systemd-update-done.service                static
+systemd-update-utmp-runlevel.service       static
+systemd-update-utmp.service                static
+systemd-user-sessions.service              static
+systemd-userdbd.service                    static
+systemd-vconsole-setup.service             static
+systemd-volatile-root.service              static
+teamd@.service                             static
 udisks2.service                            enabled  enabled
-user-runtime-dir@.service                  static   disabled
-user@.service                              static   disabled
+user-runtime-dir@.service                  static
+user@.service                              static
 winbind.service                            disabled disabled
 zram-swap.service                          enabled  disabled
-zram.service                               static   disabled
-system-cockpithttps.slice                  static   disabled
-system-systemd\x2dcryptsetup.slice         static   disabled
-user.slice                                 static   disabled
-cockpit-wsinstance-http-redirect.socket    static   disabled
-cockpit-wsinstance-http.socket             static   disabled
-cockpit-wsinstance-https-factory.socket    static   disabled
-cockpit-wsinstance-https@.socket           static   disabled
+zram.service                               static
+system-cockpithttps.slice                  static
+system-systemd\x2dcryptsetup.slice         static
+user.slice                                 static
+cockpit-wsinstance-http-redirect.socket    static
+cockpit-wsinstance-http.socket             static
+cockpit-wsinstance-https-factory.socket    static
+cockpit-wsinstance-https@.socket           static
 cockpit.socket                             enabled  enabled
 dbus.socket                                enabled  enabled
 dm-event.socket                            enabled  enabled
@@ -280,95 +280,95 @@
 sssd-pam.socket                            disabled disabled
 sssd-ssh.socket                            disabled disabled
 sssd-sudo.socket                           disabled disabled
-syslog.socket                              static   disabled
-systemd-coredump.socket                    static   disabled
-systemd-initctl.socket                     static   disabled
-systemd-journald-audit.socket              static   disabled
-systemd-journald-dev-log.socket            static   disabled
-systemd-journald-varlink@.socket           static   disabled
-systemd-journald.socket                    static   disabled
-systemd-journald@.socket                   static   disabled
+syslog.socket                              static
+systemd-coredump.socket                    static
+systemd-initctl.socket                     static
+systemd-journald-audit.socket              static
+systemd-journald-dev-log.socket            static
+systemd-journald-varlink@.socket           static
+systemd-journald.socket                    static
+systemd-journald@.socket                   static
 systemd-networkd.socket                    disabled disabled
-systemd-rfkill.socket                      static   disabled
-systemd-udevd-control.socket               static   disabled
-systemd-udevd-kernel.socket                static   disabled
-systemd-userdbd.socket                     static   disabled
-anaconda.target                            static   disabled
-basic.target                               static   disabled
-blockdev@.target                           static   disabled
-bluetooth.target                           static   enabled
-boot-complete.target                       static   disabled
-cryptsetup-pre.target                      static   disabled
-cryptsetup.target                          static   disabled
-ctrl-alt-del.target                        enabled  disabled
-default.target                             indirect disabled
-emergency.target                           static   disabled
+systemd-rfkill.socket                      static
+systemd-udevd-control.socket               static
+systemd-udevd-kernel.socket                static
+systemd-userdbd.socket                     static
+anaconda.target                            static
+basic.target                               static
+blockdev@.target                           static
+bluetooth.target                           static
+boot-complete.target                       static
+cryptsetup-pre.target                      static
+cryptsetup.target                          static
+ctrl-alt-del.target                        alias
+default.target                             alias
+emergency.target                           static
 exit.target                                disabled disabled
-final.target                               static   disabled
-getty-pre.target                           static   disabled
-getty.target                               static   disabled
-graphical.target                           static   disabled
+final.target                               static
+getty-pre.target                           static
+getty.target                               static
+graphical.target                           static
 halt.target                                disabled disabled
-hibernate.target                           static   disabled
-hybrid-sleep.target                        static   disabled
-initrd-fs.target                           static   disabled
-initrd-root-device.target                  static   disabled
-initrd-root-fs.target                      static   disabled
-initrd-switch-root.target                  static   disabled
-initrd.target                              static   disabled
+hibernate.target                           static
+hybrid-sleep.target                        static
+initrd-fs.target                           static
+initrd-root-device.target                  static
+initrd-root-fs.target                      static
+initrd-switch-root.target                  static
+initrd.target                              static
 kexec.target                               disabled disabled
-local-fs-pre.target                        static   disabled
-local-fs.target                            static   disabled
+local-fs-pre.target                        static
+local-fs.target                            static
 multi-user.target                          indirect disabled
-network-online.target                      static   disabled
-network-pre.target                         static   disabled
-network.target                             static   disabled
+network-online.target                      static
+network-pre.target                         static
+network.target                             static
 nfs-client.target                          enabled  disabled
-nss-lookup.target                          static   disabled
-nss-user-lookup.target                     static   disabled
-paths.target                               static   disabled
+nss-lookup.target                          static
+nss-user-lookup.target                     static
+paths.target                               static
 poweroff.target                            disabled disabled
-printer.target                             static   disabled
+printer.target                             static
 reboot.target                              enabled  enabled
 remote-cryptsetup.target                   disabled enabled
-remote-fs-pre.target                       static   disabled
+remote-fs-pre.target                       static
 remote-fs.target                           enabled  enabled
-rescue.target                              static   disabled
-rpc_pipefs.target                          static   disabled
-rpcbind.target                             static   disabled
-runlevel0.target                           disabled disabled
-runlevel1.target                           static   disabled
-runlevel2.target                           indirect disabled
-runlevel3.target                           indirect disabled
-runlevel4.target                           indirect disabled
-runlevel5.target                           static   disabled
-runlevel6.target                           enabled  disabled
-selinux-autorelabel.target                 static   disabled
-shutdown.target                            static   disabled
-sigpwr.target                              static   disabled
-sleep.target                               static   disabled
-slices.target                              static   disabled
-smartcard.target                           static   disabled
-sockets.target                             static   disabled
-sound.target                               static   disabled
-sshd-keygen.target                         static   disabled
-suspend-then-hibernate.target              static   disabled
-suspend.target                             static   disabled
-swap.target                                static   disabled
-sysinit.target                             static   disabled
-system-update-pre.target                   static   disabled
-system-update.target                       static   disabled
-time-set.target                            static   disabled
-time-sync.target                           static   disabled
-timers.target                              static   disabled
-umount.target                              static   disabled
+rescue.target                              static
+rpc_pipefs.target                          static
+rpcbind.target                             static
+runlevel0.target                           alias
+runlevel1.target                           alias
+runlevel2.target                           alias
+runlevel3.target                           alias
+runlevel4.target                           alias
+runlevel5.target                           alias
+runlevel6.target                           alias
+selinux-autorelabel.target                 static
+shutdown.target                            static
+sigpwr.target                              static
+sleep.target                               static
+slices.target                              static
+smartcard.target                           static
+sockets.target                             static
+sound.target                               static
+sshd-keygen.target                         static
+suspend-then-hibernate.target              static
+suspend.target                             static
+swap.target                                static
+sysinit.target                             static
+system-update-pre.target                   static
+system-update.target                       static
+time-set.target                            static
+time-sync.target                           static
+timers.target                              static
+umount.target                              static
 chrony-dnssrv@.timer                       disabled disabled
 dnf-makecache.timer                        enabled  enabled
 fstrim.timer                               enabled  enabled
 logrotate.timer                            enabled  enabled
-mdadm-last-resort@.timer                   static   disabled
+mdadm-last-resort@.timer                   static
 mlocate-updatedb.timer                     enabled  enabled
 raid-check.timer                           disabled disabled
-systemd-tmpfiles-clean.timer               static   disabled
+systemd-tmpfiles-clean.timer               static

 371 unit files listed.

In particular, this allows a meaningful comparison to be made:

$ ~/src/systemd/build/systemctl --root=/tmp/root2 list-unit-files|rg 'enabled.*disabled|disabled.*enabled'
ostree-finalize-staged.path                disabled enabled
initial-setup.service                      enabled  disabled
iscsi.service                              enabled  disabled
nfs-convert.service                        enabled  disabled
systemd-pstore.service                     disabled enabled
zram-swap.service                          enabled  disabled
iscsid.socket                              enabled  disabled
iscsiuio.socket                            enabled  disabled
multipathd.socket                          enabled  disabled
nfs-client.target                          enabled  disabled
remote-cryptsetup.target                   disabled enabled

(It turns out that most of the services on this list that are enabled without a
corresponding preset are against rpm packaging and do direct 'systemctl enable'
calls in %post, instead of going through presets as they are supposed to.)

systemctl: also skip preset status in status verb
2020-05-05 22:03:53 +02:00
Zbigniew Jędrzejewski-Szmek 15d7ab87c4 systemctl: add new enablement state "alias"
For units which are aliases of other units, reporting preset status as
"enabled" is rather misleading. For example, dbus.service is an alias of
dbus-broker.service. In list-unit-files we'd show both as "enabled".  In
particular, systemctl preset ignores aliases, so showing any preset status at
all is always going to be misleading. Let's introduce a new state "alias" and
use that for all aliases.

I was trying to avoid adding a new state, to keep compatibility with previous
behaviour, but for alias unit files it simply doesn't seem very useful to show
any of the existing states. It seems that the clearly showing that those are
aliases for other units will be easiest to understand for users.
2020-05-05 21:50:38 +02:00
Zbigniew Jędrzejewski-Szmek 9c894b8579 shared/install: rename variable for clarity 2020-05-05 21:50:38 +02:00
Zbigniew Jędrzejewski-Szmek bce84e10f8 shared/install: print name of offending file in error
"Unit type slice cannot be templated."
↓
"/etc/systemd/system.control/user@.slice: unit type slice cannot be templated."
2020-05-05 21:50:38 +02:00
Zbigniew Jędrzejewski-Szmek babccf14ce shared/install: indent tables 2020-05-05 21:50:38 +02:00
Zbigniew Jędrzejewski-Szmek 8f7b256665 shared/install: optionally cache the preset list
When doing list-unit-files with --root, we would re-read the preset
list for every unit. This uses a cache to only do it once. The time
for list-unit-files goes down by about ~30%.

unit_file_query_preset() is also called from src/core/. This patch does not
touch that path, since the saving there are smaller, since preset status is
only read on demand over dbus, and caching would be more complicated.
2020-05-05 21:50:31 +02:00
Zbigniew Jędrzejewski-Szmek c39b7821f6 systemctl: fix --root support in querying presets
We would always look on the host, ignoring --root.
2020-05-05 18:05:32 +02:00
Zbigniew Jędrzejewski-Szmek 4cb1015e6b systemctl: refuse online-only ops with --root
It is super confusing when a command does not support --root, and is called
with it specified, and returns some bogus results. Let's just catch this
early and refuse.
2020-05-05 18:05:23 +02:00
Zbigniew Jędrzejewski-Szmek 9321e23c40 shared/verbs: split out helper to find verbs
It will be used later, but I think it makes the code clearer anyway.

Also change the message about ignoring to include the name for default
verbs.
2020-05-05 18:04:55 +02:00
Zbigniew Jędrzejewski-Szmek d8b065e056 shared/verbs: add a modicum of documentation 2020-05-05 18:04:44 +02:00
Zbigniew Jędrzejewski-Szmek ae98f726ff systemctl: mark log-level,log-target,service-watchdogs as online-only
They were added in 6ab863190d and
38fcb7f766. I don't see a good reason to
exclude them from the online-only check.
2020-05-05 18:04:36 +02:00
Zbigniew Jędrzejewski-Szmek 77102db288 systemctl: fix hint when 'systemctl help' is given
Not all verbs require unit names, but that is beside the point. We need a verb
here, and help is not a valid verb.
2020-05-05 18:04:28 +02:00
Zbigniew Jędrzejewski-Szmek eaf7ac4929
Merge pull request #15645 from poettering/calender-expression-doc-fix
some calendar expression fixes and documentation updates
2020-05-05 16:07:11 +02:00
Frantisek Sumsal 05c7d9bf5b Revert "logs-show: declare [static 2] on all highlight parameters"
This reverts commit 5444520628.

See: https://github.com/systemd/systemd/pull/15706
2020-05-05 16:37:45 +03:00
Zbigniew Jędrzejewski-Szmek 640ebaa952
Merge pull request #15648 from poettering/journalctl-cat-beefup
journalctl: honour --output-fields= in -o cat mode
2020-05-05 14:00:26 +02:00
Zbigniew Jędrzejewski-Szmek 90f1f8188b
Merge pull request #15701 from poettering/systemctl-json-table
systemctl: optionally output tables as json
2020-05-05 11:05:00 +02:00
Lennart Poettering 5fe4d1b514 shutdown: fix spacing in shutdown error message 2020-05-05 10:23:47 +02:00
Lennart Poettering 5444520628 logs-show: declare [static 2] on all highlight parameters 2020-05-05 09:22:27 +02:00
Lennart Poettering 4d5d1bba73 journalctl: optionally, show a different field than MESSAGE in -o cat mode
Fixes: #15621
2020-05-05 09:22:26 +02:00
Lennart Poettering 54ff74d273 journal: use set_contains() where appropriate 2020-05-05 09:04:30 +02:00
Motiejus Jakštys 5c4deb9a5c nspawn: mount custom paths before writing to /etc
Consider such configuration:

    $ systemd-nspawn --read-only --timezone=copy --resolv-conf=copy-host \
        --overlay="+/etc::/etc" <...>

Assuming one wants `/` to be read-only, DNS and `/etc/localtime` to
work. One way to do it is to create an overlay filesystem in `/etc/`.
However, systemd-nspawn tries to create `/etc/resolv.conf` and
`/etc/localtime` before mounting the custom paths, while `/` (and, by
extension, `/etc`) is read-only. Thus it fails to create those files.

Mounting custom paths before modifying anything in `/etc/` makes this
possible.

Full example:

```
$ debootstrap buster /var/lib/machines/t1 http://deb.debian.org/debian
$ systemd-nspawn --private-users=false --timezone=copy --resolv-conf=copy-host --read-only --tmpfs=/var --tmpfs=/run --overlay="+/etc::/etc" -D /var/lib/machines/t1 ping -c 1 example.com
Spawning container t1 on /var/lib/machines/t1.
Press ^] three times within 1s to kill container.
ping: example.com: Temporary failure in name resolution
Container t1 failed with error code 130.
```

With the patch:

```
$ sudo ./build/systemd-nspawn --private-users=false --timezone=copy --resolv-conf=copy-host --read-only --tmpfs=/var --tmpfs=/run --overlay="+/etc::/etc" -D /var/lib/machines/t1 ping -qc 1 example.com
Spawning container t1 on /var/lib/machines/t1.
Press ^] three times within 1s to kill container.
PING example.com (93.184.216.34) 56(84) bytes of data.

--- example.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 110.912/110.912/110.912/0.000 ms
Container t1 exited successfully.
```
2020-05-05 09:02:57 +02:00
Lennart Poettering c9c9f6f450 calendarspec: be more graceful with two kinds of calendar expressions
This changes the calendarspec parser to allow expressions such as
"00:05..05", i.e. a range where start and end is the same. It also
allows expressions such as "00:1-2/3", i.e. where the repetition value
does not fit even once in the specified range. With this patch both
cases will now be optimized away, i.e. the range is removed and a fixed
value is used, which is functionally equivalent.

See #15030 for an issue where the inability to parse such expressions
caused confusion.

I think it's probably better to accept these gracefully and optimizing
them away instead of refusing them with a plain EINVAL. With a tool such
as "systemd-analyze" calendar it should be easy to figure out the
normalized form with the redundant bits optimized away.
2020-05-05 08:57:14 +02:00
Lennart Poettering 05851cb9df calendarspec: minor simplification 2020-05-05 08:57:14 +02:00
Lennart Poettering 3c6f0300ae calendarspec: drop _pure_ from static function
For static functions the compiler should be able to determine this on
its own, let's not add needless decorators.
2020-05-05 08:57:14 +02:00
Lennart Poettering 80b19994a4 calendarspec: pack our flags a bit 2020-05-05 08:57:14 +02:00
Lennart Poettering a4d6d711cf calendarspec: encode that it's OK to store µs in 'int's 2020-05-05 08:57:14 +02:00
Lennart Poettering 49cd06fa2d systemctl: optionally output tables in JSON format 2020-05-05 08:15:04 +02:00
Lennart Poettering e21b76cd68 format-table: generate better JSON field names
Let's try to mangle table contents a bit to make them more suitable as
JSON field names. Specifically when we see "foo bar" convert this to
"foo_bar" as field name, as variable/field names are generally assumed
to be without spaces.
2020-05-05 08:13:58 +02:00
Anita Zhang 848cfa74d2
Merge pull request #15636 from poettering/sensitivity-training
be more careful when setting json variant + dbus message sensitive flag
2020-05-04 17:48:13 -07:00
Frantisek Sumsal 111e71c431 test: fix potential use-after-free
CID#1428676.
2020-05-04 17:10:18 +02:00
Evgeny Vereshchagin 80cf50120c
Merge pull request #15422 from nolange/add_zstd_coredump
coredump: add zstandard support for coredumps
2020-05-04 14:57:39 +03:00
Norbert Lange ef5924aa31 coredump: add zstandard support for coredumps
this will hook libzstd into coredump,
using this format as default.
2020-05-04 10:59:43 +02:00
Lennart Poettering ddd6a22a0f basic: add STRCASE_IN_SET() which is to STR_IN_SET() what strcaseeq() is to streq() 2020-05-04 10:11:19 +02:00
Zbigniew Jędrzejewski-Szmek fc021a5bbf logind,importd,hostnamed,localed,timedated,machined,resolved: add option parsing stubs
--help and --version are implemented in the usual style.
help() prints full path, since the program is not expected to
be in $PATH.
2020-05-03 10:55:51 +02:00
Zbigniew Jędrzejewski-Szmek 7ae473268c manager: add highlighting to --help
Also change the summary line to a bit more concise.
2020-05-03 10:55:51 +02:00
Zbigniew Jędrzejewski-Szmek 53f7f7fcf2 util-lib: add stub parser for --help, --version 2020-05-03 10:55:51 +02:00
Zbigniew Jędrzejewski-Szmek ab09bf9007 importd: wrap long lines 2020-05-03 10:55:51 +02:00
Zbigniew Jędrzejewski-Szmek b49ca3bc37 sd-bus: use STR_IN_SET() in one more place 2020-05-03 10:55:51 +02:00
Zbigniew Jędrzejewski-Szmek 2b6a1d155d bus-introspect: move xml string defines into the .c file 2020-05-03 10:55:51 +02:00
Zbigniew Jędrzejewski-Szmek 61d0df3919 bus-introspect: write <interface> from within introspect_write_interface() 2020-05-03 10:55:51 +02:00
Frantisek Sumsal 2d4f8cf467 man: fix few spelling errors
Reported by Fossies.org.
2020-05-03 10:23:25 +02:00
Michal Koutný 2e4086060b test: Fix build with !HAVE_LZ4 && HAVE_XZ
HUGE_SIZE was defined inconsistently.

> In file included from ../src/basic/alloc-util.h:9,
>                  from ../src/journal/test-compress.c:9:
> ../src/journal/test-compress.c: In function ‘main’:
> ../src/journal/test-compress.c:280:33: error: ‘HUGE_SIZE’ undeclared (first use in this function)
>   280 |         assert_se(huge = malloc(HUGE_SIZE));
2020-05-02 20:04:36 +00:00
Emmanuel Garette db1442260a repart: fix partition maximum size segfault
Discovered, tracked down and fix proposed by Emmanuel Garette.

See: https://lists.freedesktop.org/archives/systemd-devel/2020-April/044435.html

(Lennart turned this into a PR)

Fixes: #15608
2020-05-01 17:31:45 +02:00
Lennart Poettering 6eb35fd695
Merge pull request #15547 from kkdwivedi/notify-barrier
Introduce sd_notify_barrier
2020-05-01 08:48:42 +02:00
Zbigniew Jędrzejewski-Szmek b76ef59756
Merge pull request #13512 from msekletar/freezer
core: introduce support for cgroup freezer
2020-05-01 07:52:29 +02:00
Kumar Kartikeya Dwivedi 4f07ddfa9b
Introduce sd_notify_barrier
This adds the sd_notify_barrier function, to allow users to synchronize against
the reception of sd_notify(3) status messages. It acts as a synchronization
point, and a successful return gurantees that all previous messages have been
consumed by the manager. This can be used to eliminate race conditions where
the sending process exits too early for systemd to associate its PID to a
cgroup and attribute the status message to a unit correctly.

systemd-notify now uses this function for proper notification delivery and be
useful for NotifyAccess=all units again in user mode, or in cases where it
doesn't have a control process as parent.

Fixes: #2739
2020-05-01 03:22:47 +05:30
Lennart Poettering a8332698d7
Merge pull request #15592 from kennylevinsen/fdpoll-standalone
Introduce FDPOLL=0
2020-04-30 22:32:28 +02:00
Corey Hinshaw db72aea4a9 Add SetType method to login Session interface 2020-04-30 21:29:26 +02:00
Kenny Levinsen 3052049260 core: (De-)Serialize poll flag for fds in fdstore
This replaces manual string splitting and unescaping with
extract_first_word.
2020-04-30 19:42:53 +02:00
Kenny Levinsen cb5a46b845 core: Add optional FDPOLL=0 argument to fdstore
A service can specify FDSTORE=1 FDPOLL=0 to request that PID1 does not
poll the fd to remove them on error. If set, fds will only be removed on
FDSTOREREMOVE=1 or when the service is done.

Fixes: #12086
2020-04-30 19:42:26 +02:00
Michal Sekletár d9e45bc3ab core: introduce support for cgroup freezer
With cgroup v2 the cgroup freezer is implemented as a cgroup
attribute called cgroup.freeze. cgroup can be frozen by writing "1"
to the file and kernel will send us a notification through
"cgroup.events" after the operation is finished and processes in the
cgroup entered quiescent state, i.e. they are not scheduled to
run. Writing "0" to the attribute file does the inverse and process
execution is resumed.

This commit exposes above low-level functionality through systemd's DBus
API. Each unit type must provide specialized implementation for these
methods, otherwise, we return an error. So far only service, scope, and
slice unit types provide the support. It is possible to check if a
given unit has the support using CanFreeze() DBus property.

Note that DBus API has a synchronous behavior and we dispatch the reply
to freeze/thaw requests only after the kernel has notified us that
requested operation was completed.
2020-04-30 19:02:51 +02:00
Lennart Poettering 9dcd43b149 notify: beef up --pid= logic
Prompted by the discussions on #15547.
2020-04-30 18:36:05 +02:00
Lennart Poettering 484f4e5b2d efi: honour SYSTEMD_EFI_OPTIONS even if we wouldn't honour SystemdOptions EFI var due to SecureBoot
Fixes: #14864
2020-04-30 12:12:14 +02:00
Zbigniew Jędrzejewski-Szmek b8239b9c50 shared/unit-file: fix resolution of absoulute symlinks with --root
$ systemctl --no-pager --root /tmp/root2/ cat ctrl-alt-del.target
Failed to resolve symlink /tmp/root2/etc/systemd/system/ctrl-alt-del.target pointing to /usr/lib/systemd/system/reboot.target, ignoring: Channel number out of range
...
2020-04-30 12:02:44 +02:00
Lennart Poettering f46ba93944 efi: cache test results of boolean EFI state functions
EFI variable access is nowadays subject to rate limiting by the kernel.
Thus, let's cache the results of checking them, in order to minimize how
often we access them.

Fixes: #14828
2020-04-30 08:10:31 +02:00
nabijaczleweli e81f5fc4e8
link: Allow configuring RX mini and jumbo ring sizes, too
This now covers all ethtool_ringparam configurables (as of v5.6;
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ethtool.h?h=v5.6#n488)
2020-04-29 18:57:13 +02:00
nabijaczleweli 80af9bdabe
link: Add units and fix typo in (Rx|Tx)BufferSize= manpage. Clean up the implementation slightly 2020-04-29 18:55:42 +02:00
Michal Sekletár 25a1f04c68 basic/cgroup-util: introduce cg_get_keyed_attribute_full()
Callers of cg_get_keyed_attribute_full() can now specify via the flag whether the
missing keyes in cgroup attribute file are OK or not. Also the wrappers for both
strict and graceful version are provided.
2020-04-29 18:41:19 +02:00
Lennart Poettering 560a3e5dd6 home: make sure whenever we touch the 'secret' part of a user record, we set the the sensitive flag on it 2020-04-29 16:32:46 +02:00
Lennart Poettering 2ffee2c9b0 home: mark various bus messages we write user records to as sensitive
let's make sure that when we append potentially sensitive data to a bus
message we set the sensitive flag on the message object.
2020-04-29 16:32:46 +02:00
Lennart Poettering 94600eeb29 json: when making a copy of a json variant, propagate the sensitive bit
Let's make sure we never lose the bit when copying a variant, after all
the data contained is still going to be sensitive after the copy.
2020-04-29 16:32:46 +02:00
Michal Sekletár 08deac6e3e selinux: do preprocessor check only in selinux-access.c
This has the advantage that mac_selinux_access_check() can be used as a
function in all contexts. For example, parameters passed to it won't be
reported as unused if the "function" call is replaced with 0 on SELinux
disabled builds.
2020-04-29 13:56:40 +02:00
Frantisek Sumsal e83ef04d97
Merge pull request #15626 from poettering/more-specifiers
tmpfiles,sysusers,pid1: add a bunch of more specifiers
2020-04-29 10:07:12 +02:00
Lennart Poettering dfe01841e6 tmpfiles: remove unnecessary assert
if we parse an xattr line that has no valid assignment, we might end up
with an empty ->xattr list. Don't hit assert on that, just go on.

Fixes: #15610
2020-04-29 00:23:28 +02:00
Lennart Poettering d02933fded tmpfiles: use log_syntax() for all parse errors 2020-04-29 00:23:28 +02:00
Lennart Poettering 268f5a5463 tree-wide: support a bunch of additional specifiers 2020-04-28 22:47:21 +02:00
Lennart Poettering 04d1ee0f7e main: bump RLIMIT_MEMLOCK by physical RAM size
Let's allow more memory to be locked on beefy machines than on small
ones. The previous limit of 64M is the lower bound still. This
effectively means on a 4GB machine we can lock 512M, which should be
more than enough, but still not lock up the machine entirely under
pressure.

Fixes: #15053
2020-04-28 19:54:21 +02:00
Lennart Poettering dcff2fa5d1 nspawn: be more careful with creating/chowning directories to overmount
We should never re-chown selinuxfs.

Fixes: #15475
2020-04-28 19:40:46 +02:00
Daan De Meyer bac1b83217 sd-bus: Add sd_bus_query_sender_creds/privilege docs 2020-04-28 19:38:04 +02:00
Zbigniew Jędrzejewski-Szmek 2344aefccf
Merge pull request #15618 from keszybz/help-output
Small adjustments to --help output
2020-04-28 19:31:16 +02:00
Luca Boccassi 4096043f05 Revert "detect-virt: also detect "microsoft" as WSL"
WSL2 will soon (TM) include the "WSL2" string in /proc/sys/kernel/osrelease
so the workaround will no longer be necessary.
We have several different cloud images which do include the "microsoft"
string already, which would break this detection. They are for internal
usage at the moment, but the userspace side can come from all over the
place so it would be quite hard to track and downstream-patch to avoid
breakages.

This reverts commit a2f838d590.
2020-04-28 13:13:12 +02:00
Zbigniew Jędrzejewski-Szmek c11428adf9 homectl: say "home area" in more places
Follow-up for b5947b5b10.
2020-04-28 09:56:24 +02:00
Zbigniew Jędrzejewski-Szmek 7009610ff5 userdbctl: make --help fit in 80 columns 2020-04-28 09:56:24 +02:00
Zbigniew Jędrzejewski-Szmek 7229ec02ab efivars: retry open and read operations
On my laptop (Lenovo X1carbo 4th) I very occasionally see test-boot-timestamps
fail with this tb:

262/494 test-boot-timestamps                    FAIL    0.7348453998565674 s (killed by signal 6 SIGABRT)

08:12:48 SYSTEMD_LANGUAGE_FALLBACK_MAP='/home/zbyszek/src/systemd/src/locale/language-fallback-map' SYSTEMD_KBD_MODEL_MAP='/home/zbyszek/src/systemd/src/locale/kbd-model-map' PATH='/home/zbyszek/src/systemd/build:/home/zbyszek/.local/bin:/usr/lib64/qt-3.3/bin:/usr/share/Modules/bin:/usr/condabin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/zbyszek/bin:/var/lib/snapd/snap/bin' /home/zbyszek/src/systemd/build/test-boot-timestamps
--- stderr ---
Failed to read $container of PID 1, ignoring: Permission denied
Found container virtualization none.
Failed to get SystemdOptions EFI variable, ignoring: Interrupted system call
Failed to read ACPI FPDT: Permission denied
Failed to read LoaderTimeInitUSec: Interrupted system call
Failed to read EFI loader data: Interrupted system call
Assertion 'q >= 0' failed at src/test/test-boot-timestamps.c:84, function main(). Aborting.

Normally it takes ~0.02s, but here there's a slowdown to 0.73 and things fail with EINTR.
This happens only occasionally, and I haven't been able to capture a strace.

It would be to ignore that case in test-boot-timestamps or always translate
EINTR to -ENODATA. Nevertheless, I think it's better to retry, since this gives
as more resilient behaviour and avoids a transient failure.

See
https://github.com/torvalds/linux/blob/master/fs/efivarfs/file.c#L75
and
bef3efbeb8.
2020-04-28 09:00:25 +02:00
Topi Miettinen 3c14dc61f7 tests: various small fixes for strict systems
Don't assume that 4MB can be allocated from stack since there could be smaller
DefaultLimitSTACK= in force, so let's use malloc(). NUL terminate the huge
strings by hand, also ensure termination in test_lz4_decompress_partial() and
optimize the memset() for the string.

Some items in /proc and /etc may not be accessible to poor unprivileged users
due to e.g. SELinux, BOFH or both, so check for EACCES and EPERM.

/var/tmp may be a symlink to /tmp and then path_compare() will always fail, so
let's stick to /tmp like elsewhere.

/tmp may be mounted with noexec option and then trying to execute scripts from
there would fail.

Detect and warn if seccomp is already in use, which could make seccomp test
fail if the syscalls are already blocked.

Unset $TMPDIR so it will not break specifier tests where %T is assumed to be
/tmp and %V /var/tmp.
2020-04-26 20:18:48 +02:00
Dan Streetman af5654d35c test-cgroup: skip if /sys/fs/cgroup unknown fs
It's not always mounted, e.g. during the build-time tests, it's running inside
a chroot (that's how Debian/Ubuntu build packages, in chroots) so this test
always fails because /sys/fs/cgroup isn't mounted.
2020-04-25 10:00:43 +02:00
Dan Streetman 0bc5f001db cgroup-util: check for SYSFS_MAGIC when detecting cgroup format
When nothing at all is mounted at /sys/fs/cgroup, the fs.f_type is
SYSFS_MAGIC (0x62656572) which results in the confusing debug log:

"Unknown filesystem type 62656572 mounted on /sys/fs/cgroup."

Instead, if the f_type is SYSFS_MAGIC, a more accurate message is:

"No filesystem is currently mounted on /sys/fs/cgroup."
2020-04-25 10:00:43 +02:00
Thomas Haller feb7d7a212 dhcp6: make string argument to sd_dhcp6_client_set_request_mud_url() const 2020-04-24 10:13:33 +02:00
Zbigniew Jędrzejewski-Szmek e2697253c8
Merge pull request #15564 from poettering/tmpfiles-no-proc
util-lib: check for /proc being mounted in some really basic fs operations
2020-04-24 08:16:22 +02:00
Zbigniew Jędrzejewski-Szmek 11f9379866
Merge pull request #15570 from poettering/cmsg-find
CMSG_FIND_DATA() and cmsg_find() work
2020-04-24 07:45:07 +02:00
Lennart Poettering 41ab8c67eb tree-wide: use structured initialization at various places 2020-04-24 07:44:42 +02:00
Lennart Poettering 2efa5bc6fa dhcp-server: port to recvmsg_safe()
Split out of #15457, let's see if this is the culprit of the CI failure.
2020-04-24 07:43:42 +02:00
Lennart Poettering 2adfd1bda1 icmp6-util: port to recvmsg_safe()
Split out of #15457, let's see if this is the culprit of the CI failure.
2020-04-24 07:41:32 +02:00
Lennart Poettering 84b5d3e532 dhcp-client: port to recvmsg_safe()
Split out of #15457, let's see if this is the culprit of the CI failure.

(also setting green label here, since @keszybz already greenlit it in that other PR)
2020-04-24 07:40:32 +02:00
Lennart Poettering 9494da41c2 nss-systemd: don't synthesize root/nobody when iterating
Fixes: #15160
2020-04-23 23:07:08 +02:00
Lennart Poettering bf39cb7b92
Merge pull request #15566 from poettering/destroy-binfmt
unregister binary formats during shutdown
2020-04-23 21:15:22 +02:00
Lennart Poettering 113a51d221 home: fix strv NUL termination
Fixes: #15559
2020-04-23 21:15:02 +02:00
Lennart Poettering b2cdefad3a networkd: don't do lldp rx nor tx on bond devices
Fixes: #15146
2020-04-23 20:01:30 +02:00
Lennart Poettering 035e3cb9f9
Merge pull request #15563 from keszybz/wait-callback-tweak
Add NULL callback check in one more place
2020-04-23 19:50:36 +02:00
Lennart Poettering 08508c4862
Merge pull request #15561 from poettering/udev-memdup-fix
udev: nulstr NUL termination fix
2020-04-23 19:50:12 +02:00
Lennart Poettering 371d72e05b socket-util: introduce type-safe, dereferencing wrapper CMSG_FIND_DATA around cmsg_find()
let's take this once step further, and add type-safety to cmsg_find(),
and imply the CMSG_DATA() macro for finding the cmsg payload.
2020-04-23 19:41:15 +02:00
Lennart Poettering dac556fa7b tree-wide: use cmsg_find() helper at various places where appropriate 2020-04-23 19:41:15 +02:00
Lennart Poettering 0f4a141744
Merge pull request #15504 from poettering/cmsg-find-pure
just the recvmsg_safe() stuff from #15457
2020-04-23 17:28:19 +02:00
Lennart Poettering 846acb6798 binfmt: also unregister binfmt entries from unit
We unregister binfmt_misc twice during shutdown with this change:

1. A previous commit added support for doing that in the final shutdown
   phase, i.e. when we do the aggressive umount loop. This is the robust
   thing to do, in case the earlier ("clean") shutdown phase didn't work
   for some reason.

2. This commit adds support for doing that when systemd-binfmt.service
   is stopped. This is a good idea so that people can order mounts
   before the service if they want to register binaries from such
   mounts, as in that case we'll undo the registration on shutdown
   again, before unmounting those mounts.

And all that, just because of that weird "F" flag the kernel introduced
that can pin files...

Fixes: #14981
2020-04-23 17:14:45 +02:00
Lennart Poettering f3670df13e binfmt: modernize code a bit
Let's just copy out the bit of the string we need, and let's make sure
we refuse rules called "status" and "register", since those are special
files in binfmt_misc's file system.
2020-04-23 17:14:41 +02:00
Lennart Poettering 0282c0285a shutdown: unregister all binfmt_misc entries before entering shutdown loop
Apparently if the new "F" flag is used they might pin files, which
blocks us from unmounting things. Let's hence clear this up explicitly.
Before entering our umount loop.

Fixes: #14981
2020-04-23 17:14:38 +02:00
Lennart Poettering 965cc99416 shared: add common helper for unregistering all binfmt entries 2020-04-23 17:13:50 +02:00
Lennart Poettering a9ab5cdb50
Merge pull request #15472 from keszybz/dbus-api-docs
A few more dbus api documentation updates
2020-04-23 17:01:11 +02:00
Zbigniew Jędrzejewski-Szmek d3d53e5cd1 shared: add NULL callback check in one more place
Follow-up for 9f65637308.
2020-04-23 14:53:54 +02:00
Lennart Poettering f8606626ed tmpfiles: if we get ENOENT when opening /proc/self/fd/, check if /proc is mounted
let's return ENOSYS in that case, to make things a bit less confusng.

Previously we'd just propagate ENOENT, which people might mistake as
applying to the object being modified rather than /proc/ just not being
there.

Let's return ENOSYS instead, i.e. an error clearly indicating that some
kernel API is not available. This hopefully should put people on a
better track.

Note that we only do the procfs check in the error path, which hopefully
means it's the less likely path.

We probably can add similar bits to more suitable codepaths dealing with
/proc/self/fd, but for now, let's pick to the ones noticed in #14745.

Fixes: #14745
2020-04-23 14:52:10 +02:00
Lennart Poettering 883fff25f4 stat-util: add simpler helper for checking if /proc/ is mounted 2020-04-23 14:51:08 +02:00
Lennart Poettering 6d965610bd stat-util: no need to open a file to check fs type 2020-04-23 14:50:53 +02:00
Lennart Poettering 0f7e4b2888 sysusers,tmpfiles: always mention error when failing to replace specifiers 2020-04-23 14:50:07 +02:00
Lennart Poettering 2230e8f29d sysusers: add accidentally forgotten 'return' 2020-04-23 14:49:14 +02:00
Zbigniew Jędrzejewski-Szmek 8f3e342fa9 core: fix unused variable warning when !HAVE_SECCOMP 2020-04-23 14:42:09 +02:00
Lennart Poettering 9663ed378e udev: use STR_IN_SET() wher eit makes sense 2020-04-23 13:56:21 +02:00
Lennart Poettering cd3c8a117c udev: prepare memory for extra NUL termination for NULSTR
Fixes: #15162
2020-04-23 13:56:21 +02:00
Lennart Poettering 2d69cf6eb0
Merge pull request #15543 from poettering/fix-ubsan-sd-bus
sd-bus: work around ubsan warning
2020-04-23 13:39:58 +02:00
Balint Reczey 9f65637308 shared: Don't try calling NULL callback in bus_wait_for_units_clear
BugLink: https://bugs.launchpad.net/bugs/1870930
2020-04-23 12:25:20 +02:00
Lennart Poettering b70cc80ffb
Merge pull request #15544 from poettering/fix-journalctl-namespace
sd-journal: fix namespace check
2020-04-23 12:19:25 +02:00
Lennart Poettering a5f0f46f1a
Merge pull request #15538 from poettering/nspawn-no-netns
nspawn: politely refuse --image= when run inside non-host netns
2020-04-23 11:11:11 +02:00
Lennart Poettering a7c71d214c run: don't wait for start job to complete when running interactively anyway
Otherwise we'd not read the services input while waiting for the job to
wait, and there's no point in waiting for the job anyway if we wait for
the unit to stop ultimately.

Fixes: #15395
2020-04-23 09:47:20 +02:00
Lennart Poettering 3691bcf3c5 tree-wide: use recvmsg_safe() at various places
Let's be extra careful whenever we return from recvmsg() and see
MSG_CTRUNC set. This generally means we ran into a programming error, as
we didn't size the control buffer large enough. It's an error condition
we should at least log about, or propagate up. Hence do that.

This is particularly important when receiving fds, since for those the
control data can be of any size. In particular on stream sockets that's
nasty, because if we miss an fd because of control data truncation we
cannot recover, we might not even realize that we are one off.

(Also, when failing early, if there's any chance the socket might be
AF_UNIX let's close all received fds, all the time. We got this right
most of the time, but there were a few cases missing. God, UNIX is hard
to use)
2020-04-23 09:41:47 +02:00
Lennart Poettering 47eae6ce0c socket-util: add recvmsg_safe() wrapper that handles MSG_CTRUNC 2020-04-23 09:40:56 +02:00
Lennart Poettering 2b6df46d21 sd-journal: don't check namespaces if we have no namespace to go by
Fixes: #15528
2020-04-23 09:23:53 +02:00
Lennart Poettering 287b737693 nspawn: refuse politely when we are run in the non-host netns in combination with --image=
Strictly speaking this doesn't really fix #15079, but it at least means
we won't hang anymore.

Fixes: #15079
2020-04-23 09:18:43 +02:00
Lennart Poettering 1433e0f212 nspawn: minor simplification 2020-04-23 09:18:05 +02:00
Zbigniew Jędrzejewski-Szmek 73781de41f
Merge pull request #15530 from ssahani/lpr-dhcpv4-option-9
network: add support to DHCPv4 server/client option 9 LPR
2020-04-23 09:10:14 +02:00
Lennart Poettering 49490c1d35 acpi-fpdt: mark structures as packed
Let's make sure the alignment doesn't matter.
2020-04-23 08:55:08 +02:00
Lennart Poettering 0cd41757d0 sd-bus: work around ubsan warning
ubsan complains that we add an offset to a NULL ptr here in some cases.
Which isn't really a bug though, since we only use it as the end
condition for a for loop, but we can still fix it...

Fixes: #15522
2020-04-23 08:54:30 +02:00
Zbigniew Jędrzejewski-Szmek 9786b27cbb
Merge pull request #15546 from poettering/pid1-serialize-comand-fix
core: make sure to restore the control command id, too
2020-04-23 08:51:58 +02:00
Zbigniew Jędrzejewski-Szmek 4ee40eefce
Merge pull request #15516 from poettering/nspawn-resolv-conf
beef up --resolv-conf= options of systemd-nspawn
2020-04-23 08:01:46 +02:00
Lennart Poettering 81d2fe53fc nspawn: some minor modernizations 2020-04-23 07:59:26 +02:00
Zbigniew Jędrzejewski-Szmek 1943d50e4e
Merge pull request #15507 from poettering/bus-log-api
add generic bus interface for setting log level that can be implemented by any daemon
2020-04-22 23:30:09 +02:00
Lennart Poettering e8cf09b2a2 core: make sure we don't get confused when setting TERM for a tty fd
Fixes: #15344
2020-04-22 22:59:41 +02:00
Lennart Poettering e9da62b18a core: make sure to restore the control command id, too
Fixes: #15356
2020-04-22 20:34:02 +02:00
Lennart Poettering 5b99bd5fd4 core: some minor clean-ups/modernizations 2020-04-22 20:33:57 +02:00
Lennart Poettering 86775e3524 nspawn: beef up --resolve-conf= modes
Let's add flavours for copying stub/uplink resolv.conf versions.

Let's add a more brutal "replace" mode, where we'll replace any existing
destination file.

Let's also change what "auto" means: instead of copying the static file,
let's use the stub file, so that DNS search info is copied over.

Fixes: #15340
2020-04-22 19:38:04 +02:00
Lennart Poettering 082814743f resolve: move resolv.conf path definitions to shared header
That way we can use it from nspawn.
2020-04-22 19:38:04 +02:00
Susant Sahani 828e653c48 networkctl: Add support to display LPR servers 2020-04-22 14:50:27 +02:00
Susant Sahani d64cc72e80 sd-network: Add support to retrive LPR servers 2020-04-22 14:49:52 +02:00
Susant Sahani d361b3730a network: Add support send and receive LPR servers 2020-04-22 14:49:27 +02:00
Susant Sahani 50018bfa84 sd-network: DHCPv4 Add support to send and receive LPR servers. 2020-04-22 14:48:11 +02:00
Zbigniew Jędrzejewski-Szmek eecf4f7e04
Merge pull request #15526 from bluca/start_stop_wait_debug
Add debug log when a job in the activation queue is not runnable
2020-04-22 14:24:07 +02:00
Luca Boccassi c03fbd37d6 core: add debug log when a job in the activation queue is not runnable
When a job is skipped due its dependencies not being ready, log
a debug message saying what is holding it back.
This was very useful with transient units timing out to figure
out where the problem was.
2020-04-22 09:58:12 +01:00
Balaji Punnuru f6f4f5fe53 util: return the correct correct wd from inotify helpers
We need to propagate the acquired watch descriptors because our callers
are counting on them.

[Lennart: this is split out of #15381 and simplified]
2020-04-22 08:57:17 +02:00
Lennart Poettering df3d3bdfe8 core: minor error code handling fixes 2020-04-22 08:56:05 +02:00
Zbigniew Jędrzejewski-Szmek 2807b68019
Merge pull request #15520 from mrc0mmand/various-codebase-improvements
tree-wide: various codebase improvements
2020-04-22 08:41:38 +02:00
Frantisek Sumsal 86b52a3958 tree-wide: fix spelling errors
Based on a report from Fossies.org using Codespell.

Followup to #15436
2020-04-21 23:21:08 +02:00
Frantisek Sumsal e4ff03935c tree-wide: formatting tweaks reported by Coccinelle 2020-04-21 23:21:04 +02:00
Dan Streetman 244490f5e0 network: honor SetDNSRoutes= even if UseGateway=False 2020-04-21 17:15:07 -04:00
Dan Streetman 589397a277 network: change UseGateway= default to UseRoutes= setting
Anyone previously using the UseRoutes=false parameter expected their
dhcp4-provided gateway route to be ignored, as well.  However, with
the introduction of the UseGateway= parameter, this is no longer true.

In order to keep backwards compatibility, this sets the UseGateway=
default value to whatever UseRoutes= has been set to.
2020-04-21 16:56:48 -04:00
Luca Boccassi c5bc2c01ee core: add log_get_max_level check optimization in log_unit_full
Just as log_full already does, check if the log level would result in
logging immediately in the macro in order to avoid doing
unnecessary work that adds up in hot spots.
2020-04-21 18:05:24 +01:00
Lennart Poettering 893f801d67 core: implement generic log control API in PID1 too
It has slightly different setters in place, so it needs some special
love, which is easy enough though.
2020-04-21 17:08:23 +02:00
Lennart Poettering 25141692e9 core: use generic implementations of log level/target bus propertier getters
The setters are slightly different, hence keep them as they are for now.
2020-04-21 17:08:23 +02:00
Lennart Poettering ac9f55ed40 tree-wide: implement new log control API dbus interface in all our daemons 2020-04-21 17:08:16 +02:00
Lennart Poettering 4c4520789d resolved: replace private log level control API with generic one
The property was just added, let's replace it again. Given that it was
never released this should not be an API breakage.
2020-04-21 17:08:02 +02:00
Lennart Poettering 052740e2e3 log-control-api: add generic D-Bus interface for querying/setting log level/target
Let's define a new, generic bus interface that any daemon can implement
for querying/setting the log level.

We can turn this into something more powerful later on, but for now,
only expose three properties: the log level, log target and the syslog
identifier (with the former two being writable).

This is supposed to be generic, so that it can be implemented by 3rd
party daemons too, eventually.
2020-04-21 17:07:43 +02:00
Zbigniew Jędrzejewski-Szmek 38b38500c6 tree-wide: use "hostname" spelling everywhere
It's not that I think that "hostname" is vastly superior to "host name". Quite
the opposite — the difference is small, and in some context the two-word version
does fit better. But in the tree, there are ~200 occurrences of the first, and
>1600 of the other, and consistent spelling is more important than any particular
spelling choice.
2020-04-21 16:58:04 +02:00
Lennart Poettering 33b58dfb41 core: automatically add udev dependency for units using RootImage=
We use udev to wait for /dev/loopX devices to be fully proped hence we
need an implicit ordering dependency on it, for RootImage= to work
reliably in early boot, too.

Fixes: #14972
2020-04-21 16:31:06 +02:00
Lennart Poettering f9411d5d5f
Merge pull request #15495 from keszybz/resolve-debugging-and-stub-handling
Resolve debugging and stub handling
2020-04-21 09:34:21 +02:00
Lennart Poettering 543d1e7854
Merge pull request #15314 from keszybz/network-server-access-functions
Define network server access functions
2020-04-21 09:24:48 +02:00
Zbigniew Jędrzejewski-Szmek ca8b81d923 resolve: when the stub listener is disabled, symlink stub-resolv.conf to resolv.conf
When the stub listener is disabled, stub-resolv.conf is useless. Instead of
warning about this, let's just make stub-resolv.conf point to the private
resolv.conf file. (The original bug report asked for "mirroring", but I think
a symlink is nicer than a copy because it is easier to see that a redirection
was made.)

Fixes #14700.
2020-04-20 15:50:40 +02:00
Zbigniew Jędrzejewski-Szmek 965228a846 resolve: when writing of private resolv.confs fails, do not remove old copies
All callers ignore the return value.

This is almost entirely theoretical, since writing to /run is unlikely to
fail..., but the user is almost certainly better off keeping the old copy
around and having working dns resolution with an out-of-date dns server list
than having having a dangling /etc/resolv.conf symlink.
2020-04-20 15:48:05 +02:00
Zbigniew Jędrzejewski-Szmek 5c35cd5f47 resolved: include actual path in error message
An error with a full path is immediately clear. OTOH, a user might not be
familiar with concenpt like "private resolv.conf".

I opted to use %s-formatting for the path, because the code is much easier to
read this way. Any difference in t speed of execution is not important.
2020-04-20 15:43:33 +02:00
Zbigniew Jędrzejewski-Szmek e53b8cc521 resolved: return org.freedesktop.resolve1.DnsError.NXDOMAIN on LLMNR resolution failure
Fixes #14922.
2020-04-20 15:33:18 +02:00
Zbigniew Jędrzejewski-Szmek df9578498f resolve: allow setting the log level dynamically as in pid1
This is useful to raise the log level for a single transaction or a few,
without affecting other state of the resolved as a restart would.
The log level can only be set, I didn't bother with having the ability
to restore the original as in pid1.
2020-04-20 15:33:18 +02:00
Zbigniew Jędrzejewski-Szmek 3d334c40b4 resolved: fix minor confusion in comment
Suffixing != prefixing.
2020-04-20 12:16:56 +02:00
Lennart Poettering 5099fd44ca
Merge pull request #15463 from keszybz/resolvectl-query-formatting
Fix resolvectl query formatting
2020-04-18 15:56:16 +02:00
Lennart Poettering 0d5071fb29
Merge pull request #15444 from poettering/audit-enable
journald: make whether we enable auditing at start-up optional
2020-04-18 15:55:10 +02:00
Lennart Poettering 09f8722801
Merge pull request #15396 from keszybz/dbus-api-docs
D-bus API docs
2020-04-17 23:40:50 +02:00
Jouke Witteveen 1cabd2d0c5 systemctl: hide first column with --plain instead of --no-legend
Hiding the first column, which may contain bullet circles, with --no-legend
is undocumented and potentially unexpected. On the other hand, not printing
bullet circles with --plain is documented so hiding the column with that
switch is sensible.

The combination "--full --no-legend --no-pager --plain" is appropriate for
automated processing of systemctl output.
2020-04-17 19:15:49 +02:00