summaryrefslogtreecommitdiff
path: root/src/systemctl
Commit message (Collapse)AuthorAgeFilesLines
* core/systemctl: when switching root default to /sysroot/Lennart Poettering2023-04-282-10/+15
| | | | | | | | | 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).
* systemctl: rework 'if' to 'switch' statementLennart Poettering2023-04-291-11/+17
|
* preset: Add ignore directiveDaan De Meyer2023-04-141-12/+19
| | | | | | The ignore directive specifies to not do anything with the given unit and leave existing configuration intact. This allows distributions to gradually adopt preset files by shipping a ignore * preset file.
* tree-wide: rename cleanup functionDavid Tardon2023-04-141-1/+1
| | | | ... with accordance to the current coding style.
* image-policy: introduce parse_image_policy_argument() helperYu Watanabe2023-04-131-14/+8
| | | | | | | | | Addresses https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1060130312, https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067927293, and https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067926416. Follow-up for 84be0c710d9d562f6d2cf986cc2a8ff4c98a138b.
* Merge pull request #27027 from dtardon/unit-file-list-cleanupLennart Poettering2023-04-132-17/+7
|\ | | | | Use _cleanup_ for UnitFileList hash
| * systemctl: fix a memory leakDavid Tardon2023-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | valgrind systemctl is-enabled --root=/ -l default.target >/dev/null ==746041== Memcheck, a memory error detector ==746041== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==746041== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info ==746041== Command: systemctl is-enabled --root=/ -l default.target ==746041== ==746041== ==746041== HEAP SUMMARY: ==746041== in use at exit: 8,251 bytes in 4 blocks ==746041== total heap usage: 3,440 allocs, 3,436 frees, 1,163,346 bytes allocated ==746041== ==746041== LEAK SUMMARY: ==746041== definitely lost: 24 bytes in 1 blocks ==746041== indirectly lost: 35 bytes in 1 blocks ==746041== possibly lost: 0 bytes in 0 blocks ==746041== still reachable: 8,192 bytes in 2 blocks ==746041== suppressed: 0 bytes in 0 blocks ==746041== Rerun with --leak-check=full to see details of leaked memory ==746041== ==746041== For lists of detected and suppressed errors, rerun with: -s ==746041== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
| * systemctl-list-unit-files: drop workaround for CoverityDavid Tardon2023-04-121-1/+1
| | | | | | | | This partially reverts commit 0da999fada225d2d74b62ec758cd437a3e2f6ebb .
| * systemctl: drop stray assignmentDavid Tardon2023-04-121-2/+0
| |
| * systemctl: use _cleanup_ for UnitFileList hashDavid Tardon2023-04-121-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes a memory leak in the old code. valgrind systemctl -t socket --root=/ list-unit-files >/dev/null ==2601899== Memcheck, a memory error detector ==2601899== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==2601899== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info ==2601899== Command: systemctl -t socket --root=/ list-unit-files ==2601899== ==2601899== ==2601899== HEAP SUMMARY: ==2601899== in use at exit: 39,984 bytes in 994 blocks ==2601899== total heap usage: 344,414 allocs, 343,420 frees, 2,001,612,404 bytes allocated ==2601899== ==2601899== LEAK SUMMARY: ==2601899== definitely lost: 7,952 bytes in 497 blocks ==2601899== indirectly lost: 32,032 bytes in 497 blocks ==2601899== possibly lost: 0 bytes in 0 blocks ==2601899== still reachable: 0 bytes in 0 blocks ==2601899== suppressed: 0 bytes in 0 blocks ==2601899== Rerun with --leak-check=full to see details of leaked memory ==2601899== ==2601899== For lists of detected and suppressed errors, rerun with: -s ==2601899== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
* | service: allow freeing the fdstore via cleaningLennart Poettering2023-04-132-2/+3
| | | | | | | | | | | | Now that we have a potentially pinned fdstore let's add a concept for cleaning it explicitly on user requested. Let's expose this via "systemctl clean", i.e. the same way as user directories are cleaned.
* | Merge pull request #25608 from poettering/dissect-moarLennart Poettering2023-04-122-1/+22
|\ \ | | | | | | dissect: add dissection policies
| * | tree-wide: hook up image dissection policy logic everywhereLennart Poettering2023-04-052-1/+22
| |/
* | systemctl: reduce variable scopeDavid Tardon2023-04-124-16/+19
| |
* | tree-wide: drop unneeded output paramsDavid Tardon2023-04-124-4/+4
| | | | | | | | | | | | Neither of the callers of bus_deserialize_and_dump_unit_file_changes() touches the changes array, so let's simplify things and keep it internal to the function.
* | Merge pull request #27033 from dtardon/array-cleanupYu Watanabe2023-04-124-47/+34
|\ \ | | | | | | Use CLEANUP_ARRAY more
| * | systemctl-set-default: use CLEANUP_ARRAYDavid Tardon2023-04-111-8/+7
| | |
| * | systemctl-preset-all: shorten code a tiny bitDavid Tardon2023-04-111-6/+5
| | |
| * | systemctl-preset-all: use CLEANUP_ARRAYDavid Tardon2023-04-111-11/+8
| | |
| * | systemctl-enable: use CLEANUP_ARRAYDavid Tardon2023-04-111-12/+9
| | |
| * | systemctl-add-dependency: shorten code a tiny bitDavid Tardon2023-04-111-6/+5
| | |
| * | systemctl-add-dependency: use CLEANUP_ARRAYDavid Tardon2023-04-111-14/+10
| |/
* | systemctl: suppress error for try-* if unit is maskedMike Yuan2023-04-111-2/+8
| | | | | | | | Closes #16521
* | tree-wide: A few more uses of "unmet" for conditionsColin Walters2023-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a followup to 413e8650b71d4404a7453403797f93d73d88c466 > tree-wide: Use "unmet" for condition checks, not "failed" Since I noticed when running `systemctl status` on a recent systemd still seeing `Condition: start condition failed` To recap the original rationale here for "unmet" is that it's normal for some units to be conditional, so the term "failure" here is too strong.
* | edit-util: introduce overwrite_with_origin switchMike Yuan2023-04-071-0/+1
| | | | | | | | | | | | | | Before this commit, if `original_path` is given, it will always be used to overwrite `path`. After this commit, it's controlled by the newly-added switch `overwrite_with_origin`.
* | edit-util: add DROPIN_MARKER_{START,END}Mike Yuan2023-04-071-5/+2
|/
* systemctl: show service status string in other colorLennart Poettering2023-03-281-1/+1
| | | | | | | | Let's add a dash of colour to separate our own status info from the the status info supplied by the service. (I wanted to make this italics, but apparently popular terminal emulators don't support that, such as xterm)
* systemctl: show fd store info in status outputLennart Poettering2023-03-281-0/+8
| | | | | | The fdstore might pin a non-trivial amount of resources. Let's hence display for services that enable it how many entries there are and what the size limit is.
* systemctl: dont's how memory limits that aren't available via D-Bus propsLennart Poettering2023-03-281-1/+5
| | | | | | | | | | When using an old systemctl on a new PID 1 the "startup" memory limit props are not initialized and currently be shown in status output as zero, even though there's code to suppress the output in that case. Alas it doesn't work, because the relevant fields are not marked as "unset"... Fix that. Follow-up for: 53fda560dc2c66502da7ad68db7d79b515a3601a
* chase-symlinks: Rename chase_symlinks() to chase()Daan De Meyer2023-03-242-5/+5
| | | | | | | | | Chasing symlinks is a core function that's used in a lot of places so it deservers a less verbose names so let's rename it to chase() and chaseat(). We also slightly change the pattern used for the chaseat() helpers so we get chase_and_openat() and similar.
* systemctl: move printing of state to the printing func.David Tardon2023-03-171-29/+28
| | | | No functional change, just refactoring.
* systemctl: drop stray empty lineDavid Tardon2023-03-171-1/+0
|
* systemctl: always print circular deps. at the endDavid Tardon2023-03-171-7/+10
| | | | | | | | | | | | | | Before: a.target ○ └─b.target ├─... ● └─paths.target After: a.target ○ └─b.target ● ├─paths.target └─...
* systemctl: fix formatting of circular dep.David Tardon2023-03-171-1/+1
| | | | | | | | | | | | | | Before: a.target ○ └─b.target └─... ● └─paths.target After: a.target ○ └─b.target ├─... ● └─paths.target
* systemctl: fix indentation of circular depsDavid Tardon2023-03-171-1/+1
| | | | | | | | | | | | | | | | | | We're still at level `level` here. Before: b.target ○ ├─a.target │ └─... ● └─paths.target After: b.target ○ ├─a.target │ └─... ● └─paths.target Fixes #26052.
* Merge pull request #26784 from DaanDeMeyer/chase-fixDaan De Meyer2023-03-151-2/+2
|\ | | | | Allow creating files and directories with chase_symlinks_open() and further improvements
| * chase-symlinks: Remove unused ret_fd argumentsDaan De Meyer2023-03-141-2/+2
| |
* | systemctl: add option --when for scheduled shutdownMike Yuan2023-03-143-21/+66
| | | | | | | | | | | | | | Pass an empty string or "cancel" will cancel the action. Pass "show" will show the scheduled actions. Replaces #17258
* | systemctl: logind: make logind_schedule_shutdown accept action as paramMike Yuan2023-03-143-5/+7
| |
* | systemctl: logind: add missing assertsMike Yuan2023-03-141-1/+9
|/
* systemctl: refuse to acquire dbus connection with --globalYu Watanabe2023-03-131-0/+3
| | | | | | | | | Maybe, better to check the runtime scope each verb for better log message, but this is a good start point to not trigger assertion. Fixes oss-fuzz#56915 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56915). Fixes #26402 and #26754.
* systemctl-edit: invert one error checkYu Watanabe2023-03-111-3/+3
|
* systemctl-edit: shorten code a bitYu Watanabe2023-03-111-10/+2
|
* systemctl: edit: several cleanupsMike Yuan2023-03-111-14/+23
|
* edit-util: introduce EditFileContextMike Yuan2023-03-111-85/+28
| | | | | | | | | | | | | | | | | | This is a rather large change which moves the add and install logic into edit-util. We store an EditFile array and the number of elements, along with the edit markers used in temporary files and whether to remove the parent directories of the target files if they're empty in an EditFileContext object. Call edit_files_add() to add an file to edit, and do_edit_files_and_install() to do the actual editing (through create_edit_temp_file(), run_editor() and trim_edit_markers()). After that, edit_file_context_done() can be used to destroy the object.
* shared: extract edit-util from systemctl-editMike Yuan2023-03-111-254/+4
|
* runtime-scope: add helper that turns RuntimeScope enum into --system/--user ↵Lennart Poettering2023-03-101-1/+1
| | | | string
* basic: add RuntimeScope enumLennart Poettering2023-03-1014-51/+47
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* systemctl: port FOREACH_ARRAY() to systemctl-list-units.cYu Watanabe2023-03-071-13/+13
|
* systemctl: explicitly cast the constants to uint64_tFrantisek Sumsal2023-03-031-1/+1
| | | | | | | | | | | | | | | | | | | Otherwise under certain conditions `va_arg()` might get garbage instead of the expected value, i.e.: $ sudo build-o0/systemctl disable asdfasfaf sd_bus_message_appendv: Got uint64_t: 0 Failed to disable unit: Unit file asdfasfaf.service does not exist. $ sudo build-o1/systemctl disable asdfasfaf sd_bus_message_appendv: Got uint64_t: 7954875719681572864 Failed to disable unit: Invalid argument (reproduced on an armv7hl machine) Resolves: #26568 Follow-up to: bf1bea43f15 Related issue: https://github.com/systemd/systemd/pull/14470#discussion_r362893735