Commit Graph

48182 Commits

Author SHA1 Message Date
Lennart Poettering 5e3effb1f3 virt: drop /proc/1/sched hack
On really old kernels (< 4.14+) a bug in /proc/1/sched handling in the
kernel could be used to determine whether we are running in a PID
namespace. This hasn't worked for a long time, and there's little point
in making things work on old kernels we can't make work on current
kernels, hence let's drop that old cruft.

See: #8153
2020-12-09 21:07:46 +01:00
Lennart Poettering 1c36b8bf53 log: add helper set sets log level in all realms
Prompted-by: #17903
2020-12-09 18:26:17 +01:00
Lennart Poettering eef34a1d8f man: document that automount units are privileged
Fixes: #17886
2020-12-09 18:25:32 +01:00
Luca Boccassi 0727a75a3b
Merge pull request #17911 from yuwata/log-cli-program-use-journal
log: open journal when cli program run in a service unit
2020-12-09 14:30:32 +00:00
Luca Boccassi 141d3a14d4
Merge pull request #17882 from poettering/logind-async-close
logind: fix closing of button input devices
2020-12-09 14:27:03 +00:00
Daan De Meyer ecd3c86b60 Silence cgroups v1 read-only filesystem warning
Avoid warning messages when booting systemd-nspawn containers and using
hybrid or legacy cgroups. systemd-nspawn mounts the cgroups v1 controller
tree as read-only so these errors are expected and not problematic.
Partially fixes #17862.

Test plan:

- Before: `mkosi --default .mkosi/mkosi.fedora boot`

```
‣ Processing default...
Spawning container image on /home/daan/projects/systemd/image.raw.
Press ^] three times within 1s to kill container.
systemd 247 running in system mode. (+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
Detected virtualization systemd-nspawn.
Detected architecture x86-64.

Welcome to Fedora 33 (Thirty Three)!

Queued start job for default target Graphical Interface.
-.slice: Failed to migrate controller cgroups from , ignoring: Read-only file system
system.slice: Failed to delete controller cgroups /system.slice, ignoring: Read-only file system
[  OK  ] Created slice system-getty.slice.
[  OK  ] Created slice system-modprobe.slice.
user.slice: Failed to delete controller cgroups /user.slice, ignoring: Read-only file system
[  OK  ] Created slice User and Session Slice.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Reached target Slices.
[  OK  ] Reached target Swap.
[  OK  ] Listening on Process Core Dump Socket.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket.
[  OK  ] Listening on User Database Manager Socket.
dev-hugepages.mount: Failed to delete controller cgroups /dev-hugepages.mount, ignoring: Read-only file system
         Mounting Huge Pages File System...
sys-fs-fuse-connections.mount: Failed to delete controller cgroups /sys-fs-fuse-connections.mount, ignoring: Read-only file system
         Mounting FUSE Control File System...
         Starting Journal Service...
         Starting Remount Root and Kernel File Systems...
system.slice: Failed to delete controller cgroups /system.slice, ignoring: Read-only file system
```

After: `mkosi --default .mkosi/mkosi.fedora boot`

```
‣ Processing default...
Spawning container image on /home/daan/projects/systemd/mkosi.output/image.raw.
Press ^] three times within 1s to kill container.
systemd 247 running in system mode. (+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
Detected virtualization systemd-nspawn.
Detected architecture x86-64.

Welcome to Fedora 33 (Thirty Three)!

Queued start job for default target Graphical Interface.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Created slice system-modprobe.slice.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Reached target Slices.
[  OK  ] Reached target Swap.
[  OK  ] Listening on Process Core Dump Socket.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket.
[  OK  ] Listening on User Database Manager Socket.
         Mounting Huge Pages File System...
         Mounting FUSE Control File System...
         Starting Journal Service...
         Starting Remount Root and Kernel File Systems...
[  OK  ] Mounted Huge Pages File System.
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Finished Remount Root and Kernel File Systems.
         Starting Create Static Device Nodes in /dev...
[  OK  ] Finished Create Static Device Nodes in /dev.
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Restore /run/initramfs on shutdown...
[  OK  ] Finished Restore /run/initramfs on shutdown.
[  OK  ] Started Journal Service.
         Starting Flush Journal to Persistent Storage...
[  OK  ] Finished Flush Journal to Persistent Storage.
         Starting Create Volatile Files and Directories...
[  OK  ] Finished Create Volatile Files and Directories.
         Starting Network Name Resolution...
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Finished Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting Home Area Manager...
         Starting User Login Management...
         Starting Permit User Sessions...
[  OK  ] Finished Permit User Sessions.
[  OK  ] Started Console Getty.
[  OK  ] Reached target Login Prompts.
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Home Area Manager.
[  OK  ] Started User Login Management.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Finished Update UTMP about System Runlevel Changes.
[  OK  ] Started Network Name Resolution.
[  OK  ] Reached target Host and Network Name Lookups.

Fedora 33 (Thirty Three) (built from systemd tree)
Kernel 5.9.11-arch2-1 on an x86_64 (console)
```
2020-12-09 12:37:16 +00:00
Michael Marley 61927b9f11 manager: Fix HW watchdog when systemd starts before driver loaded
When manager_{set|override}_watchdog is called, set the watchdog timeout
regardless of whether the hardware watchdog was successfully initialized.  If
the watchdog was requested but could not be initialized, then instead of
pinging it, attempt to initialize it again.  This ensures that the hardware
watchdog is initialized even if the kernel module for it isn't loaded when
systemd starts (which is quite likely, unless it is compiled in).

This builds on work by @danc86 in https://github.com/systemd/systemd/pull/17460,
but fixes the issue of not updating the watchdog timeout with the actual value
from the hardware.

Fixes https://github.com/systemd/systemd/issues/17838

Co-authored-by: Dan Callaghan <djc@djc.id.au>
Co-authored-by: Michael Marley <michael@michaelmarley.com>
2020-12-09 11:47:22 +00:00
Lennart Poettering f2835dd4a6 logind: use free_and_strdup() where appropriate 2020-12-09 10:09:11 +01:00
Lennart Poettering c74d5fe25d logind: fix closing of button input devices
This is a fix of #17751. Specifically:

1. Sort #include headers again

2. Remove tabs, as per coding style

3. Don't install fds in half-initialized objects

4. Use asynchronous_close() everywhere

That all said:

Quit frankly, I am not convinced we should do all this at all. If
close()ing of these input devices is really that slow, then this should
probably be fixed in the kernel, not worked around in userspace like
this.
2020-12-09 10:08:51 +01:00
Lennart Poettering 1d9aa4d572 async: add trivial cleanup wrapper for asynchronous_close() 2020-12-09 10:07:52 +01:00
Yu Watanabe 13ee939784 log: open journal when cli program run in a service unit
Previously, cli programs like networkctl always use console for logging.
2020-12-09 14:44:02 +09:00
Yu Watanabe db987463fe log: make show_color variable tristate
Should not change any behavior.
2020-12-09 14:44:02 +09:00
Yu Watanabe 5941112e7e log: merge conditions to reduce indentation 2020-12-09 14:44:02 +09:00
Yu Watanabe 9e36b885b8 unit: make systemd-networkd.service support reload command 2020-12-09 12:55:51 +09:00
Yu Watanabe 84f9a68060 mount-util: fix typo 2020-12-09 12:55:14 +09:00
Pavel Hrdina 35e7a62ca3 cgroup: Also set blkio.bfq.weight
Commit [1] added a workaround when unified cgroups are used but missed
legacy cgroups where there is the same issue.

[1] <2dbc45aea7>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2020-12-08 18:15:26 +00:00
Zbigniew Jędrzejewski-Szmek a6e5ad8925
Merge pull request #17871 from yuwata/sd-device-issue-17772
sd-device: keep escaped strings in DEVLINK= property
2020-12-08 10:14:43 +01:00
Daan De Meyer ee2812da8f mkosi: Enable --qemu-headless option for all distros
--qemu-headless configures the generated image and mkosi's qemu
command to connect to the VM via the serial port. This allows
spawning a qemu VM within the user's terminal instead of spawning
a graphical GTK GUI. --qemu-headless sets TERM, COLUMNS and LINES
in serial-getty@ttyS0.service in the container which makes the
terminal in the VM behave almost equivalent to the one on the host.

This change makes testing changes to systemd using mkosi + QEMU a
lot easier compared to before as commands can be executed in the VM
from the comfort of one's terminal compared to the Linux console
available when running via the GTK GUI.
2020-12-08 10:03:25 +01:00
l4gfcm fc5dcf9697
hwdb: add funcional keys for MSI Modern series (tested on Modern 14) (#17880) 2020-12-08 09:57:17 +01:00
Yu Watanabe 78bc702503 man: synthetize(d) -> synthesize(d) 2020-12-08 09:24:11 +01:00
Yu Watanabe e6f8828715 test: add tests for device_new_from_nulstr() 2020-12-08 12:35:51 +09:00
Yu Watanabe 31063db0b4 sd-device: keep escaped strings in DEVLINK= property
This fixes a bug introduced by 87a4d416e5.

Fixes #17772.
2020-12-08 12:35:47 +09:00
Yu Watanabe 6f3ac0d517 sd-device: use set_strjoin()
This slightly changes TAGS= and CURRENT_TAGS= properties:

Before
E: TAGS=:aaa:bbb:

After
E: TAGS=aaa:bbb
2020-12-08 12:28:58 +09:00
Yu Watanabe 4dbce71787 set: introduce set_strjoin() 2020-12-08 12:28:54 +09:00
Luca Boccassi 77613416e0
Merge pull request #17855 from poettering/more-socktops
socket-util: some helpers for various sockopts
2020-12-07 21:15:28 +00:00
Torsten Hilbrich 88fc9c9bad systemd-nspawn: Allow setting ambient capability set
The old code was only able to pass the value 0 for the inheritable
and ambient capability set when a non-root user was specified.

However, sometimes it is useful to run a program in its own container
with a user specification and some capabilities set. This is needed
when the capabilities cannot be provided by file capabilities (because
the file system is mounted with MS_NOSUID for additional security).

This commit introduces the option --ambient-capability and the config
file option AmbientCapability=. Both are used in a similar way to the
existing Capability= setting. It changes the inheritable and ambient
set (which is 0 by default). The code also checks that the settings
for the bounding set (as defined by Capability= and DropCapability=)
and the setting for the ambient set (as defined by AmbientCapability=)
are compatible. Otherwise, the operation would fail in any way.

Due to the current use of -1 to indicate no support for ambient
capability set the special value "all" cannot be supported.

Also, the setting of ambient capability is restricted to running a
single program in the container payload.
2020-12-07 19:56:59 +01:00
Zbigniew Jędrzejewski-Szmek bf20d93750
Merge pull request #17766 from weblate/weblate-systemd-master
Translations update from Weblate
2020-12-07 19:56:13 +01:00
Zbigniew Jędrzejewski-Szmek 7e0079f95f Make support for nscd flushing optional
Fedora will deprecate support for nscd in the upcoming release [1] and plans to
drop it in the next one [2]. At that point we might as well build systemd
without that support too, since there'll be nothing to talk too.

[1] https://fedoraproject.org/wiki/Changes/DeprecateNSCD
[2] https://fedoraproject.org/wiki/Changes/RemoveNSCD
2020-12-07 19:46:02 +01:00
Lennart Poettering 52975f8672 socket-util: add common API for querying socket MTU 2020-12-07 13:46:35 +01:00
Lennart Poettering 4e25d4cf0f socket-util: add getsockopt_int() helper 2020-12-07 13:46:35 +01:00
Lennart Poettering 00ed2fff1a socket-util: add sockopt helper for controlling IP_RECVFRAGSIZE 2020-12-07 13:46:35 +01:00
Zbigniew Jędrzejewski-Szmek e0f90ad988
Merge pull request #17874 from DaanDeMeyer/mkosi-build-verbosity
Reduce mkosi build script verbosity
2020-12-07 10:12:33 +01:00
Yu Watanabe 3c229a9afb nss-resolve: varlink_call() set error_id only when r >= 0
Fixes #17870.
2020-12-07 09:25:39 +01:00
Yu Watanabe a7b6e29c1f network: mtu is neither a boolean nor a pointer 2020-12-07 08:59:21 +01:00
Matt Turner d6c0fdf492 missing: Define several syscall numbers for Alpha arch 2020-12-07 09:22:45 +09:00
Daan De Meyer 09422f9a28 meson: Respect MESON_INSTALL_QUIET
MESON_INSTALL_QUIET is set when --quiet is passed to meson install.
Make sure we check the variable in our custom install scripts and
don't output anything if it is set.
2020-12-06 22:11:11 +00:00
Daan De Meyer 5e577e1737 mkosi: Silence locale checking in mkosi.build
Avoid warning and error logs from locale charmap and export LC_CTYPE
by piping to dev/null and checking if locales are available before
using them.
2020-12-06 22:11:11 +00:00
Daan De Meyer 3dab2a4697 mkosi: Remove explicit default_hierarchy=unified option from mkosi.build
default_hierarchy is set to unified in meson_options already so
we can remove it from mkosi.build.
2020-12-06 22:11:11 +00:00
Daan De Meyer fe2b7631ad mkosi: Add --quiet and --no-rebuild options to meson install in mkosi.build
By default, meson install prints a line for every file it installs.
This is verbose and doesn't provide much value. Let's silence the
meson install step to remove this output from the mkosi build step.

The --no-rebuild option removes some additional duplicate output
by the meson install step.

Ubuntu Focal still has meson 0.53.0 so we add a version check and
only use the new feature if the meson version supports it.
2020-12-06 22:11:11 +00:00
Daan De Meyer 1394a3ec35 mkosi: Remove bash -x option from mkosi.build
-x is for debugging purposes. During regular usage, using -x mostly
prints useless output when building the mkosi image.
2020-12-06 22:11:11 +00:00
Daan De Meyer 06ac1b1f2c mkosi: Use meson install instead of ninja install in build script
Allows using extra options not available when using ninja.
2020-12-06 22:11:11 +00:00
Luca Boccassi bf2d8c03c1
Merge pull request #17760 from mrc0mmand/revert-semaphore-timedated
Revert "semaphore: temporarily disable the timedated test suite"
2020-12-05 11:12:35 +00:00
Daan De Meyer 77f16dbd6d Don't assume /run/systemd exists when creating unit-root
When running tests in a mkosi container, /run/systemd might not
exist yet in the container which causes test-execute to fail.

Fixes #17842.
2020-12-05 11:11:58 +00:00
Luca Boccassi f1027d7c28
Merge pull request #17787 from DaanDeMeyer/mkosi-boot-tests
CI: Add mkosi boot tests
2020-12-04 23:38:29 +00:00
Daan De Meyer 448d3462b0 CI: Add mkosi boot tests
Using the new mkosi Github Action, we can add some simple boot tests
for the systemd mkosi configs. This makes sure these keep working
as expected.
2020-12-04 22:24:12 +00:00
Daan De Meyer 8f2c4c5e93 mkosi: Add findutils to Fedora config
find is needed by test_exec_dynamicuser.
2020-12-04 22:24:12 +00:00
Daan De Meyer 8d036c446a mkosi: Add rpm to Fedora BuildPackages as it's needed by pkg-config 2020-12-04 20:06:03 +00:00
Frantisek Sumsal 6df7d18090 Revert "semaphore: temporarily disable the timedated test suite"
This reverts commit ed9192bb55.
2020-12-04 18:47:12 +01:00
Lennart Poettering 62ea0ed08d dissect: don't declare unused variables on archs that have no GPT discovery
Fixes: #17839
2020-12-04 17:50:18 +01:00
Yu Watanabe 402506cea5 socket-util: make several socket_set_xxx() functions inline 2020-12-04 17:49:55 +01:00