1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00
Commit Graph

451 Commits

Author SHA1 Message Date
Luca Boccassi
3509fe124d man: consolidate list of active unit states into a shared table
Avoids the need to maintain the same list over and over again, and
link it to the defition table in the implementation as a reminder
too
2024-10-04 12:22:55 +02:00
Luca Boccassi
5162829ec8 core: do BindMount/MountImage operations in async control process
These operations might require slow I/O, and thus might block PID1's main
loop for an undeterminated amount of time. Instead of performing them
inline, fork a worker process and stash away the D-Bus message, and reply
once we get a SIGCHILD indicating they have completed. That way we don't
break compatibility and callers can continue to rely on the fact that when
they get the method reply the operation either succeeded or failed.

To keep backward compatibility, unlike reload control processes, these
are ran inside init.scope and not the target cgroup. Unlike ExecReload,
this is under our control and is not defined by the unit. This is necessary
because previously the operation also wasn't ran from the target cgroup,
so suddenly forking a copy-on-write copy of pid1 into the target cgroup
will make memory usage spike, and if there is a MemoryMax= or MemoryHigh=
set and the cgroup is already close to the limit, it will cause an OOM
kill, where previously it would have worked fine.
2024-08-29 12:48:55 +01:00
Mike Yuan
988ca0953e
man: use standard-options for --no-ask-password everywhere 2024-08-21 15:17:02 +02:00
Luca Boccassi
804874d26a logind: always check for inhibitor locks
Currently inhibitors are bypassed unless an explicit request is made to
check for them, or even in that case when the requestor is root or the
same uid as the holder of the lock.

But in many cases this makes it impractical to rely on inhibitor locks.
For example, in Debian there are several convoluted and archaic
workarounds that divert systemctl/reboot to some hacky custom scripts
to try and enforce blocking accidental reboots, when it's not expected
that the requestor will remember to specify the command line option
to enable checking for active inhibitor locks.

Also in many cases one wants to ensure that locks taken by a user are
respected by actions initiated by that same user.

Change logind so that inhibitors checks are not skipped in these
cases, and systemctl so that locks are checked in order to show a
friendly error message rather than "permission denied".

Add new block-weak and delay-weak modes that keep the previous
behaviour unchanged.
2024-07-25 12:22:36 +01:00
Mike Yuan
98aedce914
systemctl-enable: support reenable --now
Also, instead of silently continuing when template units
are specified with enable --now, print a warning and skip them.

Closes #31541
2024-07-09 16:46:13 +02:00
Mike Yuan
399646faac
man/systemctl: --no-reload is honored by mask/unmask/preset too 2024-07-04 20:36:02 +02:00
Ludwig Nussel
0e10c3d872 logind: implement maintenance time
Update frameworks that work automatically in the background
occasionally need to schedule reboots. Systemd-logind already
provides a nice mechanism to schedule shutdowns, send notfications
and block logins short before the time. Systemd has a framework for
calendar events, so we may conveniently use logind to define a
maintenance time for reboots.

The existing ScheduleShutdown DBus method in logind expects a usec_t
with an absolute time. Passing USEC_INFINITY as magic value now tells
logind to take the time from the configured maintenance time if set.

"shutdown -r" leverages that and uses the maintenance time
automatically if configured. The one minute default is still used if
nothing was specified.

Similarly the new 'auto' setting for the --when parameter of systemctl
uses the maintenance time if configured or a one minute timer like the
shutdown command.
2024-06-20 14:37:42 +02:00
Colin Watson
566491c971 docs,man: Avoid some ambiguous uses of "may not"
Like much English text, the systemd documentation uses "may not" in the
sense of both "will possibly not" and "is forbidden to".  In many cases
this is OK because the context makes it clear, but in others I felt it
was possible to read the "is forbidden to" sense by mistake: in
particular, I tripped over "the target file may not exist" in
systemd.unit(5) before realizing the correct interpretation.

Use "might not" or "may choose not to" in these cases to make it clear
which sense we mean.
2024-05-08 17:14:32 +02:00
Mike Yuan
4f344de792
systemctl: do not fall back to StartUnit automatically for sleep operations
In the majority of cases, this is caused by
sleep_supported() returning error. Hence it's
very likely that it would fail again, so
the fallback is not really useful. Instead,
honor the --force option for these verbs.
2024-05-08 13:45:49 +08:00
Daan De Meyer
6be4dab095 systemctl: Implement --wait for kill command
TEST-26-SYSTEMCTL is racy as we call systemctl is-active immediately
after systemctl kill. Let's implement --wait for systemctl kill and
use it in TEST-26-SYSTEMCTL to avoid the race.
2024-05-01 09:40:32 +02:00
Lennart Poettering
c104d7a74e man: document that "systemctl set-environment" cannot be used to unset env vars configured via config file
Fixes: #28167
2024-04-22 15:16:54 +02:00
Luca Boccassi
ef5f7f9437 systemctl: add --clean= values to documentation and shell completion 2024-04-18 14:07:07 +02:00
Sam Leonard
9bfabe14e5 man: fix incorrect XML in man page 2024-04-15 10:40:11 +02:00
Lennart Poettering
e8fd555471 man: document the new concepts 2024-03-14 11:34:04 +01:00
Zbigniew Jędrzejewski-Szmek
31e70e88cd timedatectl: add -P 2024-03-04 16:12:21 +04:00
Mike Yuan
3725766266 systemctl: don't warn unit needs reload if --no-warn 2024-02-15 00:37:19 +08:00
David Tardon
eea10b26f7 man: use same version in public and system ident. 2023-12-25 15:51:47 +01:00
David Tardon
617b85d10e man: use <warning> for warnings 2023-12-25 10:00:43 +01:00
David Tardon
13a69c120b man: use <simplelist> for 'See also' sections
This is just a slight markup improvement; there should be no difference
in rendering.
2023-12-23 08:28:57 +01:00
Mike Yuan
bc9e592c4f systemctl: configure boot loader options only when going through firmware
Fixes #30497
2023-12-21 01:35:55 +09:00
Frantisek Sumsal
31dcc1b4ba man: avoid potential shell expansion in systemctl's example
Resolves: #30014
2023-12-18 17:09:06 +01:00
Yu Watanabe
a753d30303 systemctl: fix typo
Follow-up for 329050c5e2.
2023-12-10 14:26:33 +09:00
Zbigniew Jędrzejewski-Szmek
34f4fcb59f
Merge pull request #30302 from keszybz/systemd-edit-stdin
systemctl edit --stdin
2023-12-06 22:28:02 +01:00
Zbigniew Jędrzejewski-Szmek
329050c5e2 systemctl: add "edit --stdin"
This is a fancy wrapper around "cat <<EOF", but:
- the user doesn't need to figure out the file name,
- parent directories are created automatically,
- daemon-reload is implied,
so it's a convenient way to create units or drop-ins.

Closes https://github.com/systemd/systemd/issues/21862.
2023-12-05 18:47:19 +01:00
Mike Yuan
5b3562898a
systemctl: add support for Sleep() logind call 2023-12-05 22:18:32 +08:00
Zbigniew Jędrzejewski-Szmek
465a9d2af8 man/systemctl: fix indentation of <xi:include>'s 2023-12-02 21:21:52 +01:00
Zbigniew Jędrzejewski-Szmek
30247ea76e man: many fixes systemd-vmspawn(1)
- version information
- indentation and missing tags
- mkosi and qemu don't need root
2023-11-07 21:56:42 +01:00
Zbigniew Jędrzejewski-Szmek
bf63dadbc6 man: more hyperlinks and other fixes
Closes https://github.com/systemd/systemd/issues/29814.
2023-11-06 20:16:34 +01:00
Mike Yuan
5d4072d0ed
man,docs: suffix directories with / 2023-10-21 06:25:35 +08:00
Luca Boccassi
665a3d6d15 systemctl: automatically softreboot/kexec if set up on reboot
Automatically softreboot if the nextroot has been set up with an OS
tree, or automatically kexec if a kernel has been loaded with kexec
--load.

Add SYSTEMCTL_SKIP_AUTO_KEXEC and SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT to
skip the automated switchover.
2023-10-20 11:45:37 +01:00
Mike Yuan
2ee346160c
systemctl: is-failed: check if system is degraded when no unit given
Closes #3335
2023-10-19 00:12:28 +08:00
Luca Boccassi
7c83d42ef8 mount-util: use mount beneath to replace previous namespace mount
Instead of mounting over, do an atomic swap using mount beneath, if
available. This way assets can be mounted again and again (e.g.:
updates) without leaking mounts.
2023-10-16 14:33:47 +01:00
Mike Yuan
d708bb7c02
systemctl-enable: warn if disabled/masked units has active triggering units
Closes #311
2023-09-28 05:24:51 +08:00
Mike Yuan
0b675f97d6
systemctl-start: suppress the triggering unit warning when --no-warn 2023-09-28 05:24:51 +08:00
Joerg Behrmann
7c52d5236a treewide: split commandline into command line 2023-09-20 16:37:23 +01:00
Abderrahim Kitouni
aefdc1124f man: update version information
As I noticed a lot of missing information when trying to implement checking
for missing info. I reimplemented the version information script to be more
robust, and here is the result.

Follow up to ec07c3c80b
2023-09-19 00:37:37 +01:00
Abderrahim Kitouni
ec07c3c80b man: add version info
This tries to add information about when each option was added. It goes
back to version 183.

The version info is included from a separate file to allow generating it,
which would allow more control on the formatting of the final output.
2023-08-29 14:07:24 +01:00
Erik Sjölund
6870daff03 man: fix typos 2023-07-27 09:54:43 +01:00
Yu Watanabe
16a07ffc64 man: move <varlistentry> in <variablelist> 2023-07-12 10:03:43 +09:00
Mike Yuan
e9bd185316
man/systemctl: document --job-mode=restart-dependencies
Follow-up for 09d04ad325
2023-07-05 08:15:34 +08:00
Lennart Poettering
c86a95082b systemctl: implement a new "whoami" verb, that just returns unit of caller/PID 2023-07-04 01:05:02 +01:00
Zbigniew Jędrzejewski-Szmek
da89046643 tree-wide: "<n>bit" → "<n>-bit"
In some places, "<n> bits" is used when more appropriate.
2023-07-02 11:10:12 +01:00
Lennart Poettering
e503019bc7 tree-wide: when in doubt use greek small letter mu rather than micro symbol
Doesn't really matter since the two unicode symbols are supposedly
equivalent, but let's better follow the unicode recommendations to
prefer greek small letter mu, as per:

https://www.unicode.org/reports/tr25
2023-06-14 10:23:56 +02:00
Lennart Poettering
3122f4d752 man: document that "systemctl mask" doesn't work for units whose file is in /etc
Fixes: #27965
2023-06-08 18:53:01 +01:00
Lennart Poettering
4de665812a man: document the soft reboot operation 2023-06-02 18:43:10 +02:00
Zbigniew Jędrzejewski-Szmek
fb12f1404f man/systemctl: say that kexec loads the kernel, mention --force
Fixes #24588.
Fixes #15029.
2023-05-30 13:41:24 +02:00
Mike Yuan
0313c41068
Merge pull request #27638 from YHNdnzj/upheldby-unit-file
unit-file: support UpheldBy= in [Install] settings (adding Upholds= deps from .upholds/)
2023-05-16 21:53:24 +08:00
Lennart Poettering
7e0aaeb244 man: indicate that the JOB parameter to "systemctl cancel" is optional
As per:

https://social.treehouse.systems/@grawity/110376583742207755
2023-05-16 20:18:38 +08:00
Mike Yuan
38f901791f
unit-file: support UpheldBy= in [Install] settings (adding Upholds= deps
from .upholds/)

Closes #26896
2023-05-15 15:04:38 +08:00
Lennart Poettering
5ae89ef347 core/systemctl: when switching root default to /sysroot/
We hardcode the path the initrd uses to prepare the final mount point at
so many places, let's also imply it in "systemctl switch-root" if not
specified.

This adds the fallback both to systemctl and to PID 1 (this is because
both to — different – checks on the path).
2023-04-28 23:26:20 +01:00