summaryrefslogtreecommitdiffstats
path: root/src/systemctl (follow)
Commit message (Collapse)AuthorAgeFilesLines
* systemctl: grey out tasks limit the same way we grey out the fd store limit ↵Lennart Poettering10 days1-1/+1
| | | | | | | | in the output "systemctl status systemd-logind" otherwise looks a bit weird, since the tasks and the fdstore lines are so close to each other but formatted quite differently when it comes to coloring.
* systemctl: don't fall back to immediate shutdown silently if we cannot ↵Mike Yuan2024-10-311-6/+9
| | | | | | | | | schedule one The previous behavior of systemctl --when= seems absurd, i.e. if we fail to schedule shutdown in the future it's performed immediately. Let's instead hard fail, which also removes the need of specializing on certain errnos (preparation for later commits).
* systemctl: use the retval of must_be_root()Mike Yuan2024-10-311-4/+3
|
* Merge pull request #34245 from bluca/logind_drop_weak_delay_inhibitorZbigniew Jędrzejewski-Szmek2024-10-291-0/+4
|\ | | | | logind: drop new delay-weak inhibitor
| * systemctl: keep ignoring sessions on shutdown as rootLuca Boccassi2024-09-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The change was supposed to be about respecting inhibitors, but it was extended to also error out when there are active user sessions, which was not intentional. Previously systemctl skipped all checks if the caller was root or root-equivalent. Restore the previous behaviour and again avoid blocking systemctl reboot by root if there are active sessions, as long as there are no active inhibitors. Fixes https://github.com/systemd/systemd/issues/34086 Follow-up for 804874d26ac73e0af07c4c5d7165c95372f03f6d
* | Merge pull request #34679 from DaanDeMeyer/bus-logDaan De Meyer2024-10-091-1/+1
|\ \ | | | | | | Various logging improvements
| * | bus-util: Log more information when connecting to a bus socket failsDaan De Meyer2024-10-091-1/+1
| | | | | | | | | | | | | | | Let's log about which bus we're trying to connect to and what transport we're using to do it.
* | | systemctl: separate memory usage with commaYu Watanabe2024-10-081-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just for readability. Before: $ build/systemctl status -n 0 systemd-networkd.service | grep Memory: Memory: 4.7M (peak: 14.3M swap: 1M swap peak: 1.1M) After: $ build/systemctl status -n 0 systemd-networkd.service | grep Memory: Memory: 4.7M (peak: 14.3M, swap: 1M, swap peak: 1.1M)
* | | Merge pull request #34556 from ryantimwilson/extra-fdsLennart Poettering2024-10-081-0/+15
|\ \ \ | | | | | | | | Add ExtraFileDescriptor property to StartTransientUnit dbus API
| * | | Add ExtraFileDescriptor property to StartTransientUnit dbus APIRyan Wilson2024-10-071-0/+15
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ExtraFileDescriptor property to StartTransient dbus API with format "a(hs)" - array of (file descriptor, name) pairs. The FD will be passed to the unit via sd_notify like Socket and OpenFile. systemctl show also shows ExtraFileDescriptorName for these transient units. We only show the name passed to dbus as the FD numbers will change once passed over the unix socket and are duplicated, so its confusing to display the numbers. We do not add this functionality for systemd-run or general systemd service units as it is not useful for general systemd services. Arguably, it could be useful for systemd-run in bash scripts but we prefer to be cautious and not expose the API yet. Fixes: #34396
* / / tree-wide: drop doubled empty linesYu Watanabe2024-10-071-1/+0
|/ /
* | Merge pull request #34564 from YHNdnzj/systemctl-status-job-idMike Yuan2024-09-301-0/+6
|\ \ | | | | | | systemctl: also show job id in status output
| * | systemctl: also show job id in status outputMike Yuan2024-09-261-0/+6
| | | | | | | | | | | | Prompted by one ASG talk ;)
* | | shared: adjust whitespace and formattingZbigniew Jędrzejewski-Szmek2024-09-271-2/+2
| | |
* | | systemctl: fix printing of RootImageOptionsZbigniew Jędrzejewski-Szmek2024-09-271-0/+23
|/ / | | | | | | | | | | The type is a(ss), so a custom printer is required. Fixes https://github.com/systemd/systemd/issues/33967.
* | tree-wide: use strv_extend_strv_consume() where appropriateMike Yuan2024-09-211-2/+2
| |
* | Use correct error code in log message in output_waiting_jobs (#34404)PavlNekrasov2024-09-171-3/+2
|/ | | The error code `r` from the read function is being logged, but the error code `rc` from the table data insertion function should be logged instead.
* Merge pull request #34155 from poettering/gmtime-safeYu Watanabe2024-09-061-11/+14
|\ | | | | handle gmtime_r() errors more robustly
| * time-util: rework localtime_or_gmtime() into localtime_or_gmtime_usec()Lennart Poettering2024-09-051-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | We typically want to deal in usec_t, hence let's change the prototype accordingly, and do proper range checks. Also, make sure are not confused by negative times. Do something similar for mktime_or_timegm(). This is a more comprehensive alternative to #34065 Replaces: #34065
* | edit-util: EditFileContext: avoid reserved 'stdin'A. Wilcox2024-09-061-1/+1
|/ | | | | | The identifier 'stdin' is reserved in C. It can be #defined to any statement that evaluates to a FILE*. We do not want that for our field, so change to a more descriptive name.
* systemctl: cat: do not exit(1) on missing units if `--force`Ivan Shapovalov2024-09-051-2/+3
| | | | | We are eating the error message if `--force` is set, so do not return a non-zero exit code either.
* core: do BindMount/MountImage operations in async control processLuca Boccassi2024-08-295-8/+10
| | | | | | | | | | | | | | | | | | 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.
* shared/logs-show: introduce journal_browse_prepare()Mike Yuan2024-08-221-6/+3
| | | | which combines sigbus_install() and bumping fd limit.
* tree-wide: voidify polkit_agent_open_if_enabled()Yu Watanabe2024-08-191-1/+1
|
* networkctl: support edit --stdinMike Yuan2024-08-122-2/+2
|
* systemctl: gracefully adjust bus transport and runtime scope when ↵Yu Watanabe2024-08-051-0/+8
| | | | | | | | | | | | | | | --boot-loader-entry=help This fixes the following assertion: === SYSTEMD_LOG_LEVEL=debug systemctl --user -H foo --boot-loader-entry=help Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Ignoring. Failed to connect to bus: Operation not supported === Fixes a bug introduced by 97af80c5a7029c3f92e982dcf9338b9e67ad9cde. Fixes #33661. Fixes oss-fuzz#70153.
* systemctl: refuse --capsule=foo with --systemYu Watanabe2024-08-041-0/+4
| | | | | | | | | | | Fixes the following assertion: === systemctl --capsule=hoge --system reboot Assertion 'runtime_scope == RUNTIME_SCOPE_USER' failed at src/shared/bus-util.c:479, function bus_connect_transport(). Aborting. Aborted (core dumped) === Follow-up for 56cb74c3cd1358d7d0b3f613feaf2eeab601a6bd.
* logind: always check for inhibitor locksLuca Boccassi2024-07-251-16/+16
| | | | | | | | | | | | | | | | | | | | | | | 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.
* terminal-util: split out color macros/helpers into its own headerLennart Poettering2024-07-196-0/+6
| | | | | | | | | This is a lot of stuff, and sometimes quite wild, let's turn this into its own header. All stuff color-related that just generates sequences is now in ansi-color.h (no .c file!), and everything more complex that probes/ineracts with terminals remains in termina-util.[ch]
* systemctl-enable: support reenable --nowMike Yuan2024-07-091-14/+43
| | | | | | | Also, instead of silently continuing when template units are specified with enable --now, print a warning and skip them. Closes #31541
* systemctl-enable: some cleanupsMike Yuan2024-07-091-38/+39
| | | | | | - Drop one more use of basename() - Clean up logging in normalize_*() - Use assertions where appropriate
* systemctl: do not try to acquire triggering units for template unitsMike Yuan2024-07-041-4/+9
|
* systemctl: skip triggering unit warning if unit vanishedMike Yuan2024-07-041-2/+2
|
* Merge pull request #33491 from keszybz/allow-interactive-auth-in-inhibitLuca Boccassi2024-06-261-2/+2
|\ | | | | Allow interactive auth in inhibit
| * Rename spawn-ask-password-agent.c to just ask-password-agent.cZbigniew Jędrzejewski-Szmek2024-06-261-1/+1
| | | | | | | | | | The functions in the file were *not* using the spawn prefix, and the prefix seems completely unnecessary.
| * Rename spawn-polkit-agent.c to just polkit-agent.cZbigniew Jędrzejewski-Szmek2024-06-261-1/+1
| | | | | | | | | | The functions in the file were *not* using the spawn prefix, and the prefix seems completely unnecessary.
* | systemctl-show: show Status{Bus,Varlink}Error in statusMike Yuan2024-06-201-6/+27
| |
* | logind: implement maintenance timeLudwig Nussel2024-06-205-11/+14
|/ | | | | | | | | | | | | | | | | | | | | 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.
* libsystemd: turn json.[ch] into a public APILennart Poettering2024-06-122-6/+6
| | | | | | | | | | | | | | | This is preparation for making our Varlink API a public API. Since our Varlink API is built on top of our JSON API we need to make that public first (it's a nice API, but JSON APIs there are already enough, this is purely about the Varlink angle). I made most of the json.h APIs public, and just placed them in sd-json.h. Sometimes I wasn't so sure however, since the underlying data structures would have to be made public too. If in doubt I didn#t risk it, and moved the relevant API to src/libsystemd/sd-json/json-util.h instead (without any sd_* symbol prefixes). This is mostly a giant search/replace patch.
* shared/install: modernize unit_file_get_list, use key destructorMike Yuan2024-06-121-21/+13
| | | | The rest of the basename()s are easy to drop.
* systemctl: fix "applying zero offset to null pointer" UBSan errorYu Watanabe2024-05-151-1/+1
| | | | Fixes #32837.
* logs-show: drop uid argument from add_matches_for_user_units()Yu Watanabe2024-05-101-2/+1
| | | | | It is always equivalent to getuid(). Let's call getuid() in the function instead.
* systemctl-show: make show_memory_available cover memory_available itselfMike Yuan2024-05-081-6/+4
| | | | | | | | | | | | | | | Follow-up for f380473edfa899706d630bb64750ab50c5c04961 This cleans up the code a bit. Also, before this commit, if MemoryAvailable is set but show_memory_available is false, and we have nothing else to output, empty parenthesis is shown. This can be easily reproduced on -.slice: > systemctl status -- -.slice > ... > Memory: 1.8G () > ...
* systemctl: do not fall back to StartUnit automatically for sleep operationsMike Yuan2024-05-081-1/+4
| | | | | | | | 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.
* systemctl: fix log message when glob patterns passed to disable command and ↵Yu Watanabe2024-05-011-1/+2
| | | | | | friends Fixes #32599.
* systemctl: Implement --wait for kill commandDaan De Meyer2024-05-012-3/+25
| | | | | | 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.
* systemctl: list-jobs: interchange 'waiting for' and 'blocking' in outputRasmus Villemoes2024-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current output of 'systemctl list-jobs' with the --after and/or --before switches seems backwards. With artificial units # check-oil.service [Unit] Description=Check the oil level Before=engine-ready.target # fill-gas.service [Unit] Description=Fill the tank with gasoline Before=engine-ready.target # engine-ready.target [Unit] Description=The engine is ready [Unit] Description=Start the engine! After=engine-ready.target Wants=engine-ready.target running 'systemctl list-jobs --before --after' produces JOB UNIT TYPE STATE 93 check-oil.service start running └─ waiting for job 94 (engine-ready.target/start) - - 102 fill-gas.service start running └─ waiting for job 94 (engine-ready.target/start) - - 94 engine-ready.target start waiting └─ waiting for job 111 (start-engine.service/start) - - └─ blocking job 93 (check-oil.service/start) - - └─ blocking job 102 (fill-gas.service/start) - - 111 start-engine.service start waiting └─ waiting for job 1 (multi-user.target/start) - - └─ blocking job 94 (engine-ready.target/start) - - Obviously, job 93 is not waiting for job 94, but rather blocking it.
* Merge pull request #32428 from poettering/sd-notify-reboot-paramZbigniew Jędrzejewski-Szmek2024-04-231-7/+9
|\ | | | | pid1: send shutdown type and reboot argument to supervisor via sd_notify()
| * systemctl: set reboot argument for most forms of shutdown, not just plain ↵Lennart Poettering2024-04-231-7/+9
| | | | | | | | | | | | | | reboots This doesn't hurt anyway, and is useful now that we propagate the string via sd_notify() too.
* | systemctl: add forgotten --after/--before to --help textLennart Poettering2024-04-231-0/+2
| | | | | | | | Follow-up for: afba41995de65d8f378b138ea6d9804be32625a3