diff options
-rw-r--r-- | man/systemctl.xml | 12 | ||||
-rw-r--r-- | man/systemd.exec.xml | 2 | ||||
-rw-r--r-- | shell-completion/bash/systemctl.in | 2 | ||||
-rw-r--r-- | shell-completion/zsh/_systemctl.in | 1 | ||||
-rw-r--r-- | src/journal/journal-file.c | 67 | ||||
-rw-r--r-- | src/journal/journalctl.c | 4 | ||||
-rw-r--r-- | src/system-update-generator/system-update-generator.c | 25 | ||||
-rw-r--r-- | src/systemctl/systemctl.c | 1 |
8 files changed, 81 insertions, 33 deletions
diff --git a/man/systemctl.xml b/man/systemctl.xml index 87cf52172b..25db00e5f6 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -393,10 +393,14 @@ <xi:include href="user-system-options.xml" xpointer="user" /> <xi:include href="user-system-options.xml" xpointer="system" /> - <!-- we do not document -failed here, as it has been made - redundant by -state=failed, which it predates. To keep - things simple, we only document the new switch, while - keeping the old one around for compatibility only. --> + <varlistentry> + <term><option>--failed</option></term> + + <listitem> + <para>List units in failed state. This is equivalent to + <option>--state=failed</option>.</para> + </listitem> + </varlistentry> <varlistentry> <term><option>--no-wall</option></term> diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index f57e15e38c..699f6e263f 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -981,7 +981,7 @@ source path, destination path and option string, where the latter two are optional. If only a source path is specified the source and destination is taken to be the same. The option string may be either <literal>rbind</literal> or <literal>norbind</literal> for configuring a recursive or non-recursive bind - mount. If the destination parth is omitted, the option string must be omitted too.</para> + mount. If the destination path is omitted, the option string must be omitted too.</para> <para><varname>BindPaths=</varname> creates regular writable bind mounts (unless the source file system mount is already marked read-only), while <varname>BindReadOnlyPaths=</varname> creates read-only bind mounts. These diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 7765010869..e4ccad8799 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -126,7 +126,7 @@ _systemctl () { [STANDALONE]='--all -a --reverse --after --before --defaults --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall --now --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup - --show-types -i --ignore-inhibitors --plain' + --show-types -i --ignore-inhibitors --plain --failed' [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root --preset-mode -n --lines -o --output -M --machine' ) diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 553216da5e..92a56ba99a 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -386,4 +386,5 @@ _arguments -s \ {-o+,--output=}'[Change journal output mode]:modes:_sd_outputmodes' \ '--firmware-setup[Tell the firmware to show the setup menu on next boot]' \ '--plain[When used with list-dependencies, print output as a list]' \ + '--failed[Show failed units]' \ '*::systemctl command:_systemctl_command' diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 0a264aef92..aeda127784 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -42,6 +42,7 @@ #include "sd-event.h" #include "set.h" #include "string-util.h" +#include "strv.h" #include "xattr-util.h" #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem)) @@ -507,42 +508,58 @@ static int journal_file_refresh_header(JournalFile *f) { return r; } -static int journal_file_verify_header(JournalFile *f) { +static bool warn_wrong_flags(const JournalFile *f, bool compatible) { + const uint32_t any = compatible ? HEADER_COMPATIBLE_ANY : HEADER_INCOMPATIBLE_ANY, + supported = compatible ? HEADER_COMPATIBLE_SUPPORTED : HEADER_INCOMPATIBLE_SUPPORTED; + const char *type = compatible ? "compatible" : "incompatible"; uint32_t flags; + flags = le32toh(compatible ? f->header->compatible_flags : f->header->incompatible_flags); + + if (flags & ~supported) { + if (flags & ~any) + log_debug("Journal file %s has unknown %s flags 0x%"PRIx32, + f->path, type, flags & ~any); + flags = (flags & any) & ~supported; + if (flags) { + const char* strv[3]; + unsigned n = 0; + _cleanup_free_ char *t = NULL; + + if (compatible && (flags & HEADER_COMPATIBLE_SEALED)) + strv[n++] = "sealed"; + if (!compatible && (flags & HEADER_INCOMPATIBLE_COMPRESSED_XZ)) + strv[n++] = "xz-compressed"; + if (!compatible && (flags & HEADER_INCOMPATIBLE_COMPRESSED_LZ4)) + strv[n++] = "lz4-compressed"; + strv[n] = NULL; + assert(n < ELEMENTSOF(strv)); + + t = strv_join((char**) strv, ", "); + log_debug("Journal file %s uses %s %s %s disabled at compilation time.", + f->path, type, n > 1 ? "flags" : "flag", strnull(t)); + } + return true; + } + + return false; +} + +static int journal_file_verify_header(JournalFile *f) { assert(f); assert(f->header); if (memcmp(f->header->signature, HEADER_SIGNATURE, 8)) return -EBADMSG; - /* In both read and write mode we refuse to open files with - * incompatible flags we don't know */ - flags = le32toh(f->header->incompatible_flags); - if (flags & ~HEADER_INCOMPATIBLE_SUPPORTED) { - if (flags & ~HEADER_INCOMPATIBLE_ANY) - log_debug("Journal file %s has unknown incompatible flags %"PRIx32, - f->path, flags & ~HEADER_INCOMPATIBLE_ANY); - flags = (flags & HEADER_INCOMPATIBLE_ANY) & ~HEADER_INCOMPATIBLE_SUPPORTED; - if (flags) - log_debug("Journal file %s uses incompatible flags %"PRIx32 - " disabled at compilation time.", f->path, flags); + /* In both read and write mode we refuse to open files with incompatible + * flags we don't know. */ + if (warn_wrong_flags(f, false)) return -EPROTONOSUPPORT; - } - /* When open for writing we refuse to open files with - * compatible flags, too */ - flags = le32toh(f->header->compatible_flags); - if (f->writable && (flags & ~HEADER_COMPATIBLE_SUPPORTED)) { - if (flags & ~HEADER_COMPATIBLE_ANY) - log_debug("Journal file %s has unknown compatible flags %"PRIx32, - f->path, flags & ~HEADER_COMPATIBLE_ANY); - flags = (flags & HEADER_COMPATIBLE_ANY) & ~HEADER_COMPATIBLE_SUPPORTED; - if (flags) - log_debug("Journal file %s uses compatible flags %"PRIx32 - " disabled at compilation time.", f->path, flags); + /* When open for writing we refuse to open files with compatible flags, too. */ + if (f->writable && warn_wrong_flags(f, true)) return -EPROTONOSUPPORT; - } if (f->header->state >= _STATE_MAX) return -EBADMSG; diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 2a5f2b37e8..2639fd6cf5 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1910,7 +1910,9 @@ static int access_check(sd_journal *j) { break; case EPROTONOSUPPORT: - log_warning_errno(err, "Journal file %s uses an unsupported feature, ignoring file.", path); + log_warning_errno(err, "Journal file %1$s uses an unsupported feature, ignoring file.\n" + "Use SYSTEMD_LOG_LEVEL=debug journalctl --file=%1$s to see the details.", + path); break; case EBADMSG: diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c index 6ffb169b21..f1514c9638 100644 --- a/src/system-update-generator/system-update-generator.c +++ b/src/system-update-generator/system-update-generator.c @@ -22,6 +22,7 @@ #include "fs-util.h" #include "log.h" +#include "proc-cmdline.h" #include "special.h" #include "string-util.h" #include "util.h" @@ -47,11 +48,27 @@ static int generate_symlink(void) { if (symlink(SYSTEM_DATA_UNIT_PATH "/system-update.target", p) < 0) return log_error_errno(errno, "Failed to create symlink %s: %m", p); + return 1; +} + +static int parse_proc_cmdline_item(const char *key, const char *value, void *data) { + assert(key); + + /* Check if a run level is specified on the kernel command line. The + * command line has higher priority than any on-disk configuration, so + * it'll make any symlink we create moot. + */ + + if (streq(key, "systemd.unit") && !proc_cmdline_value_missing(key, value)) + log_warning("Offline system update overriden by kernel command line systemd.unit= setting"); + else if (!value && runlevel_to_target(key)) + log_warning("Offline system update overriden by runlevel \"%s\" on the kernel command line", key); + return 0; } int main(int argc, char *argv[]) { - int r; + int r, k; if (argc > 1 && argc != 4) { log_error("This program takes three or no arguments."); @@ -69,5 +86,11 @@ int main(int argc, char *argv[]) { r = generate_symlink(); + if (r > 0) { + k = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); + if (k < 0) + log_warning_errno(k, "Failed to parse kernel command line, ignoring: %m"); + } + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index a20ca1bcb5..8f80559baf 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -6937,6 +6937,7 @@ static void systemctl_help(void) { " -a --all Show all properties/all units currently in memory,\n" " including dead/empty ones. To list all units installed on\n" " the system, use the 'list-unit-files' command instead.\n" + " --failed Same as --state=failed\n" " -l --full Don't ellipsize unit names on output\n" " -r --recursive Show unit list of host and local containers\n" " --reverse Show reverse dependencies with 'list-dependencies'\n" |