From b98e3866fddf2edfa13fc1b4323aa84f89336ff2 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Fri, 12 Jul 2013 20:57:15 -0700 Subject: [PATCH] journalctl: have a useful --setup-keys error message when using non-persistant logging Generating seed... Generating key pair... Generating sealing key... Failed to open /var/log/journal/33f46101703a10c5fc6fa4f451840101/fss.tmp.k2wDDU: No such file or directory --- src/journal/journalctl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 7baea237c..32665b7f7 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -725,6 +725,19 @@ static int setup_keys(void) { char *p = NULL, *k = NULL; struct FSSHeader h; uint64_t n; + struct stat st; + + r = stat("/var/log/journal", &st); + if (r < 0 && errno != ENOENT && errno != ENOTDIR) { + log_error("stat(\"%s\") failed: %m", "/var/log/journal"); + return -errno; + } + + if (r < 0 || !S_ISDIR(st.st_mode)) { + log_error("%s is not a directory, must be using persistent logging for FSS.", + "/var/log/journal"); + return r < 0 ? -errno : -ENOTDIR; + } r = sd_id128_get_machine(&machine); if (r < 0) { -- 2.30.2