1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00
Commit Graph

55658 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
b85c1905e0 shutdown: adjust log message
Instead of saying "with options 'n/a'", let's just say "with options ''".
We really don't have any options.
2022-01-12 16:05:59 +01:00
Zbigniew Jędrzejewski-Szmek
9bd4181ef5 network: add example file that enables DHCP on ethernet links
The file has instructions how to "enable" it by symlinking into the
appropriate place. If we create a different mechanism to do enablement
later on, we can always adjust the instructions.

Closes #3998.
2022-01-12 16:05:59 +01:00
Zbigniew Jędrzejewski-Szmek
418e1f2892 network: license all config files as CC0
Same justification as the previous commit.

$ for i in network/*-*; do git blame $i;done | less
shows that those files were written by Tom Gundersen, Lennart Poettering, Yu
Watanabe, me, and Marc-André Lureau.
2022-01-12 16:05:59 +01:00
Luca Boccassi
ac172d7063
Merge pull request #22090 from mbiebl/units-oomd-alias
units: don't install dbus-org.freedesktop.oom1.service alias
2022-01-12 15:03:00 +00:00
Yu Watanabe
0a1f0bf405
Merge pull request #21728 from Werkov/bfq-io-weight
bfq.io.weight followups and cleanup
2022-01-12 22:22:43 +09:00
Yu Watanabe
174eab0066
Merge pull request #22037 from fbuihuu/watchdog-minor-improvements
Watchdog minor improvements
2022-01-12 22:09:50 +09:00
Lidong Zhong
edc6390e29 shutdown: release the watchdog finally
During reboot or kexec, watchdog will be setup before systemd is
replaced by systemd-shutdown binary. But while systemd-shutdown is
executed, the watchdog will not really be released. Log shown as
following:

[   39.371202] watchdog: watchdog0: watchdog did not stop!
[   39.383659] systemd-shutdown[1]: Syncing filesystems and block
devices.
[   39.423727] systemd-shutdown[1]: Sending SIGTERM to remaining
processes...
[   39.440857] systemd-journald[526]: Received SIGTERM from PID 1
(systemd-shutdow).
[   39.461047] systemd-shutdown[1]: Sending SIGKILL to remaining
processes...
[   39.466736] systemd-shutdown[1]: Using hardware watchdog 'iTCO_wdt',
version 0, device /dev/watchdog
[   39.467835] systemd-shutdown[1]: Unmounting file systems.
[   39.469721] [2171]: Remounting '/' read-only in with options
'attr2,inode64,logbufs=8,logbsize=32k,noquota'.
[   39.550266] systemd-shutdown[1]: All filesystems unmounted.
[   39.550274] systemd-shutdown[1]: Deactivating swaps.
[   39.550443] systemd-shutdown[1]: All swaps deactivated.
[   39.550449] systemd-shutdown[1]: Detaching loop devices.
[   39.550697] systemd-shutdown[1]: All loop devices detached.
[   39.550703] systemd-shutdown[1]: Detaching DM devices.
[   39.551269] systemd-shutdown[1]: Not all DM devices detached, 1
left.
[   39.551277] systemd-shutdown[1]: Cannot finalize remaining DM
devices, continuing.
[   39.580044] systemd-shutdown[1]: Successfully changed into root
pivot.
[   39.580050] systemd-shutdown[1]: Returning to initrd...
[   39.587921] watchdog: watchdog0: watchdog did not stop!
[   39.774130] dracut Warning: Break before pre-shutdown

after applying fix

[   59.520379] watchdog: watchdog0: watchdog did not stop!
[   59.542286] systemd-shutdown[1]: Syncing filesystems and block
devices.
[   59.583313] systemd-shutdown[1]: Sending SIGTERM to remaining
processes...
[   59.600133] systemd-journald[517]: Received SIGTERM from PID 1
(systemd-shutdow).
[   59.624435] systemd-shutdown[1]: Sending SIGKILL to remaining
processes...
[   59.629288] systemd-shutdown[1]: Using hardware watchdog
'iTCO_wdt', version 0, device /dev/watchdog
[   59.630468] systemd-shutdown[1]: Unmounting file systems.
[   59.632219] [2172]: Remounting '/' read-only in with options
'attr2,inode64,logbufs=8,logbsize=32k,noquota'.
[   59.727588] systemd-shutdown[1]: All filesystems unmounted.
[   59.727596] systemd-shutdown[1]: Deactivating swaps.
[   59.727719] systemd-shutdown[1]: All swaps deactivated.
[   59.727725] systemd-shutdown[1]: Detaching loop devices.
[   59.727974] systemd-shutdown[1]: All loop devices detached.
[   59.727979] systemd-shutdown[1]: Detaching DM devices.
[   59.728547] systemd-shutdown[1]: Not all DM devices detached, 1
left.
[   59.728556] systemd-shutdown[1]: Cannot finalize remaining DM
devices, continuing.
[   59.758160] systemd-shutdown[1]: Successfully changed into root
pivot.
[   59.758167] systemd-shutdown[1]: Returning to initrd...
[   59.950305] dracut Warning: Break before pre-shutdown
2022-01-12 22:07:17 +09:00
Luca Boccassi
e80b51dad2
Merge pull request #22043 from medhefgo/boot-bitlocker
boot: Add BitLocker TPM key sealing workaround
2022-01-12 13:05:30 +00:00
Yu Watanabe
d5ff7bdbb7
Merge pull request #22088 from medhefgo/meson
meson: Small improvements
2022-01-12 22:01:27 +09:00
Michael Biebl
d338b1713a test: enable systemd-oomd.service
Enable the service to ensure dbus-org.freedesktop.oom1.service exists
and D-Bus activation works.

See #18469
2022-01-12 12:29:34 +01:00
Zbigniew Jędrzejewski-Szmek
ae527ed688 network: say that our example files are licensed as CC0
This matches what we have for example programs under man/, and is nice
because it allows people to copy the files as they wish without worrying
about copyright. The files are too trivial to copyright anyway.
2022-01-12 11:41:10 +01:00
Michael Biebl
794aa5f57f units: don't install dbus-org.freedesktop.oom1.service alias
The systemd-oomd.service unit contains

[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.oom1.service

which means the symlink is supposed to be created dynamically when the
service is enabled.
2022-01-12 08:16:45 +01:00
yangmingtai
647082cf7f fix test-string-util failed when locale is not utf8 2022-01-12 05:06:05 +09:00
Yu Watanabe
d5f8fd5b00 network: dhcp6: do not request address if UseAddress=no
Fixes #22068.
2022-01-11 17:05:12 +00:00
Luca Boccassi
1d18a466c4
Merge pull request #22086 from keszybz/nss-no-proc-cmdline
Avoid looking at /prcc/cmdline from nss modules
2022-01-11 15:29:24 +00:00
Luca Boccassi
07b0de6584
Merge pull request #22082 from keszybz/no-update-if-nothing-to-update
bootctl: skip update if sd-boot wasn't installed
2022-01-11 15:28:35 +00:00
Jan Janssen
3a469802f4 meson: Use echo to list files
No need to invoke ls when we are just interested in file names.
Also, the cd to source root makes the output identical to
"git ls-files" (relative instead of absolute paths).
2022-01-11 14:56:33 +01:00
Jan Janssen
68a06b3cdf meson: Add check argument to remaining run_command() calls 2022-01-11 14:56:30 +01:00
Jan Janssen
bbec46c817 meson: Use files() for fuzzers
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
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
Zbigniew Jędrzejewski-Szmek
a7d15a2465 nss: only read logging config from environment variables
log_parse_environment() uses should_parse_proc_cmdline() to determine whether
it should parse settings from the kernel command line. But the checks that
should_parse_proc_cmdline() apply to the whole process, and we could get a positive
answer also when log_parse_environment() was called from one of the nss modules.
In case of nss-modules, we don't want to look at the kernel command line.

log_parse_environment_variables() that only looks at the environment variables
is split out and used in the nss modules.

Fixes #22020.
2022-01-11 13:39:52 +01:00
Zbigniew Jędrzejewski-Szmek
56a5f4969b nss: drop dummy setup_logging() helpers
log_parse_environment() stopped being a macro in 9fdee66f2d.
As reported by @bauen1 in https://github.com/systemd/systemd/issues/22020,
the comment was out of date.
2022-01-11 13:39:52 +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
Zbigniew Jędrzejewski-Szmek
49927ad813 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.
2022-01-11 10:57:36 +01:00
Zbigniew Jędrzejewski-Szmek
d9f048b5d1 bootctl: split out the check whether sd-boot is installed 2022-01-11 10:56:29 +01: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
Michal Koutný
bec17e801a core/cgroup: Factor out BFQ weight setting
No functional change.
2022-01-10 18:23:20 +01:00
Michal Koutný
d2bd0bfa36 cgroup-util: Move macros to macros and tests to tests
Friends to friends to be consistent with the other macros and make tests
separate from main code.
2022-01-10 18:22:41 +01:00
Michal Koutný
d43ffcac84 core/cgroup: Provide information about applied BFQ scaling
The BFQ weights are not passed verbatim to the kernel, provide that
information in a form of debug message so that users are not
surprised/confused when IOWeight != io.bfq.weight.
2022-01-10 18:22:27 +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
Jan Janssen
661615a0af boot: Add BitLocker TPM key sealing workaround
Fixes: #21891
2022-01-10 16:40:16 +01: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
Jan Janssen
a87e9cd79f boot: Add TPM to status info 2022-01-10 16:26:00 +01: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