1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00
Commit Graph

55577 Commits

Author SHA1 Message Date
Jan Janssen
e1eeebbb11 meson: Use files() for tests
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
lincoln auster
a1a03fa54b
sd-bus/man: document EBUSY error in bus_message_read (#21954)
* sd-bus/man: document EBUSY error in bus_message_read

The EBUSY error can be returned from sd_bus_exit_container(), and, if
that happens, it will be propogated upwards towards bus_message_read. In
terms of documentation, this means that bus_message_read's man page
can't just include the error text for sd_bus_message_read_basic, as
reading basic types exclusively doesn't have the potential for this
error.

sd_bus_message_read_basic's error documentation isn't incorrect when
applied to sd_bus_message_read, it's just incomplete.  While EBUSY is
documented in sd_bus_message_open_container.xml,
it's explanation is unique to the sd_bus_message_exit_container function
and makes for poor documentation of the general read API.
2022-01-11 10:47:31 +00:00
Jan Janssen
ed3abbfbde boot: Fix readdir_harder() on VirtualBox
Fixes: #22073
2022-01-10 21:40:52 +01:00
Zbigniew Jędrzejewski-Szmek
e07a80476b
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
2022-01-10 21:38:56 +01:00
Jan Janssen
9818ec8ea5 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.
2022-01-10 21:34:12 +01:00
Luca Boccassi
3f3d4b4167
Merge pull request #22071 from keszybz/xdg-autostart-logs
Improve logs in systemd-xdg-autostart-generator
2022-01-10 16:55:14 +00:00
Luca Boccassi
55a89ea1b4
Merge pull request #22070 from keszybz/rm-rf-wip
Simplify recursive removal code and replace stack recursion with a heap queue
2022-01-10 15:35:42 +00:00
Zbigniew Jędrzejewski-Szmek
8c19f79e40 docs: fix typo in key name and adjust grammar a bit 2022-01-10 13:22:48 +01:00
Zbigniew Jędrzejewski-Szmek
0d1610c9c9 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.
2022-01-10 13:22:01 +01:00
Zbigniew Jędrzejewski-Szmek
578fe556df
Merge pull request #22019 from lnussel/shutdown
shutdown command fixes
2022-01-10 13:10:57 +01:00
Zbigniew Jędrzejewski-Szmek
eb79d39138 xdg-autostart-generator: make parameter const 2022-01-10 12:09:35 +01:00
Evgeny Vereshchagin
e8635fd370 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
2022-01-10 09:42:38 +01:00
Ludwig Nussel
8e98568165 systemctl: consistent output for scheduled shutdowns
Use same terms when scheduling and showing sheduled shutdowns.
2022-01-10 09:09:50 +01:00
Julia Kartseva
ccfc534dee 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.
2022-01-09 21:45:50 -08:00
Zbigniew Jędrzejewski-Szmek
d179b8d368 bpf: adjust comment about not calling sym_bpf_link__destroy 2022-01-09 21:45:50 -08:00
Julia Kartseva
f409aa5c63 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.
2022-01-09 21:45:50 -08:00
Zbigniew Jędrzejewski-Szmek
79a67f3ca4 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).
2022-01-09 20:03:22 +01:00
Jan Janssen
f699bd81e8 boot-timestamps: Discard firmware init time when running in a VM
Fixes: #22060
2022-01-09 19:21:16 +01:00
Zbigniew Jędrzejewski-Szmek
46004616a1 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 299d941723.
2022-01-09 18:04:49 +00:00
Frantisek Sumsal
fd5e5a87fb test: explicitly configure oomd stuff via dropins
so we don't get overridden by distro-shipped ones.

Fixes: #22030
2022-01-09 17:56:57 +00:00
Luca Boccassi
e683878c0f 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
2022-01-09 18:17:40 +01:00
Jan Janssen
b3c5a7074c 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.
2022-01-09 18:02:34 +01:00
Luca Boccassi
f2d323a3ab
Merge pull request #22028 from medhefgo/boot-cleanup
boot: Cleanup
2022-01-09 15:44:55 +00:00
Albert Brox
3989bdc1ad core: teach LoadCredential= to load from a directory 2022-01-08 13:17:51 +00:00
Luca Boccassi
7e1f61137a
Merge pull request #22044 from keszybz/minor-man-page-adjustments
Minor man page adjustments
2022-01-07 22:14:30 +00:00
Zbigniew Jędrzejewski-Szmek
bd330fb05e man: adjust chart in bootup(5)
The style used for that one branch was inconsistent with other branches.
2022-01-07 17:37:37 +01:00
Zbigniew Jędrzejewski-Szmek
49fddcd355 man: refer to os-release(5) for description of files in the same format 2022-01-07 17:37:37 +01:00
Zbigniew Jędrzejewski-Szmek
55ac274ef4 man: add missing example title in systemd.network(5)
Also rename the file to match the example being extended.
2022-01-07 17:34:20 +01:00
Zbigniew Jędrzejewski-Szmek
5f02870a74 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.
2022-01-07 17:34:17 +01:00
Morten Linderud
921e1bae16 man: correct minor mistakes in systemd-creds
Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-01-07 16:07:28 +01:00
Zbigniew Jędrzejewski-Szmek
7f6c2dd0a7
Merge pull request #22013 from yuwata/fstab-generator-skip-nfsroot
fstab-generator: skip root directory handling when nfsroot is requested
2022-01-07 16:02:19 +01:00
Adam Williamson
a5307e173b 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>
2022-01-07 15:15:04 +01:00
Markus Weippert
e00a25a7b4 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.
2022-01-07 14:33:35 +01:00
Zbigniew Jędrzejewski-Szmek
7359e3d35a
Merge pull request #22006 from yuwata/on-ac-power
udev-util: ignore USB-C ports in power source mode
2022-01-07 14:28:19 +01:00
Julia Kartseva
299d941723 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
2022-01-07 16:25:45 +09:00
Yu Watanabe
2bdd2e7ac9
Merge pull request #22031 from floppym/issue22001-1
test-watchdog adjustments
2022-01-07 12:28:47 +09:00
Mike Gilbert
23126a7b9b 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
2022-01-06 14:12:33 -05:00
Mike Gilbert
788c2d9523 test-watchdog: use watchdog_runtime_wait() to determine sleep interval
As sugggested in
https://github.com/systemd/systemd/issues/22001#issuecomment-1006755438.
2022-01-06 14:09:30 -05:00
Pigmy-penguin
cd933f14bd
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
2022-01-06 16:01:38 +00:00
Yu Watanabe
8cc8a073a8 test: add test cases for fstab-generator 2022-01-07 00:58:50 +09:00
Yu Watanabe
7611946ebc tree-wide: fix typo 2022-01-06 22:20:11 +09:00
Yu Watanabe
c0b28d44a9 NEWS: sort entries 2022-01-06 22:18:05 +09:00
Jan Janssen
ad9962bb7e boot: Simplify line_edit 2022-01-06 14:16:34 +01:00
Jan Janssen
6893c4c553 boot: Switch to insertion sort
We can do a little better than bubble sort without ramping up the
code complexity.
2022-01-06 14:16:34 +01:00
Jan Janssen
163d1ea5dd boot: Do more config handling in config_load_all_entries 2022-01-06 14:16:34 +01:00
Jan Janssen
b00e37daa6 boot: Remove no_autoselect 2022-01-06 14:16:34 +01:00
Jan Janssen
dd4ddc82e6 boot: Close xbootldr root_dir 2022-01-06 14:16:34 +01:00
Jan Janssen
a45d4f3543 boot: Simplify config_entry_add_osx 2022-01-06 14:16:34 +01:00
Yu Watanabe
b322e683ac meson: install test-network-generator-conversion.sh even if networkd is not enabled
Follow-up for 987dd89c77.
2022-01-06 20:14:39 +09:00
Yu Watanabe
155e1bb4e7 fstab-generator: also skip other network filesystems and live image 2022-01-06 20:14:35 +09:00