Make journal persistent by default (#39624)

See second commit for details.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-11-13 09:43:00 +01:00
committed by GitHub
10 changed files with 47 additions and 22 deletions
+6
View File
@@ -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:
+4 -3
View File
@@ -10,13 +10,14 @@
<!ENTITY FALLBACK_HOSTNAME "{{FALLBACK_HOSTNAME}}">
<!ENTITY MEMORY_ACCOUNTING_DEFAULT "{{ 'yes' if MEMORY_ACCOUNTING_DEFAULT else 'no' }}">
<!ENTITY KILL_USER_PROCESSES "{{ 'yes' if KILL_USER_PROCESSES else 'no' }}">
<!ENTITY JOURNAL_STORAGE_DEFAULT "{{JOURNAL_STORAGE_DEFAULT}}">
<!ENTITY DEBUGTTY "{{DEBUGTTY}}">
<!ENTITY SYSTEM_SYSVRCLOCAL_PATH "{{SYSTEM_SYSVRCLOCAL_PATH}}">
<!ENTITY HIGH_RLIMIT_NOFILE "{{HIGH_RLIMIT_NOFILE}}">
<!ENTITY DEFAULT_DNSSEC_MODE "{{DEFAULT_DNSSEC_MODE_STR}}">
<!ENTITY DEFAULT_DNS_OVER_TLS_MODE "{{DEFAULT_DNS_OVER_TLS_MODE_STR}}">
<!ENTITY DEFAULT_TIMEOUT "{{DEFAULT_TIMEOUT_SEC}} s">
<!ENTITY DEFAULT_USER_TIMEOUT "{{DEFAULT_USER_TIMEOUT_SEC}} s">
<!ENTITY DEFAULT_KEYMAP "{{SYSTEMD_DEFAULT_KEYMAP}}">
<!ENTITY DEFAULT_TIMEOUT_SEC "{{DEFAULT_TIMEOUT_SEC}} s">
<!ENTITY DEFAULT_USER_TIMEOUT_SEC "{{DEFAULT_USER_TIMEOUT_SEC}} s">
<!ENTITY SYSTEMD_DEFAULT_KEYMAP "{{SYSTEMD_DEFAULT_KEYMAP}}">
<!ENTITY fedora_latest_version "43">
<!ENTITY fedora_cloud_release "1.6">
+7 -3
View File
@@ -1,6 +1,9 @@
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="journald.conf"
@@ -82,8 +85,9 @@
<filename>/var/log/journal</filename> directory exists, and <literal>volatile</literal> otherwise
(the existence of the directory controls the storage mode). <literal>none</literal> 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 <literal>auto</literal> in
the default journal namespace, and <literal>persistent</literal> in all others.</para>
the kernel log buffer, or a syslog socket will still work). Defaults to
<literal>&JOURNAL_STORAGE_DEFAULT;</literal> in the default journal namespace (this value is
determined at compilation time), and <literal>persistent</literal> in all others.</para>
<para>Note that journald will initially use volatile storage, until a call to
<command>journalctl --flush</command> (or sending <constant>SIGUSR1</constant> to journald) will cause
+5 -5
View File
@@ -581,9 +581,9 @@
</para>
<para><varname>DefaultTimeoutStartSec=</varname> and <varname>DefaultTimeoutStopSec=</varname>
default to &DEFAULT_TIMEOUT; in the system manager and &DEFAULT_USER_TIMEOUT; in the user manager.
<varname>DefaultTimeoutAbortSec=</varname> is not set by default so that all units fall back to
<varname>TimeoutStopSec=</varname>. <varname>DefaultRestartSec=</varname> defaults to 100 ms.
default to &DEFAULT_TIMEOUT_SEC; in the system manager and &DEFAULT_USER_TIMEOUT_SEC; in the user
manager. <varname>DefaultTimeoutAbortSec=</varname> is not set by default so that all units fall back
to <varname>TimeoutStopSec=</varname>. <varname>DefaultRestartSec=</varname> defaults to 100 ms.
</para>
<xi:include href="version-info.xml" xpointer="v209"/></listitem>
@@ -597,8 +597,8 @@
and <filename>/etc/crypttab</filename> (see
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
Defaults to &DEFAULT_TIMEOUT; in the system manager and &DEFAULT_USER_TIMEOUT; in the user manager.
</para>
Defaults to &DEFAULT_TIMEOUT_SEC; in the system manager and &DEFAULT_USER_TIMEOUT_SEC; in the user
manager.</para>
<xi:include href="version-info.xml" xpointer="v252"/></listitem>
</varlistentry>
+5 -5
View File
@@ -75,11 +75,11 @@
<term><varname>KEYMAP=</varname></term>
<term><varname>KEYMAP_TOGGLE=</varname></term>
<listitem><para>Configures the key mapping table for the keyboard. <varname>KEYMAP=</varname>
defaults to <literal>&DEFAULT_KEYMAP;</literal> if not set. Specially, if <literal>@kernel</literal>
is specified, no keymap will be loaded, i.e. the kernel's default keymap is used. The
<varname>KEYMAP_TOGGLE=</varname> can be used to configure a second toggle keymap and is by default
unset.</para></listitem>
<listitem><para>Configures the key mapping table for the keyboard. <varname>KEYMAP=</varname>
defaults to <literal>&SYSTEMD_DEFAULT_KEYMAP;</literal> if not set. As a special case, if
<literal>@kernel</literal> is specified, no keymap will be loaded, i.e. the kernel's default keymap
will be used. The <varname>KEYMAP_TOGGLE=</varname> can be used to configure a second toggle keymap
and is by default unset.</para></listitem>
</varlistentry>
<varlistentry>
+4
View File
@@ -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@)',
+2
View File
@@ -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',
+7 -1
View File
@@ -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. */
@@ -17,7 +17,7 @@
# See journald.conf(5) for details.
[Journal]
#Storage=auto
#Storage={{ JOURNAL_STORAGE_DEFAULT }}
#Compress=yes
#Seal=yes
#SplitMode=uid
+6 -4
View File
@@ -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',