Commit Graph

45855 Commits

Author SHA1 Message Date
David Edmundson d7d717b7e2 docs: Document xdg-autostart parameter X-systemd-skip 2020-07-20 16:03:47 +02:00
Zbigniew Jędrzejewski-Szmek 4c0668bc14
Merge pull request #16478 from bluca/dissect_tests
Expand TEST-50-DISSECT to cover dm-verity features
2020-07-20 12:59:56 +02:00
Benjamin Berg 6a097936b2 docs: Update section about XDG autostart generator
The generator is already merged. So update the corresponding section to
describe the current status.
2020-07-20 12:46:56 +02:00
Zbigniew Jędrzejewski-Szmek e6791b5522
Merge pull request #16497 from DaanDeMeyer/mkosi
mkosi: Keep mkosi.default out of the repository
2020-07-20 09:03:51 +02:00
Zbigniew Jędrzejewski-Szmek 7e8279c0a6
Merge pull request #16501 from yuwata/udev-fix-renaming
udev: fix issues in renaming interface vs alternative names
2020-07-20 09:00:02 +02:00
Franck Bui 0ef1adf512 vconsole-setup: downgrade log message when setting font fails on dummy console
Since commit 883eb9be98, vconsole-setup might be
called again to operate on dummy console where font operations are not
supported but where it's still important to have the correct keymap set [0][1].

vconsole-setup is mainly called by udev but can also be run via a dependency of
an early service. Both cases might end up calling vconsole-setup on the dummy
console.

The first case can happen during early boot even on systems that use (instead
of the dummy console) a "simple" video console driver supporting font
operations (such as vgacon) until a more specific driver (such as i915) takes
the console over. While this is happening vgacon is deactivated and temporarly
replaced by the dummy console [2].

There are also other cases where systemd-vconsole-setup might be called on
dummy console especially during (very) early boot. Indeed
systemd-vconsole-setup.service might be pulled in by early interactive services
such as 'dracut-cmdline-ask.service` which is run before udev.

If that happens on platforms with no grapical HWs (such as embedded ARM) or
with dummy console initially installed until a driver takes over (like Xen and
xen-fbfront) then setting font will fail.

Therefore this patch downgrades the log message emitted when setting font fails
to LOG_DEBUG and when font operations is not implemented like it's the case for
the dummy console.

Fixes: #16406.

[0] https://github.com/systemd/systemd/issues/10826
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1652473
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/vga/vgaarb.c?h=v5.7#n204
2020-07-20 08:15:50 +02:00
Yu Watanabe 628f08b66d sd-netlink: make timeout message sealed
When sd_netlink_call_async() timed out, then we reply the synthetic
error message, but it was not sealed. So, reading the message causes
the following assertion:

```
Assertion 'm->sealed' failed at src/libsystemd/sd-netlink/netlink-message.c:652, function netlink_message_read_internal(). Ignoring.
```
2020-07-20 07:49:55 +02:00
Zbigniew Jędrzejewski-Szmek d735e4f2d6
Merge pull request #16505 from yuwata/network-manage-foreign-routes-cleanups
network: do not enumerate foreign routes when ManageForeignRoutes=no, and tiny cleanups
2020-07-20 07:48:57 +02:00
Luca Boccassi ed4512d009 nspawn: set container_host env vars before user arguments
Allows users on the command line to seamlessly override
$container_host_* just like they can override $container_id and
$container
2020-07-20 07:28:22 +02:00
YmrDtnJu a9c9b18a95 networkd: Use NLM_F_ACK on the netlink message to add a neighbor.
sd_netlink_message_set_flags is called without NLM_F_ACK which results in
a timeout while networkd is waiting for an ACK that the kernel will never send.
2020-07-20 11:30:35 +09:00
Norbert Lange d3f45d130e clang-format: set Break afer enum to false
if set to true, the opening bracket will be moved to the next line.
2020-07-19 15:44:04 +02:00
Yu Watanabe 4573592ddf
Merge pull request #16512 from keszybz/offline-passwd-altfiles
Support alternate passwd/group locations in tmpfiles
2020-07-19 06:46:05 +09:00
Zbigniew Jędrzejewski-Szmek 241947d1b4 shared/offline-passwd: look at /usr/lib/{passwd,group} too
This changes the code to allow looking at multiple files with different
prefixes, but uses "/etc" and "/usr/lib". rpm-ostree uses
/usr/lib/{passwd,group} with nss-altfiles. I see no harm in simply trying both
paths on all systems.

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

A minor memory leak is fixed: hashmap_put() returns -EEXIST is the key is
present *and* and the value is different. It return 0 if the value is the
same. Thus, we would leak the user/group name if it was specified multiple
times with the same uid/gid. I opted to remove the warning message completely:
with multiple files it is reasonable to have the same name defined more than
once. But even with one file the warning is dubious: all tools that read those
files deal correctly with duplicate entries and we are not writing a linter.
2020-07-18 14:14:19 +02:00
Zbigniew Jędrzejewski-Szmek 3e5d2264b5 Move offline-password.[ch] to shared and add test-offline-passwd
The test binary has two modes: in the default argument-less mode, it
just checks that "root" can be resolved. When invoked manually, a root
prefix and user/group names can be specified.
2020-07-18 14:14:19 +02:00
Norbert Lange 55678b9eae build: skip installation of 2 files if feature is disabled
dont install systemd-update-utmp if utmp is disabled.
dont install systemd-initctl.service if sysv is disabled.
2020-07-18 13:50:39 +09:00
Yu Watanabe 0119ab3d6c
Merge pull request #16476 from keszybz/qemu-autosuspend-rules
Add autosuspend rules for emulated QEMU devices
2020-07-18 09:10:20 +09:00
Yu Watanabe a8c10331b4 network: replace NDISC -> NDisc in log messages 2020-07-18 05:51:41 +09:00
Yu Watanabe 5eec0a0810 network: introduce address_exists() helper function 2020-07-18 05:51:41 +09:00
Yu Watanabe d15818f227 network: update debug log when foreign routes are received with ManageForeignRoutes=no 2020-07-18 05:51:41 +09:00
Yu Watanabe 5ff1ef31f2 network: do not enumerate routes if ManageForeignRoutes=no 2020-07-18 05:51:32 +09:00
Yu Watanabe 97fdae33df udev: do not try to reassign alternative names
Setting alternative names may fail if some of them are already assigned.
2020-07-17 21:36:11 +09:00
Yu Watanabe 434a348380 netlink: do not fail when new interface name is already used as an alternative name
When renaming a network interface, the new name may be used as an
alternative name. In that case, let's swap the current name and the
alternative name. That is, first drop the new name from the list of
alternative names, then rename the interface, finally set the old name
as an alternative name.
2020-07-17 21:31:47 +09:00
Yu Watanabe 1498252614 netlink: introduce rtnl_get/delete_link_alternative_names() 2020-07-17 21:29:13 +09:00
Zbigniew Jędrzejewski-Szmek 77547d5313 hwdb: check that uppercase digits are used in modalias patterns
This is all confusing as hell, becuase in some places lowercase hexadecimal
digits are used, and in other places uppercase. This adds a check for the
most common case that we and others got wrong.

I tried to extend the general grammar in hwdb_grammar() to include this check,
but it quickly became very complicated and didn't seem to work properly. Doing
initial parsing with more general rules is easier and also seems to give better
error messages:

/home/zbyszek/src/systemd-work/build/../hwdb.d/60-autosuspend.hwdb: 3 match groups, 5 matches, 3 properties
Pattern 'v058fp9540*' is invalid: Expected W:(0123...), found 'f'  (at char 4), (line:1, col:5)
2020-07-17 11:15:58 +02:00
Yu Watanabe 7f16ef9fba
Merge pull request #16490 from yuwata/network-radv-ndisc-cleanups
network: cleanups for radv and ndisc
2020-07-17 15:12:53 +09:00
Zbigniew Jędrzejewski-Szmek 457763aa03 hwdb: allow spaces in usb: matches and similar patterns
In the past we didn't have any matches like that, so the parser was stricter
than necessary, but now we have, so allow that.
2020-07-17 07:44:10 +02:00
Zbigniew Jędrzejewski-Szmek dc9e9a18be
Merge pull request #16491 from keszybz/udev-logging
Improvements to udev logging and related code
2020-07-17 07:12:58 +02:00
Daan De Meyer e5f0010659 mkosi: Update help comment in settings files 2020-07-16 21:44:57 +01:00
Daan De Meyer 172ad053ff mkosi: Keep mkosi.default out of the repository.
Defaulting to fedora makes it a pain to override mkosi.default
point to one of the other mkosi settings files. Instead, have
every developer manually add the symlink to his distro
of choice and don't commit the symlink to the repository by
putting it in the .gitignore.
2020-07-16 21:44:02 +01:00
Zbigniew Jędrzejewski-Szmek 9e79123884 tree-wide: use SYNTHETIC_ERRNO with log_device_* in more places 2020-07-16 22:08:12 +02:00
Zbigniew Jędrzejewski-Szmek 46d4149d0f sd-device: use LOG_PRI() in log_device_full()
We use LOG_PRI() in all log_*() functions, so let's do that here too for
consistency. Effectively this doesn't change anything since we only use
LOG_{INFO,DEBUG,...} as the argument.
2020-07-16 22:05:21 +02:00
Anita Zhang b5ef66101a analyze: CAP_RAWIO -> CAP_SYS_RAWIO
Fixes #16489
2020-07-16 21:14:59 +02:00
Zbigniew Jędrzejewski-Szmek ec8bebbcc2 Add autosuspend rules for emulated QEMU devices
This effectively partially reverts "rules: remove all power management from
udev" / e2452eef02. The rules for emulated QEMU
hardware were removed in one fell swoop with other rules which were causing
problems. But the qemu rules were working properly (and were adjusted through
patches over time). Nowadays we have a hwdb for this, so add hwdb entries using
the new detailed modalias.

https://github.com/systemd/systemd/pull/353#issuecomment-658810289
2020-07-16 19:00:26 +02:00
Zbigniew Jędrzejewski-Szmek df7667323d udev: change the modalias string for usb devices to include the device name
When the kernel does not provide a modalias, we generate our own for usb devices.
For some reason, we generated the expected usb:vXXXXpYYYY string, suffixed by "*".
It was added that way already in 796b06c21b, but I
think that was a mistake, and Kay was thinking about the match pattern instead
of the matched string.

For example, for a qemu device:
old: "usb:v0627p0001*"
new: "usb:v0627p0001:QEMU USB Tablet"

On the match side, all hwdb files in the wild seem to be using match patterns
with "*" at the end. So we can add more stuff to our generated modalias with
impunity.

This will allow more obvious and more certain matches on USB devices. In
principle the vendor+product id should be unique, but it's only 8 digits, and
there's a high chance of people getting this wrong. And matching the wrong
device would be quite problematic. By including the name in the match string we
make a mismatch much less likely.
2020-07-16 19:00:26 +02:00
Zbigniew Jędrzejewski-Szmek d6d4961b01 udev: don't complain when udev_watch_end() is called without udev_watch_init()
E.g. udevadm test prints "Invalid inotify descriptor." which is
meaningless without any context. I think it should be OK to call udev_watch_end()
from a cleanup path without any warning (even at debug level).
2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek 6b9f5f01cb basic/string-table: reduce variable scope 2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek 5992f362bf udevadm: use STR_IN_SET(), add comment 2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek fe20121a4c sd-device: use strjoin instead of asprintf
strjoin should be faster for string concatenation.
Also drop "_"-prefix from function prototypes.
2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek 22ba4525d3 udev: tweak debug logs for udev rules
We shouldn't say "ignoring" when running a program because the result is used for
the match/nomatch result of the rule.
2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek 12254ccab0 man: add more details for IMPORT, PROGRAM and RUN keys
967de8face added a note that I found very hard
to understand. Reword it, and also describe how IMPORT and PROGRAM are different
from RUN.

Minor markup adjustements too.
2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek ba60127df7 udev: accept OPTIONS+= without any fuss
There is no reason to consider this wrong. In fact one could argue that +=
is more appropriate, because we always add to options, and not replace previous
assignments. If we output a debug message, we implicitly ask people to "fix" this,
and we shouldn't.

Also, all our rules use += right now.
2020-07-16 18:38:03 +02:00
Zbigniew Jędrzejewski-Szmek b6a80b83bc udev: accept IMPORT{}= without any fuss
Udev logs are full of messages about wrong operator type:
...
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
/usr/lib/udev/rules.d/60-persistent-storage.rules:30 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:30 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:30 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:30 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:30 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:30 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:54 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:57 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:60 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:63 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:66 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:67 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:93 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:107 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:110 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-storage.rules:113 IMPORT key takes '==' or '!=' operator, assuming '=='.
Reading rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
/usr/lib/udev/rules.d/60-persistent-v4l.rules:7 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-v4l.rules:9 IMPORT key takes '==' or '!=' operator, assuming '=='.
/usr/lib/udev/rules.d/60-persistent-v4l.rules:16 IMPORT key takes '==' or '!=' operator, assuming '=='.
...

The warning was downgraded in f0beb6f816, but I
think it should be removed altogether. IMPORT{program}="asdf" seems like an
obvious way to write this, and people don't expect to have to write "==".
So let's just allow any operator.
2020-07-16 18:38:03 +02:00
Yu Watanabe 13e8a49a58 network: ndisc: any failures in processing event make the link in failed state
Also adjust log levels.
2020-07-17 01:18:44 +09:00
Yu Watanabe c97785168b network: radv: clean up conf parsers 2020-07-17 01:16:38 +09:00
Zbigniew Jędrzejewski-Szmek 19b4864346 hwdb/autosuspend: add missing parenthesis 2020-07-16 18:06:35 +02:00
Yu Watanabe d96edb2c6e network: downgrade log level in conf parsers 2020-07-17 00:40:09 +09:00
Lennart Poettering 4d939d2c84
Merge pull request #16485 from bluca/nspawn_os_release_mounts
Follow-up for comments on #15891
2020-07-16 15:09:35 +02:00
Yu Watanabe 9e54462cd5
Merge pull request #16482 from poettering/coverity-246
two coverity fixes
2020-07-16 20:23:23 +09:00
Luca Boccassi 14f1c47a0c nspawn: mount os-release in two steps to make it read-only
The kernel interface requires setting up read-only bind-mounts in
two steps, the bind first and then a read-only remount.
Fix nspawn-mount, and cover this case in the integration test.

Fixes #16484
2020-07-16 09:59:59 +01:00
Luca Boccassi eafc7d6056 nspawn: use access/F_OK instead of stat to check for file existence 2020-07-16 09:59:59 +01:00