diff --git a/NEWS b/NEWS index 26148ce1c7..10f8bffd23 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,12 @@ CHANGES WITH 259 in spe: command to add recovery keys to existing user accounts. Previously, recovery keys could only be configured during initial user creation. + * The default storage mode for the journal is now 'persistent'. + Previously, the default was 'auto', so the presence or lack of + /var/log/journal determined the default storage mode, if no + overriding configuration was provided. The default can be changed + with -Djournal-storage-default=. + CHANGES WITH 258: Incompatible changes: diff --git a/man/custom-entities.ent.in b/man/custom-entities.ent.in index 9ec6ef92cc..1f3ecefe61 100644 --- a/man/custom-entities.ent.in +++ b/man/custom-entities.ent.in @@ -10,13 +10,14 @@ + - - - + + + diff --git a/man/journald.conf.xml b/man/journald.conf.xml index 1d615b110d..322fe6d17b 100644 --- a/man/journald.conf.xml +++ b/man/journald.conf.xml @@ -1,6 +1,9 @@ + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + +%entities; +]> /var/log/journal directory exists, and volatile otherwise (the existence of the directory controls the storage mode). none turns off all storage, all log data received will be dropped (but forwarding to other targets, such as the console, - the kernel log buffer, or a syslog socket will still work). Defaults to auto in - the default journal namespace, and persistent in all others. + the kernel log buffer, or a syslog socket will still work). Defaults to + &JOURNAL_STORAGE_DEFAULT; in the default journal namespace (this value is + determined at compilation time), and persistent in all others. Note that journald will initially use volatile storage, until a call to journalctl --flush (or sending SIGUSR1 to journald) will cause diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index d3c345dbb4..b7fe53dc9c 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -581,9 +581,9 @@ DefaultTimeoutStartSec= and DefaultTimeoutStopSec= - default to &DEFAULT_TIMEOUT; in the system manager and &DEFAULT_USER_TIMEOUT; in the user manager. - DefaultTimeoutAbortSec= is not set by default so that all units fall back to - TimeoutStopSec=. DefaultRestartSec= defaults to 100 ms. + default to &DEFAULT_TIMEOUT_SEC; in the system manager and &DEFAULT_USER_TIMEOUT_SEC; in the user + manager. DefaultTimeoutAbortSec= is not set by default so that all units fall back + to TimeoutStopSec=. DefaultRestartSec= defaults to 100 ms. @@ -597,8 +597,8 @@ and /etc/crypttab (see systemd.mount5, crypttab5). - Defaults to &DEFAULT_TIMEOUT; in the system manager and &DEFAULT_USER_TIMEOUT; in the user manager. - + Defaults to &DEFAULT_TIMEOUT_SEC; in the system manager and &DEFAULT_USER_TIMEOUT_SEC; in the user + manager. diff --git a/man/vconsole.conf.xml b/man/vconsole.conf.xml index 5b3524d729..e5e160cf3d 100644 --- a/man/vconsole.conf.xml +++ b/man/vconsole.conf.xml @@ -75,11 +75,11 @@ KEYMAP= KEYMAP_TOGGLE= - Configures the key mapping table for the keyboard. KEYMAP= - defaults to &DEFAULT_KEYMAP; if not set. Specially, if @kernel - is specified, no keymap will be loaded, i.e. the kernel's default keymap is used. The - KEYMAP_TOGGLE= can be used to configure a second toggle keymap and is by default - unset. + Configures the key mapping table for the keyboard. KEYMAP= + defaults to &SYSTEMD_DEFAULT_KEYMAP; if not set. As a special case, if + @kernel is specified, no keymap will be loaded, i.e. the kernel's default keymap + will be used. The KEYMAP_TOGGLE= can be used to configure a second toggle keymap + and is by default unset. diff --git a/meson.build b/meson.build index 599d2a3217..055ee31ee4 100644 --- a/meson.build +++ b/meson.build @@ -117,6 +117,9 @@ conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max')) conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open')) conf.set('HIGH_RLIMIT_NOFILE', 512*1024) +conf.set('JOURNAL_STORAGE_DEFAULT', get_option('journal-storage-default')) +conf.set('JOURNAL_STORAGE_DEFAULT_VAL', 'STORAGE_' + get_option('journal-storage-default').to_upper()) + # Meson ignores the preceding arguments when joining paths if an absolute # component is encountered, so this should canonicalize various paths when they # are absolute or relative. @@ -3096,6 +3099,7 @@ summary({ 'default locale' : default_locale, 'default nspawn locale' : nspawn_locale, 'default status unit format' : status_unit_format_default, + 'default journal storage mode' : conf.get('JOURNAL_STORAGE_DEFAULT'), 'default user $PATH' : default_user_path != '' ? default_user_path : '(same as system services)', 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog, 'time epoch' : f'@time_epoch@ (@alt_time_epoch@)', diff --git a/meson_options.txt b/meson_options.txt index 1d7c4f4bd2..4ce3c7faca 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -139,6 +139,8 @@ option('timedated', type : 'boolean', description : 'install the systemd-timedated daemon') option('timesyncd', type : 'boolean', description : 'install the systemd-timesyncd daemon') +option('journal-storage-default', type : 'combo', choices : ['persistent', 'auto', 'volatile', 'none'], + description : 'default storage mode for journald (main namespace)') option('remote', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' }, description : 'support for "journal over the network"') option('create-log-dirs', type : 'boolean', diff --git a/src/journal/journald-config.c b/src/journal/journald-config.c index 8cffec880b..b524379b5c 100644 --- a/src/journal/journald-config.c +++ b/src/journal/journald-config.c @@ -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" @@ -116,7 +117,12 @@ void manager_merge_configs(Manager *m) { journal_config_done(&m->config); - MERGE_NON_NEGATIVE(storage, STORAGE_AUTO); + 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. */ diff --git a/src/journal/journald.conf b/src/journal/journald.conf.in similarity index 97% rename from src/journal/journald.conf rename to src/journal/journald.conf.in index 9a12ca7657..805b79bc8a 100644 --- a/src/journal/journald.conf +++ b/src/journal/journald.conf.in @@ -17,7 +17,7 @@ # See journald.conf(5) for details. [Journal] -#Storage=auto +#Storage={{ JOURNAL_STORAGE_DEFAULT }} #Compress=yes #Seal=yes #SplitMode=uid diff --git a/src/journal/meson.build b/src/journal/meson.build index 364c4ce7bf..7f35421e15 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -153,10 +153,12 @@ executables += [ }, ] -if install_sysconfdir_samples - install_data('journald.conf', - install_dir : pkgconfigfiledir) -endif +custom_target( + input : 'journald.conf.in', + output: 'journald.conf', + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], + install : install_sysconfdir_samples, + install_dir : pkgconfigfiledir) if get_option('create-log-dirs') install_emptydir('/var/log/journal',