1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00
Commit Graph

41632 Commits

Author SHA1 Message Date
Franck Bui
1366b81f2b shared/install: failing with -ELOOP can be due to the use of an alias in install_error()
-ELOOP can happen also when enabling an alias name (which is admittedly useless
since the unit it belongs to was already enabled) so let's mention this
possibility when reporting the corresponding error.

(cherry picked from commit 2268367471)
2019-11-19 10:30:21 +01:00
Franck Bui
84d5cd699e shared/install: fix error codes returned by install_context_apply()
(cherry picked from commit 56a4ce2417)
2019-11-19 10:30:12 +01:00
Franck Bui
417779c58a man: alias names can't be used with enable command
(cherry picked from commit faf205de3b)
2019-11-19 10:30:11 +01:00
Dan Streetman
00af6c447f resolved: set stream type during DnsStream creation
The DnsStreamType was added to track different types of DNS TCP streams,
instead of refcounting all of them together.  However, the stream type was
not actually set into the stream->type field, so while the reference count
was correctly incremented per-stream-type, the reference count was always
decremented in the cleanup function for stream type 0, leading to
underflow for the type 0 stream (unsigned) refcount, and preventing new
type 0 streams from being created.

Since type 0 is DNS_STREAM_LOOKUP, which is used to communicate with
upstream nameservers, once the refcount underflows the stub resolver
no longer is able to successfully fall back to TCP upstream lookups
for any truncated UDP packets.

This was found because lookups of A records with a large number of
addresses, too much to fit into a single 512 byte DNS UDP reply,
were causing getaddrinfo() to fall back to TCP and trigger this bug,
which then caused the TCP fallback for later large record lookups
to fail with 'connection timed out; no servers could be reached'.

The stream type was introduced in commit:
652ba568c6

(cherry picked from commit 1c089741d3)
2019-11-19 10:28:31 +01:00
Zbigniew Jędrzejewski-Szmek
66dd9d7d25 sd-device: allow sd_device_get_devtype to be called with NULL arg and do not assert
We shouldn't call assert() on user-specified arguments in public functions.
While at it, let's return 1 if the type exists, and 0 otherwise.

(cherry picked from commit 730b76bd2c)
2019-11-19 10:27:39 +01:00
Zbigniew Jędrzejewski-Szmek
048f9da1a4 Remove unused plymouth_running() function
(cherry picked from commit 8a2c82ac88)
2019-11-19 10:27:27 +01:00
Chen Qi
34fa67bbe7 machine-id-setup: avoid unexpected aborting
Code should not be reached 'Unhandled option' at src/machine-id-setup/machine-id-setup-main.c:97, function parse_argv(). Aborting.
Aborted

This behaviour is not good and will confuse user.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
(cherry picked from commit 4a434023d2)
2019-11-19 10:27:18 +01:00
Zbigniew Jędrzejewski-Szmek
24c99fa2ef test-socket-util: avoid writing past the defined buffer
.sun_path has 108 bytes, and we'd write a string of 108 bytes + NUL.
I added this test, but I don't know what it was supposed to test. Let's
just remove.

Fixes #13713. CID#1405854.

(cherry picked from commit 58ce85f6a1)
2019-11-19 10:26:21 +01:00
Yu Watanabe
ce82233f99 test: drop duplicated 's'
This fixes the following log message
```
Container TEST-07-ISSUE-1981 terminated by signal KILL.
E: test timed out after 30s s
```

(cherry picked from commit 235ecb6d75)
2019-11-19 10:25:54 +01:00
Zbigniew Jędrzejewski-Szmek
75a0e72091 nspawn: fix handling of --console=help
We shouldn't continue to run the container after printing help.

(cherry picked from commit dce66ffedb)
2019-11-19 10:25:18 +01:00
Zbigniew Jędrzejewski-Szmek
f41a282875 Revert "sysusers: properly mark generated accounts as locked"
This reverts the gist of commit 636e72bce6.
The comment and the tiny cleanup are left alone.

We shouldn't lock the accounts because people actually need to use them, and
if they are locked, various tools will refuse.
See https://github.com/systemd/systemd/pull/13277#issuecomment-529964578
and follow-up comments.

(cherry picked from commit 12c829376a)
2019-11-19 10:24:32 +01:00
Marko Myllynen
fc2dceac61 Remove unprintable non-ASCII char from special glyph ASCII fallback table
(cherry picked from commit de52000695)
2019-11-19 10:24:10 +01:00
Zbigniew Jędrzejewski-Szmek
dedf5b511e logind: fix emission of PropertiesChanged for users
The same as parent commit, but users. This is the third and last
foo_object_find() function in logind, so I think that this particular
family of bugs is finally squashed.

(cherry picked from commit 8163b9f900)
2019-11-19 10:13:39 +01:00
Zbigniew Jędrzejewski-Szmek
6e3cfe2e58 logind: fix emission of PropertiesChanged on seats
The story is the same as in 471cffcfb0:
device_attach() → seat_send_changed() → sd_bus_emit_properties_changed_strv()
→ emit_properties_changed_on_interface() → node_vtable_get_userdata()
→ seat_object_find(), which returns 0 because message == NULL.
But when we are emitting a signal, message is always NULL. Removing the
overeager check and assert in the called function allow the signal to be
emitted.

Fixes #13769.

(cherry picked from commit 8cc64c2a36)
2019-11-19 10:13:30 +01:00
Peter Wu
a9152084d7 resolved: fix connection failures with TLS 1.3 and GnuTLS
Prefer TLS 1.3 before TLS 1.2 for DNS-over-TLS support, otherwise
servers compliant with RFC 8446 might end up agreeing TLS 1.2 plus a
downgrade signal which is not expected by GnuTLS clients. This manifests
in the following error:

    Failed to invoke gnutls_handshake: An illegal parameter has been received.

Fixes: #13528
Fixes: v242-962-g9c0624dcdb ("resolved: support TLS 1.3 when using GnuTLS for DNS-over-TLS")
(cherry picked from commit 6880558020)
2019-11-19 10:13:12 +01:00
Zbigniew Jędrzejewski-Szmek
961879ed9d udev: tag any display devices as master-of-seat when nomodeset is used
Fixes #13773. See also https://bugzilla.redhat.com/show_bug.cgi?id=1728240,
https://github.com/sddm/sddm/issues/1204.

When nomodeset is used on the kernel command line, there is no graphics
device that the kernel knows, so we don't tag anything as master-of-seat,
and seat0 has CanGraphical=no.

$ loginctl seat-status seat0 ; loginctl show-seat seat0
seat0
         Devices:
                  ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
                  │ input:input0 "Power Button"
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1
                  │ usb:usb1
                  │ └─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input4
                  │   input:input4 "QEMU QEMU USB Tablet"
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb2
                  │ usb:usb2
                  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card0
                  │ sound:card0 "Intel"
                  ├─/sys/devices/platform/i8042/serio0/input/input1
                  │ input:input1 "AT Translated Set 2 keyboard"
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::capslock
                  │ │ leds:input1::capslock
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::numlock
                  │ │ leds:input1::numlock
                  │ └─/sys/devices/platform/i8042/serio0/input/input1/input1::scrolllock
                  │   leds:input1::scrolllock
                  └─/sys/devices/platform/i8042/serio1/input/input3
                    input:input3 "ImExPS/2 Generic Explorer Mouse"
Id=seat0
CanMultiSession=yes
CanTTY=yes
CanGraphical=no
Sessions=
IdleHint=yes
IdleSinceHint=0
IdleSinceHintMonotonic=0

Let's tag the PCI device with "master-of-seat", so we get CanGraphical=yes, and "seat",
so it is show as part of the seat:

[fedora@f31-bios ~]$ loginctl seat-status seat0 ; loginctl show-seat seat0
seat0
         Devices:
                  ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
                  │ input:input0 "Power Button"
                  ├─/sys/devices/pci0000:00/0000:00:01.0
                  │ [MASTER] pci:0000:00:01.0
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1
                  │ usb:usb1
                  │ └─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input4
                  │   input:input4 "QEMU QEMU USB Tablet"
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb2
                  │ usb:usb2
                  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card0
                  │ sound:card0 "Intel"
                  ├─/sys/devices/platform/i8042/serio0/input/input1
                  │ input:input1 "AT Translated Set 2 keyboard"
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::capslock
                  │ │ leds:input1::capslock
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::numlock
                  │ │ leds:input1::numlock
                  │ └─/sys/devices/platform/i8042/serio0/input/input1/input1::scrolllock
                  │   leds:input1::scrolllock
                  └─/sys/devices/platform/i8042/serio1/input/input3
                    input:input3 "ImExPS/2 Generic Explorer Mouse"
Id=seat0
CanMultiSession=yes
CanTTY=yes
CanGraphical=yes
Sessions=
IdleHint=yes
IdleSinceHint=0
IdleSinceHintMonotonic=0

(cherry picked from commit 0325f71926)
2019-11-19 10:12:56 +01:00
Benjamin Bouvier
8aa7bafa12 systemd-fsck: fix systemd-fsck/fsck pipe bad closure
Currently, when console is disabled but progress is tracked, pipe opened
for communication between systemd-fsck and fsck may be closed
inadvertently (when opening of /dev/console return in error). That lead
to finish fsck prematurely (because it receives a SIGPIPE) and so fsck
may not check correctly filesystems and do not have time to fix memory
corruptions.

This commit changes the opening of /dev/console to be done previously to
pipe creation and so fix the bug described just above.

(cherry picked from commit e4fc745547)
2019-11-19 10:12:38 +01:00
Jonas Jelten
19590e289a ceph is a network filesystem
(cherry picked from commit c4742de6d8)
2019-11-19 10:12:21 +01:00
Luca Boccassi
339606ad9e portabled: allow to detach an image with a unit in linked-runtime state
This is necessary when a directory was attached with
--copy=symlink, otherwise detach will always fail.

Fixed #13725

(cherry picked from commit c3d809ef72)
2019-11-19 10:11:05 +01:00
Yu Watanabe
bd9692734a network: ndisc: do not drop all prefixes when a prefix matches a blacklist
Fixes #13767.

(cherry picked from commit 55d3fdcf5e)
2019-11-19 10:09:49 +01:00
Yu Watanabe
5e6d4f8b79 systemctl: fix memleak caused by wrong cleanup func
(cherry picked from commit 13f697b7b1)
2019-11-19 10:08:18 +01:00
Yu Watanabe
47d0e23d26 udev: fix memleak caused by wrong cleanup function
Fixes #13764.

(cherry picked from commit f4f6f2c740)
2019-11-19 10:05:08 +01:00
Zbigniew Jędrzejewski-Szmek
a6fb0542c5 parse_hwdb: fix compatibility with pyparsing 2.4.*
pyparsing 2.3.1/2.4.0 had some changes to grouping of And matches, and as a
result we'd report 0 properties and 0 matches, and not really do any checks.

With this change we get identical behaviour for pyparsing 2.3.1, 2.4.0, 2.4.2:

$ hwdb/parse_hwdb.py
hwdb/60-evdev.hwdb: 72 match groups, 94 matches, 262 properties
hwdb/60-input-id.hwdb: 3 match groups, 3 matches, 4 properties
hwdb/60-keyboard.hwdb: 173 match groups, 256 matches, 872 properties
Keycode KBD_LCD_MENU1 unknown
Keycode KBD_LCD_MENU4 unknown
Keycode KBD_LCD_MENU2 unknown
Keycode KBD_LCD_MENU3 unknown
hwdb/60-sensor.hwdb: 101 match groups, 120 matches, 105 properties
hwdb/70-joystick.hwdb: 2 match groups, 3 matches, 2 properties
hwdb/70-mouse.hwdb: 104 match groups, 119 matches, 123 properties
hwdb/70-pointingstick.hwdb: 8 match groups, 30 matches, 11 properties
hwdb/70-touchpad.hwdb: 6 match groups, 9 matches, 6 properties

(cherry picked from commit 2382a2e32b)
2019-11-19 10:05:01 +01:00
Zbigniew Jędrzejewski-Szmek
cb1d892f17 parse_hwdb: process files in order
Also, make the pattern more general. There are some plans to add more files
there, let's make sure we don't miss them.

(cherry picked from commit b32ae3aa7b)
2019-11-19 10:04:53 +01:00
Balint Reczey
ef677436aa test: Pass personality test even when i686 userland runs on x86_64 kernel
(cherry picked from commit bd89d03544)
2019-10-10 14:56:01 +02:00
Zbigniew Jędrzejewski-Szmek
3f6398c450 docs: fix inadvertent change in uid range
a305eda35f (r35378755)
(cherry picked from commit 581004bd33)
2019-10-10 14:54:54 +02:00
Mike Kazantsev
25bb377a73 cgroup: fix typo in BPF firewall support warning message
(cherry picked from commit fc103b3e34)
2019-10-10 14:53:23 +02:00
Norbert Lange
6d97aca0d5 fix build with compilers with default stack-protector enabled
building systemd fails with a compiler that supports
-fstack-protector but does not enable it by default.
(will miss several __stack_chk_* symbols).

fix this by also adding the switch during linking.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
(cherry picked from commit 68e70ac2b2)
2019-10-10 14:52:49 +02:00
Nicolas Douma
fbad077cec nspawn: surrender controlling terminal to PID2 when using the PID1 stub
(cherry picked from commit de1b29f375)
2019-10-10 14:52:42 +02:00
Franck Bui
0553c3c668 pid1: fix DefaultTasksMax initialization
Otherwise DefaultTasksMax is always set to "inifinity".

This was broken by fb39af4ce4.

(cherry picked from commit c0000de87d)
2019-10-10 14:51:25 +02:00
Dan Streetman
f406a691a7 src/core/automount: use DirectoryMode when calling mkdir -p
mkdir -p is called both when setting up the autofs mount, as well
as after being notified that the real mount unit should be called.
However the first mkdir -p is hardcoded with 0555, while the second
uses the value specified to DirectoryMode in the automount unit; the
second mkdir -p is only needed when called from coldplug, so under
normal operation the dirs are incorrectly created with mode 0555.

This replaces the hardcoded 0555 mode with the value of DirectoryMode.

Closes #13683.

(cherry picked from commit 8084dcb9d7)
2019-10-10 14:51:14 +02:00
Yu Watanabe
20438f96c3 udevadm trigger: do not propagate EACCES and ENODEV
Inside container, writing file returns EACCESS. Moreover, some devices
return ENODEV rather than EACCES. So, let's also ignore these two
error causes.

Closes #13652.

(cherry picked from commit 67acde4869)
2019-10-10 14:51:01 +02:00
Jonas Thelemann
6480630bc3 hwdb: Correct WWWW Pattern In Documentation Comment
(cherry picked from commit 56783ddf22)
2019-10-10 14:50:15 +02:00
Zbigniew Jędrzejewski-Szmek
9d8e889810 nspawn: consistenly fail if parsing the environment fails
We would parse the environment twice (to re-apply settings after reading
config from disk), but we would not check the return code first time.
This means that for some settings we would ignore invalid values, while
for others, we'd fail at some point.

Let's just consistently fail. Those environment variables define important
aspects of behaviour, and it is better for the user if we ignore invalid
values. (Unknown settings are still ignored, so forward compatibility is
maintained.)

(cherry picked from commit 490486842b)
2019-10-10 14:49:52 +02:00
Zbigniew Jędrzejewski-Szmek
40e169b304 nspawn: default to unified hierarchy if --as-pid2 is used
See comment added in the patch.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1756143.

(cherry picked from commit 75b0d8b89d)
2019-10-10 14:48:39 +02:00
Chris Down
b5df1037a0 cgroup: Mark memory protections as explicitly set in transient units
A later version of the DefaultMemory{Low,Min} patch changed these to
require explicitly setting memory_foo_set, but we only set that in
load-fragment, not dbus-cgroup.

Without these, we may fall back to either DefaultMemoryFoo or
CGROUP_LIMIT_MIN when we really shouldn't.

(cherry picked from commit 184e989d7d)
2019-10-10 14:48:00 +02:00
Chris Down
f14e3e02cc cgroup: Respect DefaultMemoryMin when setting memory.min
This is an oversight from https://github.com/systemd/systemd/pull/12332.

Sadly the tests didn't catch it since it requires a real cgroup
hierarchy to see, and it wasn't seen in prod since we're only currently
using DefaultMemoryLow, not DefaultMemoryMin. :-(

(cherry picked from commit 64fe532e90)
2019-10-10 14:47:40 +02:00
Chris Down
ea248e53bf cgroup: Check ancestor memory min for unified memory config
Otherwise we might not enable it when we should, ie. DefaultMemoryMin is
set in a parent, but not MemoryMin in the current unit.

(cherry picked from commit 7c9d2b7993)
2019-10-10 14:47:31 +02:00
Chris Down
de1d25a506 cgroup: docs: memory.high doc fixups
The docs just tautologically call this the "high limit". Just call it
throttling as we do in cgroup-v2.rst.

(cherry picked from commit ba79e19cb2)
2019-10-10 14:47:19 +02:00
Chris Down
2ab45f38d8 cgroup: docs: Mention unbounded protection for memory.{low,min}
I got asked why Memory{Low,Min} don't allow "infinity". They do, but the
docs don't say that like they already do for Memory{High,Max}.

(cherry picked from commit b62087d4d0)
2019-10-10 14:47:14 +02:00
Kenneth D'souza
19a43dc38a Consider smb3 as remote filesystem
Currently systemd will treat smb3 as local filesystem and cause
can't boot failures. Add smb3 to the list of remote filesystems
to fix this issue.

Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
(cherry picked from commit ff7d6a740b)
2019-10-10 14:47:06 +02:00
Michael Olbrich
5c0224c7bf Handle d_type == DT_UNKNOWN correctly
As documented in the man-page, readdir() may return a directory entry with
d_type == DT_UNKNOWN. This must be handled for regular filesystems.

dirent_ensure_type() is available to set d_type if necessary. Use it in
some more places.

Without this systemd will fail to boot correctly with nfsroot and some
other filesystems.

Closes #13609

(cherry picked from commit 28e68bb235)
2019-10-10 14:47:01 +02:00
Chris Down
8282bc61df util-lib: Don't propagate EACCES from find_binary PATH lookup to caller
On one of my test machines, test-path-util was failing because the
find_binary("xxxx-xxxx") was returning -EACCES instead of -ENOENT. This
happens because the PATH entry on that host contains a directory which
the user in question doesn't have access to. Typically applications
ignore permission errors when searching through PATH, for example in
bash:

    $ whoami
    cdown
    $ PATH=/root:/bin type sh
    sh is /bin/sh

This behaviour is present on zsh and other shells as well, though. This
patch brings our PATH search behaviour closer to other major Unix tools.

(cherry picked from commit 4e1ddb6612)
2019-10-10 14:46:39 +02:00
Yu Watanabe
9d0ae987a6 network: drop noisy log message
Closes #13595.

(cherry picked from commit 55a1729fd0)
2019-10-10 14:46:03 +02:00
cbzxt
f67f0e4ec4 Updated log message when the timesync happens for the first time (#13624)
(cherry picked from commit 37afb0ac78)
2019-10-10 14:45:10 +02:00
Zbigniew Jędrzejewski-Szmek
e151bf4674 units: make systemd-binfmt.service easier to work with no autofs
See https://bugzilla.redhat.com/show_bug.cgi?id=1731772:
when autofs4 is disabled in the kernel,
proc-sys-fs-binfmt_misc.automount is not started, so the binfmt_misc module is
never loaded. If we added a dependency on proc-sys-fs-binfmt_misc.mount
to systemd-binfmt.service, things would work even if autofs4 was disabled, but
we would unconditionally pull in the module and mount, which we don't want to do.
(Right now we ony load the module if some binfmt is configured.)
But let's make it easier to handle this case by doing two changes:
1. order systemd-binfmt.service after the .mount unit (so that the .service
   can count on the mount if both units are pulled in, even if .automount
   is skipped)
2. add [Install] section to the service unit. This way the user can do
   'systemctl enable proc-sys-fs-binfmt_misc.mount' to get the appropriate behaviour.

(cherry picked from commit 508133917d)
2019-10-10 14:44:56 +02:00
Steve Traylen
2b8e574d82 Corect man page reference in systemd-nologin.conf comments
The reference to the man page of `systemd-user-sessions.service`
in the comments of `tmpfiles.d/systemd-nologin.conf` is corrected.

(cherry picked from commit 7a72a95741)
2019-10-10 14:44:24 +02:00
Philip Withnall
a0577353f1 man: Add a missing space in machinectl(1)
Signed-off-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit abdc57dfe1)
2019-10-10 14:44:15 +02:00
Filipe Brandenburger
693e983988 log: Add missing "%" in "%m" log format strings
These were clearly intended to be "%m" to display the human readable version
of the error stored in errno.

(cherry picked from commit 28b77ab246)
2019-10-10 14:44:09 +02:00
Zbigniew Jędrzejewski-Szmek
ea7151b8c4 pid1: do not warn if /run/systemd/relabel-extra.d/ doesn't exist
After all, that is the expected state.

(cherry picked from commit 90b059b608)
2019-10-10 14:42:18 +02:00