diff options
| author | Haitao Liu <haitao.liu@windriver.com> | 2025-04-23 09:48:38 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-05-02 08:12:41 -0700 |
| commit | 7cb984d5ed3d3f18da409df9edda7f8566d8c250 (patch) | |
| tree | c0286e2a65dfca93a4a652f69ad4d15c46c094b8 /meta/recipes-core | |
| parent | 9ace4f7ae54435e8e48b8fb1c06b09a380cc7f7b (diff) | |
| download | poky-7cb984d5ed3d3f18da409df9edda7f8566d8c250.tar.gz | |
systemd: systemd-journald fails to setup LogNamespace
A LogNamespace error for systemd v250:
"""
Apr 28 17:44:00 a-rinline2b systemd[467]:
systemd-journald@tester.service: Failed to set up special execution
directory in /var/log: Not a directory
Apr 28 17:44:00 a-rinline2b systemd[467]:
systemd-journald@tester.service: Failed at step LOGS_DIRECTORY spawning
/lib/systemd/systemd-journald: Not a directory
"""
That's because that "/var/log/journal" couldn't be created during
program runtime.
(From OE-Core rev: 8eb185024f9a9e57a9b710c70f09552729558892)
Signed-off-by: Haitao Liu <haitao.liu@windriver.com>
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-core')
| -rw-r--r-- | meta/recipes-core/systemd/systemd/0001-basic-do-not-warn-in-mkdir_p-when-parent-directory-e.patch | 78 | ||||
| -rw-r--r-- | meta/recipes-core/systemd/systemd_250.14.bb | 1 |
2 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-basic-do-not-warn-in-mkdir_p-when-parent-directory-e.patch b/meta/recipes-core/systemd/systemd/0001-basic-do-not-warn-in-mkdir_p-when-parent-directory-e.patch new file mode 100644 index 0000000000..723b8ca4f7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-basic-do-not-warn-in-mkdir_p-when-parent-directory-e.patch | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | From e01e68e70ae1db9fe61adec3e7bdcced7adc1930 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> | ||
| 3 | Date: Thu, 10 Feb 2022 08:30:08 +0100 | ||
| 4 | Subject: [PATCH] basic: do not warn in mkdir_p() when parent directory exists | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | This effectively disables warnings about type/mode/ownership of existing | ||
| 10 | directories when recursively creating parent directories. (Or files. If there's | ||
| 11 | a file in a place we expect a directory, the code will later try to create | ||
| 12 | a file and fail. This follows the general pattern where we do (void)mkdir() | ||
| 13 | if the mkdir() is immediately followed by opening of a file.) | ||
| 14 | |||
| 15 | I was recently debugging an issue with the fstab-generator [1], and it says: | ||
| 16 | 'Directory "/tmp" already exists, but has mode 0777 that is too permissive (0644 was requested), refusing.' | ||
| 17 | which is very specific but totally wrong in this context. | ||
| 18 | This output was added in 37c1d5e97dbc869edd8fc178427714e2d9428d2b, and I still | ||
| 19 | think it is worth to do it, because if you actually *do* want the directory, if | ||
| 20 | there's something wrong, the precise error message will make it much easier to | ||
| 21 | diagnose. And we can't easily pass the information what failed up the call chain | ||
| 22 | because there are multiple things we check (ownership, permission mask, type)… | ||
| 23 | So passing a param whether to warn or not down into the library code seems like | ||
| 24 | the best solution, despite not being very elegant. | ||
| 25 | |||
| 26 | [1] https://bugzilla.redhat.com/show_bug.cgi?id=2051285 | ||
| 27 | |||
| 28 | Upstream-Status: Backport [https://github.com/systemd/systemd/commit/e01e68e70ae1db9fe61adec3e7bdcced7adc1930] | ||
| 29 | |||
| 30 | Signed-off-by: Haitao Liu <haitao.liu@windriver.com> | ||
| 31 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 32 | --- | ||
| 33 | src/basic/mkdir.c | 5 ++++- | ||
| 34 | src/basic/mkdir.h | 5 +++-- | ||
| 35 | 2 files changed, 7 insertions(+), 3 deletions(-) | ||
| 36 | |||
| 37 | diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c | ||
| 38 | index 27144dd45a..cf7cf4a357 100644 | ||
| 39 | --- a/src/basic/mkdir.c | ||
| 40 | +++ b/src/basic/mkdir.c | ||
| 41 | @@ -55,6 +55,9 @@ int mkdir_safe_internal( | ||
| 42 | return -errno; | ||
| 43 | } | ||
| 44 | |||
| 45 | + if (flags & MKDIR_IGNORE_EXISTING) | ||
| 46 | + return 0; | ||
| 47 | + | ||
| 48 | if (!S_ISDIR(st.st_mode)) | ||
| 49 | return log_full_errno(flags & MKDIR_WARN_MODE ? LOG_WARNING : LOG_DEBUG, SYNTHETIC_ERRNO(ENOTDIR), | ||
| 50 | "Path \"%s\" already exists and is not a directory, refusing.", path); | ||
| 51 | @@ -142,7 +145,7 @@ int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, ui | ||
| 52 | s[n] = '\0'; | ||
| 53 | |||
| 54 | if (!prefix || !path_startswith_full(prefix, path, /* accept_dot_dot= */ false)) { | ||
| 55 | - r = mkdir_safe_internal(path, mode, uid, gid, flags, _mkdirat); | ||
| 56 | + r = mkdir_safe_internal(path, mode, uid, gid, flags | MKDIR_IGNORE_EXISTING, _mkdirat); | ||
| 57 | if (r < 0 && r != -EEXIST) | ||
| 58 | return r; | ||
| 59 | } | ||
| 60 | diff --git a/src/basic/mkdir.h b/src/basic/mkdir.h | ||
| 61 | index 34a5227577..c0c0ea6c4f 100644 | ||
| 62 | --- a/src/basic/mkdir.h | ||
| 63 | +++ b/src/basic/mkdir.h | ||
| 64 | @@ -4,8 +4,9 @@ | ||
| 65 | #include <sys/types.h> | ||
| 66 | |||
| 67 | typedef enum MkdirFlags { | ||
| 68 | - MKDIR_FOLLOW_SYMLINK = 1 << 0, | ||
| 69 | - MKDIR_WARN_MODE = 1 << 1, | ||
| 70 | + MKDIR_FOLLOW_SYMLINK = 1 << 0, | ||
| 71 | + MKDIR_IGNORE_EXISTING = 1 << 1, /* Quietly accept a preexisting directory (or file) */ | ||
| 72 | + MKDIR_WARN_MODE = 1 << 2, /* Log at LOG_WARNING when mode doesn't match */ | ||
| 73 | } MkdirFlags; | ||
| 74 | |||
| 75 | int mkdirat_errno_wrapper(int dirfd, const char *pathname, mode_t mode); | ||
| 76 | -- | ||
| 77 | 2.25.1 | ||
| 78 | |||
diff --git a/meta/recipes-core/systemd/systemd_250.14.bb b/meta/recipes-core/systemd/systemd_250.14.bb index b79284d79c..b3e31e1f23 100644 --- a/meta/recipes-core/systemd/systemd_250.14.bb +++ b/meta/recipes-core/systemd/systemd_250.14.bb | |||
| @@ -30,6 +30,7 @@ SRC_URI += "file://touchscreen.rules \ | |||
| 30 | file://fix-vlan-qos-mapping.patch \ | 30 | file://fix-vlan-qos-mapping.patch \ |
| 31 | file://0001-core-fix-build-when-seccomp-is-off.patch \ | 31 | file://0001-core-fix-build-when-seccomp-is-off.patch \ |
| 32 | file://0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch \ | 32 | file://0001-journal-Make-sd_journal_previous-next-return-0-at-HE.patch \ |
| 33 | file://0001-basic-do-not-warn-in-mkdir_p-when-parent-directory-e.patch \ | ||
| 33 | " | 34 | " |
| 34 | 35 | ||
| 35 | # patches needed by musl | 36 | # patches needed by musl |
