]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agobootctl: do not update sd-boot if it wasn't installed in the first place 22082/head
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 09:56:50 +0000 (10:56 +0100)] 
bootctl: do not update sd-boot if it wasn't installed in the first place

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

3 years agobootctl: split out the check whether sd-boot is installed
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 09:49:37 +0000 (10:49 +0100)] 
bootctl: split out the check whether sd-boot is installed

3 years agoboot: Fix readdir_harder() on VirtualBox
Jan Janssen [Mon, 10 Jan 2022 10:16:26 +0000 (11:16 +0100)] 
boot: Fix readdir_harder() on VirtualBox

Fixes: #22073
3 years agoMerge pull request #22050 from wat-ze-hex/bpf-lsm-check-for-link-error-2022-01-07
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jan 2022 20:38:56 +0000 (21:38 +0100)] 
Merge pull request #22050 from wat-ze-hex/bpf-lsm-check-for-link-error-2022-01-07

bpf: check if lsm link ptr is libbpf error

3 years agoboot: Change boot entry sorting
Jan Janssen [Tue, 4 Jan 2022 12:00:37 +0000 (13:00 +0100)] 
boot: Change boot entry sorting

There are a few undesirable properties to how boot entries are
currently sorted.

First, it sorts by entry file name only, which may not correspond
to the title that is shown (for exmaple because it is prefixed by
machine-id). The file ending will also create unexpected ordering
("arch-lts.conf" would come before "arch.conf").

While the list is sorted alphabetically ascending, it is also
lower version/priority first, which is unintuitive. In particular,
a boot-counted entry that is bad (0 tries left) will be at the very
top.

Additionally, the Windows and Mac loaders should be sorted with
the rest of the loaders.

3 years agoMerge pull request #22071 from keszybz/xdg-autostart-logs
Luca Boccassi [Mon, 10 Jan 2022 16:55:14 +0000 (16:55 +0000)] 
Merge pull request #22071 from keszybz/xdg-autostart-logs

Improve logs in systemd-xdg-autostart-generator

3 years agoMerge pull request #22070 from keszybz/rm-rf-wip
Luca Boccassi [Mon, 10 Jan 2022 15:35:42 +0000 (15:35 +0000)] 
Merge pull request #22070 from keszybz/rm-rf-wip

Simplify recursive removal code and replace stack recursion with a heap queue

3 years agodocs: fix typo in key name and adjust grammar a bit 22071/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jan 2022 11:07:20 +0000 (12:07 +0100)] 
docs: fix typo in key name and adjust grammar a bit

3 years agoxdg-autostart-generator: rework debug logging
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jan 2022 11:06:38 +0000 (12:06 +0100)] 
xdg-autostart-generator: rework debug logging

The logs used the service name as the primary log key. But the service name
often needs to contain escape symbols, and the logs are rather hard to read
because of this. Thus the logs are changed to use the path to the source
desktop file. I think this is much more useful because the user will want to
look at the source file too and maybe change it if something goes wrong.

A bit more logging to show which directories we are looking at and why we
skip certain units is added too.

$ rm -rf /tmp/out && mkdir /tmp/out && SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_TARGET=console build/systemd-xdg-autostart-generator /tmp/{out,out,out}
Scanning autostart directory "/home/zbyszek/.config/autostart"…
Scanning autostart directory "/etc/xdg/autostart"…
/etc/xdg/autostart/tracker-miner-rss-3.desktop: not generating unit, marked as skipped by generator.
/etc/xdg/autostart/gnome-initial-setup-first-login.desktop: ExecCondition executable gnome-systemd-autostart-condition not found, unit will not be started automatically: No such file or directory
/etc/xdg/autostart/geoclue-demo-agent.desktop: symlinking app-geoclue\x2ddemo\x2dagent@autostart.service in xdg-desktop-autostart.target/.wants…
SELinux enabled state cached to: disabled
Directory "/tmp" already exists, but has mode 0777 that is too permissive (0755 was requested), refusing.
/etc/xdg/autostart/polkit-mate-authentication-agent-1.desktop: symlinking app-polkit\x2dmate\x2dauthentication\x2dagent\x2d1@autostart.service in xdg-desktop-autostart.target/.wants…
/etc/xdg/autostart/mate-settings-daemon.desktop: symlinking app-mate\x2dsettings\x2ddaemon@autostart.service in xdg-desktop-autostart.target/.wants…
/etc/xdg/autostart/user-dirs-update-gtk.desktop: symlinking app-user\x2ddirs\x2dupdate\x2dgtk@autostart.service in xdg-desktop-autostart.target/.wants…
/etc/xdg/autostart/org.freedesktop.problems.applet.desktop: symlinking app-org.freedesktop.problems.applet@autostart.service in xdg-desktop-autostart.target/.wants…
/etc/xdg/autostart/org.gnome.SettingsDaemon.Datetime.desktop: not generating unit, startup phases are not supported.
/etc/xdg/autostart/org.gnome.SettingsDaemon.XSettings.desktop: not generating unit, startup phases are not supported.
/etc/xdg/autostart/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop: symlinking app-org.gnome.SettingsDaemon.DiskUtilityNotify@autostart.service in xdg-desktop-autostart.target/.wants…
/etc/xdg/autostart/gnome-initial-setup-copy-worker.desktop: not generating unit, startup phases are not supported.
/etc/xdg/autostart/org.gnome.Evolution-alarm-notify.desktop: symlinking app-org.gnome.Evolution\x2dalarm\x2dnotify@autostart.service in xdg-desktop-autostart.target/.wants…
/etc/xdg/autostart/tracker-miner-fs-3.desktop: not generating unit, marked as skipped by generator.
/etc/xdg/autostart/orca-autostart.desktop: ExecCondition executable gnome-systemd-autostart-condition not found, unit will not be started automatically: No such file or directory
...

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=2038750.

The return value from xdg_autostart_service_generate_unit() is ignored by the
caller, so we can do a shortcut return without functional change. This is nicer
because we're now consistently always returning an error if something failed.

3 years agoMerge pull request #22019 from lnussel/shutdown
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jan 2022 12:10:57 +0000 (13:10 +0100)] 
Merge pull request #22019 from lnussel/shutdown

shutdown command fixes

3 years agoxdg-autostart-generator: make parameter const
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jan 2022 11:02:03 +0000 (12:02 +0100)] 
xdg-autostart-generator: make parameter const

3 years agomeson: no longer skip dependencies when fuzzers are built locally
Evgeny Vereshchagin [Sun, 9 Jan 2022 21:52:14 +0000 (21:52 +0000)] 
meson: no longer skip dependencies when fuzzers are built locally

to make it easier to fuzz code that uses external libraries like libelf/libdw.

The dependencies are skipped on OSS-Fuzz because they aren't available
at runtime if they aren't linked statically. This restriction can safely
be lifted when the fuzzers are built locally with all the dependencies
installed. As far as I know there is at least one fuzz target in the systemd
repository that can benefit from this: https://github.com/systemd/systemd/issues/11018

3 years agosystemctl: consistent output for scheduled shutdowns 22019/head
Ludwig Nussel [Wed, 5 Jan 2022 12:17:50 +0000 (13:17 +0100)] 
systemctl: consistent output for scheduled shutdowns

Use same terms when scheduling and showing sheduled shutdowns.

3 years agobpf: fix bpf_can_link_lsm_program condition 22050/head
Julia Kartseva [Mon, 10 Jan 2022 05:35:35 +0000 (21:35 -0800)] 
bpf: fix bpf_can_link_lsm_program condition

Since bpf_can_link_lsm_program return value is boolean, the expression
`r < 0` is always false.

3 years agobpf: adjust comment about not calling sym_bpf_link__destroy
Zbigniew Jędrzejewski-Szmek [Sun, 9 Jan 2022 18:53:22 +0000 (19:53 +0100)] 
bpf: adjust comment about not calling sym_bpf_link__destroy

3 years agobpf: check if lsm link ptr is libbpf error
Julia Kartseva [Fri, 7 Jan 2022 23:02:57 +0000 (15:02 -0800)] 
bpf: check if lsm link ptr is libbpf error

BPF_RAW_TRACEPOINT_OPEN is expected to work only on x86 and x86_64,
since BPF trampoline is implemented only on these architectures.

Attach probing by bpf_program__attach_lsm already happens in
`bpf_lsm_supported`. The resulting pointer can store libbpf error and
that is the case for unsupported architectures.
Add libbpf error check to `bpf_lsm_supported` so execution does not
reach the point where unit startup fails.

3 years agounits: start systemd-resolved in basic.target
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 16:23:37 +0000 (17:23 +0100)] 
units: start systemd-resolved in basic.target

In the olden days systemd-resolved used dbus and it didn't make sense to start
it before dbus which is started fairly late. But we have mostly ported resolved
over to varlink. The queries from nss-resolve are done using varlink, so name
resolution can work without dbus. resolvectl still uses dbus, so e.g. 'resolvectl
query' will not work, but by starting systemd-resolved earlier we're not making this
any worse.

If systemd-resolved is started after dbus, it registers the name and everything
is fine. If it is started before dbus, it'll watch for the dbus socket and
connect later. So it should be fine to start systemd-resolved earlier. (If dbus
is stopped and restarted, unfortunately systemd-resolved does not reconnect.
This seems to be a small bug: since our daemons know how to watch for
dbus.socket, they could restart the watch if they ever lose the connection. But
this scenario shouldn't happen in normal boot, and restarting dbus is not
supported anyway.)

Moving the start earlier the following advantages:
- name resolution becomes availabe earlier, in particular for synthesized
  hostnames even before the network is up.
- basic.target is part of initrd.target, so systemd-resolved will get started
  in the initrd if installed. This is required for nfs-root when the server is
  specified using a name (https://bugzilla.redhat.com/show_bug.cgi?id=2037311).

3 years agoboot-timestamps: Discard firmware init time when running in a VM
Jan Janssen [Sun, 9 Jan 2022 13:22:15 +0000 (14:22 +0100)] 
boot-timestamps: Discard firmware init time when running in a VM

Fixes: #22060
3 years agobpf: actually skip RestrictFileSystems= when not supported
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 18:24:49 +0000 (19:24 +0100)] 
bpf: actually skip RestrictFileSystems= when not supported

Units would fail to start, incl. systemd-journald.service and systemd-udevd.service.
Since unit->manager->restrict_fs will be set if and only if we can use it,
we can just check for that and remove the other checks.
Follow-up for 299d9417238e0727a48ebaabb5a9de0c908ec5c8.

3 years agotest: explicitly configure oomd stuff via dropins
Frantisek Sumsal [Thu, 6 Jan 2022 20:37:21 +0000 (21:37 +0100)] 
test: explicitly configure oomd stuff via dropins

so we don't get overridden by distro-shipped ones.

Fixes: #22030
3 years agotest: store empty files rather than symlinks for test-fstab-generator
Luca Boccassi [Sun, 9 Jan 2022 14:00:25 +0000 (14:00 +0000)] 
test: store empty files rather than symlinks for test-fstab-generator

Dangling symlinks get pruned when packaging up the installation
directory. Just store empty files instead, and compare the names
rather than the content for .requires/.wants - the filename is
what is important anyway, the content is ignored.

Fixes #22059

3 years agomeson: Use files() for source lists for boot and fundamental
Jan Janssen [Fri, 7 Jan 2022 20:55:50 +0000 (21:55 +0100)] 
meson: Use files() for source lists for boot and fundamental

This fixes build reproducibility as otherwise the full path
of the source files ends up in the output binary.

3 years agoMerge pull request #22028 from medhefgo/boot-cleanup
Luca Boccassi [Sun, 9 Jan 2022 15:44:55 +0000 (15:44 +0000)] 
Merge pull request #22028 from medhefgo/boot-cleanup

boot: Cleanup

3 years agocore: teach LoadCredential= to load from a directory
Albert Brox [Sat, 24 Jul 2021 16:38:22 +0000 (12:38 -0400)] 
core: teach LoadCredential= to load from a directory

3 years agoMerge pull request #22044 from keszybz/minor-man-page-adjustments
Luca Boccassi [Fri, 7 Jan 2022 22:14:30 +0000 (22:14 +0000)] 
Merge pull request #22044 from keszybz/minor-man-page-adjustments

Minor man page adjustments

3 years agoman: adjust chart in bootup(5) 22044/head
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 16:06:54 +0000 (17:06 +0100)] 
man: adjust chart in bootup(5)

The style used for that one branch was inconsistent with other branches.

3 years agoman: refer to os-release(5) for description of files in the same format
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 15:38:18 +0000 (16:38 +0100)] 
man: refer to os-release(5) for description of files in the same format

3 years agoman: add missing example title in systemd.network(5)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 08:52:19 +0000 (09:52 +0100)] 
man: add missing example title in systemd.network(5)

Also rename the file to match the example being extended.

3 years agoseccomp: move arch_prctl to @default
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 14:23:55 +0000 (15:23 +0100)] 
seccomp: move arch_prctl to @default

It was reported as used by the linker:

> [It is] called in the setup of ld-linux-x86-64.so.2 from _dl_sysdep_start.
> My local call stack (with LTO):
>
> #0 init_cpu_features.constprop.0 (/usr/lib64/ld-linux-x86-64.so.2)
> #1 _dl_sysdep_start (/usr/lib64/ld-linux-x86-64.so.2)
> #2 _dl_start (/usr/lib64/ld-linux-x86-64.so.2)
> #3 _start (/usr/lib64/ld-linux-x86-64.so.2)
>
> Looking through the source, I think it's this (links for glibc 2.34):
> - First dl_platform_init calls _dl_x86_init_cpu_features, a wrapper for init_cpu_features.
> - Then init_cpu_features calls get_cet_status.
> - At last, get_cet_status invokes arch_prctl.

Fixes #22033.

3 years agoman: correct minor mistakes in systemd-creds
Morten Linderud [Fri, 7 Jan 2022 14:50:05 +0000 (15:50 +0100)] 
man: correct minor mistakes in systemd-creds

Signed-off-by: Morten Linderud <morten@linderud.pw>
3 years agoMerge pull request #22013 from yuwata/fstab-generator-skip-nfsroot
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 15:02:19 +0000 (16:02 +0100)] 
Merge pull request #22013 from yuwata/fstab-generator-skip-nfsroot

fstab-generator: skip root directory handling when nfsroot is requested

3 years agokernel-install: prefer /boot over /boot/efi for $BOOT_ROOT
Adam Williamson [Wed, 5 Jan 2022 22:07:14 +0000 (14:07 -0800)] 
kernel-install: prefer /boot over /boot/efi for $BOOT_ROOT

This restores the preference order from before 9e82a74. The code
previous to that change 'preferred' /boot over /boot/efi; that
commit changed it to check /boot/efi before checking /boot.
Changing this precedence could (and did, for me) have unexpected
effects - it seems safer to leave it how it was.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
3 years agohomed: stop before stopping dbus
Markus Weippert [Tue, 4 Jan 2022 12:56:11 +0000 (13:56 +0100)] 
homed: stop before stopping dbus

Otherwise, systemd-homed-active.service will fail to deactivate all
homes because homectl can no longer talk to homed if dbus stops first.
As a result, /home cannot be umounted.

Doing this on systemd-homed-active.service instead works as well, but
systemd-homed will exit 1 if dbus is already shut down.

3 years agoMerge pull request #22006 from yuwata/on-ac-power
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 13:28:19 +0000 (14:28 +0100)] 
Merge pull request #22006 from yuwata/on-ac-power

udev-util: ignore USB-C ports in power source mode

3 years agobpf: do not freeze if bpf lsm fails to set up
Julia Kartseva [Thu, 6 Jan 2022 00:34:56 +0000 (16:34 -0800)] 
bpf: do not freeze if bpf lsm fails to set up

BPF LSM is cgroup unaware and it's set up is happening in core manager.
It occures that the current implementation is too restrictive and causes
pid 1 to freeze.
Instead:
* in bpf_lsm_setup set manager->restrict_fs pointer last,
so it is an indicator that the set up was successful
* check for manager->restrict_fs before applying unit options

3 years agoMerge pull request #22031 from floppym/issue22001-1
Yu Watanabe [Fri, 7 Jan 2022 03:28:47 +0000 (12:28 +0900)] 
Merge pull request #22031 from floppym/issue22001-1

test-watchdog adjustments

3 years agotest-watchdog: set timeout to 2 seconds by default 22031/head
Mike Gilbert [Thu, 6 Jan 2022 19:12:33 +0000 (14:12 -0500)] 
test-watchdog: set timeout to 2 seconds by default

Some hardware/drivers do not handle a 1 second timeout properly.

Fixes: https://github.com/systemd/systemd/issues/22001
3 years agotest-watchdog: use watchdog_runtime_wait() to determine sleep interval
Mike Gilbert [Thu, 6 Jan 2022 19:09:30 +0000 (14:09 -0500)] 
test-watchdog: use watchdog_runtime_wait() to determine sleep interval

As sugggested in
https://github.com/systemd/systemd/issues/22001#issuecomment-1006755438.

3 years agouserdbctl: fix "Password OK" shown even when password is empty or locked (#21308)
Pigmy-penguin [Thu, 6 Jan 2022 16:01:38 +0000 (17:01 +0100)] 
userdbctl: fix "Password OK" shown even when password is empty or locked (#21308)

userdbctl: fix "Password OK" shown even when password is empty or locked

3 years agotest: add test cases for fstab-generator 22013/head
Yu Watanabe [Thu, 6 Jan 2022 11:12:27 +0000 (20:12 +0900)] 
test: add test cases for fstab-generator

3 years agotree-wide: fix typo
Yu Watanabe [Thu, 6 Jan 2022 13:20:11 +0000 (22:20 +0900)] 
tree-wide: fix typo

3 years agoNEWS: sort entries
Yu Watanabe [Thu, 6 Jan 2022 13:18:05 +0000 (22:18 +0900)] 
NEWS: sort entries

3 years agoboot: Simplify line_edit 22028/head
Jan Janssen [Wed, 5 Jan 2022 09:59:36 +0000 (10:59 +0100)] 
boot: Simplify line_edit

3 years agoboot: Switch to insertion sort
Jan Janssen [Wed, 5 Jan 2022 09:33:00 +0000 (10:33 +0100)] 
boot: Switch to insertion sort

We can do a little better than bubble sort without ramping up the
code complexity.

3 years agoboot: Do more config handling in config_load_all_entries
Jan Janssen [Tue, 4 Jan 2022 12:12:21 +0000 (13:12 +0100)] 
boot: Do more config handling in config_load_all_entries

3 years agoboot: Remove no_autoselect
Jan Janssen [Tue, 4 Jan 2022 09:12:39 +0000 (10:12 +0100)] 
boot: Remove no_autoselect

3 years agoboot: Close xbootldr root_dir
Jan Janssen [Tue, 4 Jan 2022 09:06:37 +0000 (10:06 +0100)] 
boot: Close xbootldr root_dir

3 years agoboot: Simplify config_entry_add_osx
Jan Janssen [Tue, 4 Jan 2022 09:02:24 +0000 (10:02 +0100)] 
boot: Simplify config_entry_add_osx

3 years agomeson: install test-network-generator-conversion.sh even if networkd is not enabled
Yu Watanabe [Thu, 6 Jan 2022 10:04:54 +0000 (19:04 +0900)] 
meson: install test-network-generator-conversion.sh even if networkd is not enabled

Follow-up for 987dd89c775815831ae21736fe60aef59cb7a6fa.

3 years agofstab-generator: also skip other network filesystems and live image
Yu Watanabe [Wed, 5 Jan 2022 13:06:03 +0000 (22:06 +0900)] 
fstab-generator: also skip other network filesystems and live image

3 years agofstab-generator: skip root directory handling when nfsroot is requested
Yu Watanabe [Wed, 5 Jan 2022 10:24:46 +0000 (19:24 +0900)] 
fstab-generator: skip root directory handling when nfsroot is requested

Fixes RHBZ#2037233 (https://bugzilla.redhat.com/show_bug.cgi?id=2037233).

3 years agoudev-util: ignore USB-C ports in power source mode when detecting system is running... 22006/head
Yu Watanabe [Wed, 5 Jan 2022 00:10:35 +0000 (09:10 +0900)] 
udev-util: ignore USB-C ports in power source mode when detecting system is running on AC power

Fixes #21988.

3 years agoudev-util: re-implement on_ac_power() with sd-device
Yu Watanabe [Tue, 4 Jan 2022 23:29:00 +0000 (08:29 +0900)] 
udev-util: re-implement on_ac_power() with sd-device

3 years agoutil: move on_ac_power() from util.c -> udev-util.c
Yu Watanabe [Tue, 4 Jan 2022 23:05:26 +0000 (08:05 +0900)] 
util: move on_ac_power() from util.c -> udev-util.c

3 years agooomd: move oomctl to bindir
Michael Biebl [Wed, 5 Jan 2022 21:14:14 +0000 (22:14 +0100)] 
oomd: move oomctl to bindir

We don't really need oomctl during early boot, so bindir seems like a
more suitable place for the binary.

3 years agotest-watchdog: mark as unsafe
Mike Gilbert [Wed, 5 Jan 2022 04:43:10 +0000 (23:43 -0500)] 
test-watchdog: mark as unsafe

If something goes wrong with this test it may result in an unsafe
system restart. Let's avoid running it automatically.

See https://github.com/systemd/systemd/issues/22001.

3 years agorandom-seed: cleanup code nits
Jason A. Donenfeld [Wed, 5 Jan 2022 13:36:13 +0000 (14:36 +0100)] 
random-seed: cleanup code nits

This incorporates various nits from the post-merge review on #21986.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
3 years agoMerge pull request #22018 from keszybz/logind-survive-aborted-suspend
Yu Watanabe [Wed, 5 Jan 2022 17:08:14 +0000 (02:08 +0900)] 
Merge pull request #22018 from keszybz/logind-survive-aborted-suspend

Make logind survive aborted suspend

3 years agoMerge pull request #22016 from yuwata/small-cleanups
Yu Watanabe [Wed, 5 Jan 2022 16:18:34 +0000 (01:18 +0900)] 
Merge pull request #22016 from yuwata/small-cleanups

assorted trivial cleanups

3 years agotest: use full date & time when checking for coredumps
Frantisek Sumsal [Wed, 5 Jan 2022 11:06:52 +0000 (12:06 +0100)] 
test: use full date & time when checking for coredumps

Otherwise we might hit a window where the coredump happens before
midnight, but we check for it after midnight, which yields no results.

E.g.:

```
$ coredumpctl --no-legend --no-pager --file system.journal
Wed 2022-01-05 01:00:06 CET 359 0 0 SIGABRT journal /usr/bin/udevadm n/a
$ coredumpctl --since 23:59:55 --no-legend --no-pager --file system.journal
No coredumps found.
$ coredumpctl --since "2022-01-04 23:59:59" --no-legend --no-pager --file system.journal
Wed 2022-01-05 01:00:06 CET 359 0 0 SIGABRT journal /usr/bin/udevadm n/a
```

3 years agoMerge pull request #22012 from DaanDeMeyer/journal-full-message
Yu Watanabe [Wed, 5 Jan 2022 16:17:31 +0000 (01:17 +0900)] 
Merge pull request #22012 from DaanDeMeyer/journal-full-message

journal: Log a better message when we're rotating because a file is full

3 years agoMerge pull request #22014 from keszybz/networkd-reduce-append-logging
Yu Watanabe [Wed, 5 Jan 2022 16:17:09 +0000 (01:17 +0900)] 
Merge pull request #22014 from keszybz/networkd-reduce-append-logging

Drop detailed error messages for netlink message append operations

3 years agologind: do not propagate error in delayed action 22018/head
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 14:10:33 +0000 (15:10 +0100)] 
logind: do not propagate error in delayed action

If the action failed, we should log about the issue, and continue.
Exiting would bring the graphical session down, which of course is not
appreciated by users.

As documented in previous commits, a non-negative return from the callback
doesn't matter, so the callback is simplified a bit.

Fixes #21991.

3 years agoman: add example of sd_event_add_child()
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 14:04:06 +0000 (15:04 +0100)] 
man: add example of sd_event_add_child()

The thing with blocking SIGCHLD is rather annoying. I think we could/should
make this automatic.

3 years agoman: add better descriptions of what event handlers do
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 13:00:59 +0000 (14:00 +0100)] 
man: add better descriptions of what event handlers do

The meaning of the return value, the default handlers, and loop exiting are now
described.

3 years agosystemctl: Fix --show timestamp
Ludwig Nussel [Tue, 4 Jan 2022 09:03:49 +0000 (10:03 +0100)] 
systemctl: Fix --show timestamp

3 years agobacklight: ignore error if the backlight device is already removed
Yu Watanabe [Wed, 5 Jan 2022 09:26:46 +0000 (18:26 +0900)] 
backlight: ignore error if the backlight device is already removed

Fixes #21997.

3 years agoMerge pull request #21974 from yuwata/test-repart-find-sfdisk
Frantisek Sumsal [Wed, 5 Jan 2022 12:40:11 +0000 (12:40 +0000)] 
Merge pull request #21974 from yuwata/test-repart-find-sfdisk

test-repart: find sfdisk

3 years agoMerge pull request #21981 from medhefgo/boot-cleanup
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 11:55:59 +0000 (12:55 +0100)] 
Merge pull request #21981 from medhefgo/boot-cleanup

boot: Cleanup

3 years agojournal: Log filename when we fail to write an entry 22012/head
Daan De Meyer [Wed, 5 Jan 2022 10:46:39 +0000 (10:46 +0000)] 
journal: Log filename when we fail to write an entry

3 years agojournal: Log a better message when we're rotating because a file is full
Daan De Meyer [Wed, 5 Jan 2022 10:24:20 +0000 (10:24 +0000)] 
journal: Log a better message when we're rotating because a file is full

The previous message was confusing errors. When we're rotating because
we've reached the file size limit, let's log a better message.

Fixes #22007.

3 years agosd-boot: select newest kernel entry matching with the default glob pattern
Yu Watanabe [Wed, 5 Jan 2022 06:09:43 +0000 (15:09 +0900)] 
sd-boot: select newest kernel entry matching with the default glob pattern

This fixes a bug introduced by 0c674ce5f24a6e52561ec6520e43a1ca45d90f01.

Fixes #22004.

3 years agowatchdog: adjust comment 22016/head
Yu Watanabe [Wed, 5 Jan 2022 11:13:59 +0000 (20:13 +0900)] 
watchdog: adjust comment

3 years agoresolve: add missing initialization of libgcrypt
Yu Watanabe [Wed, 5 Jan 2022 02:33:26 +0000 (11:33 +0900)] 
resolve: add missing initialization of libgcrypt

Fixes #21951.

3 years agooss-fuzz: drop line-tables-only
Evgeny Vereshchagin [Tue, 4 Jan 2022 22:47:46 +0000 (22:47 +0000)] 
oss-fuzz: drop line-tables-only

It was copy-pasted directly from OSS-Fuzz where it makes sense to
kind of strip binaries to get nice backtraces but when the fuzzers
are built and run locally with gdb it would be nice to have a little
bit more than that.

It was initially discovered in elfutils where I put the same flags
and was surprised when I couldn't run the fuzzer comfortably step
by step, which led to the same change there: https://github.com/google/oss-fuzz/pull/7092
:-)

3 years agotests: log_tests_skipped() already appends ", skipping tests" 22014/head
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 11:02:11 +0000 (12:02 +0100)] 
tests: log_tests_skipped() already appends ", skipping tests"

We would say:
test-bpf-lsm: Can't use mlock(), skipping., skipping tests.

3 years agonetwork: move logging from route_set_netlink_message() to the callers
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 10:34:55 +0000 (11:34 +0100)] 
network: move logging from route_set_netlink_message() to the callers

Overall size change for the whole series:
$ size build/systemd-networkd{.0,}
   text    data     bss     dec     hex filename
1878634  394016      36 2272686  22adae build/systemd-networkd.0
1755066  394080      36 2149182  20cb3e build/systemd-networkd

i.e. 121 kb.

3 years agonetwork: move logging from routing_policy_rule_set_netlink_message() to the callers
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 10:20:12 +0000 (11:20 +0100)] 
network: move logging from routing_policy_rule_set_netlink_message() to the callers

3 years agonetwork: move logging from qdisc_configure()/tclass_configure() to the caller
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 10:16:22 +0000 (11:16 +0100)] 
network: move logging from qdisc_configure()/tclass_configure() to the caller

3 years agonetwork: simplify logging in request_process_bridge_fdb()
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 09:52:17 +0000 (10:52 +0100)] 
network: simplify logging in request_process_bridge_fdb()

3 years agonetwork: move logging from tc .fill_message to the callers
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 09:35:19 +0000 (10:35 +0100)] 
network: move logging from tc .fill_message to the callers

Structured initialization is used a bit more.

There were two kinds of log messages: about failed size calculations and
about failed appends to the message. I "downgraded" the first type to log_debug,
and moved the latter to the caller. This way there should be at most one high-priority
message.

I also changed sizeof(<type>) to sizeof(var) — there is less chance of select-and-paste
error in the second form.

3 years agonetwork: split out neighbor_configure_message(), simplify logging
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 21:29:50 +0000 (22:29 +0100)] 
network: split out neighbor_configure_message(), simplify logging

3 years agonetwork: split out dhcp4_pd_create_6rd_tunnel_message(), simplify logging
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 21:17:45 +0000 (22:17 +0100)] 
network: split out dhcp4_pd_create_6rd_tunnel_message(), simplify logging

3 years agonetwork: adjust log message about MACsec associations
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 21:06:44 +0000 (22:06 +0100)] 
network: adjust log message about MACsec associations

3 years agonetwork: simplify logging in macsec netdev code
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 21:05:42 +0000 (22:05 +0100)] 
network: simplify logging in macsec netdev code

3 years agonetwork: simplify logging in l2tp_create_session() and l2tp_create_tunnel()
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 20:56:42 +0000 (21:56 +0100)] 
network: simplify logging in l2tp_create_session() and l2tp_create_tunnel()

All the detailed logging is replaced by a simple "Failed to create netlink message",
which should be enough for the user in the unlikely case that this ever fails.

3 years agonetwork: split out link_configure_fill_message(), simplify logging
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 20:47:48 +0000 (21:47 +0100)] 
network: split out link_configure_fill_message(), simplify logging

3 years agonetwork: move logging from can_set_netlink_message() to the caller
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 20:43:39 +0000 (21:43 +0100)] 
network: move logging from can_set_netlink_message() to the caller

3 years agonetwork: de-duplicate logging in bridge_vlan_append_info() and the caller
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 10:05:02 +0000 (11:05 +0100)] 
network: de-duplicate logging in bridge_vlan_append_info() and the caller

The remaining message is changed, because the user would most likely not
understand that "append VLANs" is just talking about the netlink message.

3 years agonetwork: move logging from ipoib_set_netlink_message() to the caller
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 20:34:21 +0000 (21:34 +0100)] 
network: move logging from ipoib_set_netlink_message() to the caller

3 years agocoredump: drop unnecessary initialization
Yu Watanabe [Wed, 5 Jan 2022 10:41:42 +0000 (19:41 +0900)] 
coredump: drop unnecessary initialization

3 years agonetwork: split out netdev_fill_fou_tunnel_message(), simplify logging
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 20:28:23 +0000 (21:28 +0100)] 
network: split out netdev_fill_fou_tunnel_message(), simplify logging

3 years agonetwork: split out netdev_create_message(), simplify logging
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 20:20:54 +0000 (21:20 +0100)] 
network: split out netdev_create_message(), simplify logging

3 years agonetwork: replace more detailed netlink append messages
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 18:37:55 +0000 (19:37 +0100)] 
network: replace more detailed netlink append messages

Some refactoring was needed here to avoid duplicate messages.
Some select-and-paste errors were fixed on the way.

systemd-networkd is thinner by 8k.

3 years agonetwork: use SYNTHETIC_ERRNO in one more place
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 18:16:16 +0000 (19:16 +0100)] 
network: use SYNTHETIC_ERRNO in one more place

3 years agonetwork: replace detailed netlink append messages with a single generic message
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 18:16:01 +0000 (19:16 +0100)] 
network: replace detailed netlink append messages with a single generic message

This commit is the first in the series, and they generally follow the same
idea: we had very detailed logging for message append operations which would
only fail either with some type error or intrinsic limit (and then they would
fail everywhere, so this would be noticed during development or in CI), or they
would fail with ENOMEM, in which case the exact location is not very interesting
since this is not repeatable.

I am in general in favour of detailed logging messages, because it helps with
diagnosis of errors, but I think case is an exception. Despite not being very
useful, those messages required a lot of effort, because they were customized
for each and every append operation. In fact some of the messages contained copy
errors. The text of the messages (since they are generally unique) also added up
to a considerable size.

This removes the log messages after each sd_netlink_message_append_*() in
fill_message_create() with a single line in netdev_create(). As described
above, we are just appending fields to a message, so those calls would almost
never fail.

A forgotten 'return' was added in one place.

$ size build/systemd-networkd{.0,}
   text    data     bss     dec     hex filename
1878634  394016      36 2272686  22adae build/systemd-networkd.0
1842450  394080      36 2236566  222096 build/systemd-networkd

… so we save 30k too.

3 years agotest-repart: append /sbin and /usr/sbin to $PATH= to make sfdisk can be found 21974/head
Yu Watanabe [Sun, 2 Jan 2022 20:13:59 +0000 (05:13 +0900)] 
test-repart: append /sbin and /usr/sbin to $PATH= to make sfdisk can be found

Fixes #21972.

3 years agotest-repart: disable pager
Yu Watanabe [Sun, 2 Jan 2022 20:03:45 +0000 (05:03 +0900)] 
test-repart: disable pager

3 years agorandom-seed: hash together old seed and new seed before writing out file
Jason A. Donenfeld [Mon, 3 Jan 2022 17:11:32 +0000 (18:11 +0100)] 
random-seed: hash together old seed and new seed before writing out file

If we're consuming an on-disk seed, we usually write out a new one after
consuming it. In that case, we might be at early boot and the randomness
could be rather poor, and the kernel doesn't guarantee that it'll use
the new randomness right away for us. In order to prevent the new
entropy from getting any worse, hash together the old seed and the new
seed, and replace the final bytes of the new seed with the hash output.
This way, entropy strictly increases and never regresses.

Fixes: https://github.com/systemd/systemd/issues/21983
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
3 years agoboot: Add gdb support and documentation
Jan Janssen [Sun, 19 Dec 2021 17:05:44 +0000 (18:05 +0100)] 
boot: Add gdb support and documentation

This will finally allow debugging issues in systemd without resorting to
Print() calls all over the place.