mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
journald: do not allow persistent journal storage in the initrd
If the user managed to configure persistent storage in the journal in the initrd, e.g. by creating /var/log/journal with default of 'auto', we could end up writing entries there. Let's make sure this doesn't happen.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "conf-parser.h"
|
||||
#include "creds-util.h"
|
||||
#include "daemon-util.h"
|
||||
#include "initrd-util.h"
|
||||
#include "journald-audit.h"
|
||||
#include "journald-config.h"
|
||||
#include "journald-context.h"
|
||||
@@ -117,6 +118,11 @@ void manager_merge_configs(Manager *m) {
|
||||
journal_config_done(&m->config);
|
||||
|
||||
MERGE_NON_NEGATIVE(storage, JOURNAL_STORAGE_DEFAULT_VAL);
|
||||
|
||||
/* In the initrd, only 'none' and 'volatile' make sense. */
|
||||
if (in_initrd() && IN_SET(m->config.storage, STORAGE_PERSISTENT, STORAGE_AUTO))
|
||||
m->config.storage = STORAGE_VOLATILE;
|
||||
|
||||
manager_merge_journal_compress_options(m);
|
||||
MERGE_NON_NEGATIVE(seal, true);
|
||||
/* By default, /dev/kmsg is read only by the main namespace instance. */
|
||||
|
||||
Reference in New Issue
Block a user