mirror of
https://github.com/systemd/systemd
synced 2025-10-05 11:44:45 +02:00
Compare commits
No commits in common. "111e2a106cde7236c53c92a247ae29d0d17c2561" and "afef98ecf84ee1a94a16710a99ecc6498556ad26" have entirely different histories.
111e2a106c
...
afef98ecf8
36
po/sl.po
36
po/sl.po
@ -1,13 +1,13 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# Martin Srebotnjak <miles@filmsi.net>, 2024, 2025.
|
||||
# Martin Srebotnjak <miles@filmsi.net>, 2024.
|
||||
# Weblate Translation Memory <noreply-mt-weblate-translation-memory@weblate.org>, 2024.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: systemd\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-07-23 15:38+0100\n"
|
||||
"PO-Revision-Date: 2025-07-25 00:08+0000\n"
|
||||
"PO-Revision-Date: 2024-12-04 02:38+0000\n"
|
||||
"Last-Translator: Martin Srebotnjak <miles@filmsi.net>\n"
|
||||
"Language-Team: Slovenian <https://translate.fedoraproject.org/projects/"
|
||||
"systemd/main/sl/>\n"
|
||||
@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || "
|
||||
"n%100==4 ? 2 : 3;\n"
|
||||
"X-Generator: Weblate 5.12.2\n"
|
||||
"X-Generator: Weblate 5.8.2\n"
|
||||
|
||||
#: src/core/org.freedesktop.systemd1.policy.in:22
|
||||
msgid "Send passphrase back to system"
|
||||
@ -166,13 +166,15 @@ msgstr ""
|
||||
|
||||
#: src/home/org.freedesktop.home1.policy:93
|
||||
msgid "Manage Home Directory Signing Keys"
|
||||
msgstr "Upravljaj podpisne ključe domače mape"
|
||||
msgstr ""
|
||||
|
||||
#: src/home/org.freedesktop.home1.policy:94
|
||||
#, fuzzy
|
||||
#| msgid "Authentication is required to manage system services or other units."
|
||||
msgid "Authentication is required to manage signing keys for home directories."
|
||||
msgstr ""
|
||||
"Preverjanje pristnosti je potrebno za upravljanje podpisnih ključev za "
|
||||
"domače mape."
|
||||
"Preverjanje pristnosti je potrebno za upravljanje sistemskih storitev ali "
|
||||
"drugih enot."
|
||||
|
||||
#: src/home/pam_systemd_home.c:336
|
||||
#, c-format
|
||||
@ -927,14 +929,19 @@ msgstr ""
|
||||
"računalnikov in vsebnikov."
|
||||
|
||||
#: src/machine/org.freedesktop.machine1.policy:106
|
||||
#, fuzzy
|
||||
#| msgid "Create a local virtual machine or container"
|
||||
msgid "Register a local virtual machine or container"
|
||||
msgstr "Registriraj krajevni navidezni računalnik ali vsebnik"
|
||||
msgstr "Ustvari krajevni navidezni računalnik ali vsebnik"
|
||||
|
||||
#: src/machine/org.freedesktop.machine1.policy:107
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "Authentication is required to create a local virtual machine or container."
|
||||
msgid ""
|
||||
"Authentication is required to register a local virtual machine or container."
|
||||
msgstr ""
|
||||
"Preverjanje pristnosti je potrebno za registracijo krajevnih navideznih "
|
||||
"Preverjanje pristnosti je potrebno za ustvarjanje krajevnih navideznih "
|
||||
"računalnikov in vsebnikov."
|
||||
|
||||
#: src/machine/org.freedesktop.machine1.policy:116
|
||||
@ -1180,11 +1187,14 @@ msgstr ""
|
||||
|
||||
#: src/resolve/org.freedesktop.resolve1.policy:154
|
||||
msgid "Subscribe to DNS configuration"
|
||||
msgstr "Naroči se na prilagoditev DNS"
|
||||
msgstr ""
|
||||
|
||||
#: src/resolve/org.freedesktop.resolve1.policy:155
|
||||
#, fuzzy
|
||||
#| msgid "Authentication is required to subscribe query results."
|
||||
msgid "Authentication is required to subscribe to DNS configuration."
|
||||
msgstr "Za naročanje na prilagoditev DNS je potrebno preverjanje pristnosti."
|
||||
msgstr ""
|
||||
"Za naročanje na rezultate poizvedbe je potrebno preverjanje pristnosti."
|
||||
|
||||
#: src/resolve/org.freedesktop.resolve1.policy:165
|
||||
msgid "Dump cache"
|
||||
@ -1333,12 +1343,16 @@ msgstr ""
|
||||
"»$(unit)«."
|
||||
|
||||
#: src/core/dbus-unit.c:620
|
||||
#, fuzzy
|
||||
#| msgid ""
|
||||
#| "Authentication is required to send a UNIX signal to the processes of "
|
||||
#| "'$(unit)'."
|
||||
msgid ""
|
||||
"Authentication is required to send a UNIX signal to the processes of "
|
||||
"subgroup of '$(unit)'."
|
||||
msgstr ""
|
||||
"Preverjanje pristnosti je potrebno za pošiljanje signala UNIX procesom "
|
||||
"podenote »$(unit)«."
|
||||
"»$(unit)«."
|
||||
|
||||
#: src/core/dbus-unit.c:648
|
||||
msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
|
||||
|
@ -765,7 +765,6 @@ static int method_generic_unit_operation(
|
||||
sd_bus_message *message,
|
||||
Manager *m,
|
||||
sd_bus_error *error,
|
||||
UnitType type,
|
||||
sd_bus_message_handler_t handler,
|
||||
GenericUnitOperationFlags flags) {
|
||||
|
||||
@ -791,11 +790,6 @@ static int method_generic_unit_operation(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (type != _UNIT_TYPE_INVALID && u->type != type)
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
|
||||
"%s operation is not supported for unit type '%s'",
|
||||
sd_bus_message_get_member(message), unit_type_to_string(u->type));
|
||||
|
||||
if (FLAGS_SET(flags, GENERIC_UNIT_VALIDATE_LOADED)) {
|
||||
r = bus_unit_validate_load_state(u, error);
|
||||
if (r < 0)
|
||||
@ -807,7 +801,7 @@ static int method_generic_unit_operation(
|
||||
|
||||
static int method_enqueue_unit_job(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* We don't bother with GENERIC_UNIT_VALIDATE_LOADED here, as the job logic validates that anyway */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_enqueue_job, GENERIC_UNIT_LOAD);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_enqueue_job, GENERIC_UNIT_LOAD);
|
||||
}
|
||||
|
||||
static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
@ -834,61 +828,61 @@ static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd
|
||||
static int method_kill_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
|
||||
* matter whether a unit is loaded for killing any processes in the unit's cgroup. */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_kill, /* flags = */ 0);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_kill, 0);
|
||||
}
|
||||
|
||||
static int method_kill_unit_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
|
||||
* matter whether a unit is loaded for killing any processes in the unit's cgroup. */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_kill_subgroup, /* flags = */ 0);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_kill_subgroup, 0);
|
||||
}
|
||||
|
||||
static int method_clean_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Load the unit if necessary, in order to load it, and insist on the unit being loaded to be
|
||||
* cleaned */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_clean, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_clean, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_freeze_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Only active units can be frozen, which must be properly loaded already */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_freeze, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_freeze, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_thaw_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Same as freeze above */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_thaw, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_thaw, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_reset_failed_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Don't load the unit (because unloaded units can't be in failed state), and don't insist on the
|
||||
* unit to be loaded properly (since a failed unit might have its unit file disappeared) */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_reset_failed, /* flags = */ 0);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_reset_failed, 0);
|
||||
}
|
||||
|
||||
static int method_set_unit_properties(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Only change properties on fully loaded units, and load them in order to set properties */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_set_properties, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_set_properties, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_bind_mount_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Only add mounts on fully loaded units */
|
||||
return method_generic_unit_operation(message, userdata, error, UNIT_SERVICE, bus_service_method_bind_mount, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_service_method_bind_mount, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_mount_image_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Only add mounts on fully loaded units */
|
||||
return method_generic_unit_operation(message, userdata, error, UNIT_SERVICE, bus_service_method_mount_image, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_service_method_mount_image, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_ref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Only allow reffing of fully loaded units, and make sure reffing a unit loads it. */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_ref, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_ref, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_unref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Dropping a ref OTOH should not require the unit to still be loaded. And since a reffed unit is a
|
||||
* loaded unit there's no need to load the unit for unreffing it. */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_unref, /* flags = */ 0);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_unref, 0);
|
||||
}
|
||||
|
||||
static int reply_unit_info(sd_bus_message *reply, Unit *u) {
|
||||
@ -967,20 +961,20 @@ static int method_get_unit_processes(sd_bus_message *message, void *userdata, sd
|
||||
/* Don't load a unit actively (since it won't have any processes if it's not loaded), but don't
|
||||
* insist on the unit being loaded either (because even improperly loaded units might still have
|
||||
* processes around). */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_get_processes, /* flags = */ 0);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_get_processes, /* flags = */ 0);
|
||||
}
|
||||
|
||||
static int method_attach_processes_to_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Don't allow attaching new processes to units that aren't loaded. Don't bother with loading a unit
|
||||
* for this purpose though, as an unloaded unit is a stopped unit, and we don't allow attaching
|
||||
* processes to stopped units anyway. */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_attach_processes, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_attach_processes, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int method_remove_subgroup_from_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
/* Don't allow removal of subgroups from units that aren't loaded. But allow loading the unit, since
|
||||
* this is clean-up work, that is OK to do when the unit is stopped already. */
|
||||
return method_generic_unit_operation(message, userdata, error, _UNIT_TYPE_INVALID, bus_unit_method_remove_subgroup, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_unit_method_remove_subgroup, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED);
|
||||
}
|
||||
|
||||
static int transient_unit_from_message(
|
||||
@ -2827,7 +2821,7 @@ static int method_set_show_status(sd_bus_message *message, void *userdata, sd_bu
|
||||
}
|
||||
|
||||
static int method_dump_unit_descriptor_store(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
return method_generic_unit_operation(message, userdata, error, UNIT_SERVICE, bus_service_method_dump_file_descriptor_store, GENERIC_UNIT_VALIDATE_LOADED);
|
||||
return method_generic_unit_operation(message, userdata, error, bus_service_method_dump_file_descriptor_store, 0);
|
||||
}
|
||||
|
||||
static int method_start_aux_scope(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
|
@ -2290,8 +2290,6 @@ void manager_reopen_journals(Manager *m, const JournalConfig *old) {
|
||||
(void) manager_system_journal_open(m, /* flush_requested = */ false, /* relinquish_requested = */ false);
|
||||
|
||||
/* To make the storage related settings applied, vacuum the storage. */
|
||||
cache_space_invalidate(&m->system_storage.space);
|
||||
cache_space_invalidate(&m->runtime_storage.space);
|
||||
manager_vacuum(m, /* verbose = */ false);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,6 @@ Description=Log filtering unit
|
||||
Type=oneshot
|
||||
# If the service finishes extremely fast, journald cannot find the source of the
|
||||
# stream. Hence, we need to call 'journalctl --sync' before service finishes.
|
||||
ExecStart=bash -c 'echo "Logging from the service, and ~more~ foo bar"; journalctl --sync'
|
||||
ExecStart=sh -c 'echo "Logging from the service, and ~more~ foo bar"; journalctl --sync'
|
||||
SyslogLevel=notice
|
||||
LogLevelMax=info
|
||||
|
0
test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/prefix-shell.service
Normal file → Executable file
0
test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/prefix-shell.service
Normal file → Executable file
316
test/units/TEST-04-JOURNAL.journal-reload.sh
Executable file
316
test/units/TEST-04-JOURNAL.journal-reload.sh
Executable file
@ -0,0 +1,316 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# shellcheck disable=SC2016
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
MACHINE_ID="$(</etc/machine-id)"
|
||||
TEST_MSG_PREFIX="JOURNAL-RELOAD TEST"
|
||||
SYSLOG_ID="$(systemd-id128 new)"
|
||||
|
||||
write_to_journal() {
|
||||
local rand_val
|
||||
|
||||
rand_val=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 14)
|
||||
echo "$TEST_MSG_PREFIX $rand_val" | systemd-cat -t "$SYSLOG_ID"
|
||||
journalctl --sync
|
||||
|
||||
echo "$rand_val"
|
||||
}
|
||||
|
||||
verify_archived_journals() {
|
||||
local msg="$1"
|
||||
local journal_path_prefix="$2"
|
||||
local journal_dir="/$journal_path_prefix/log/journal/$MACHINE_ID"
|
||||
|
||||
for journal_file in "$journal_dir"/*; do
|
||||
filename=$(basename -- "$journal_file")
|
||||
if [[ "$filename" != "system.journal" ]]; then
|
||||
if journalctl --file="$journal_file" | grep -q "$msg"; then
|
||||
echo "Message present in archived journal: $filename"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
verify_journal() {
|
||||
local msg="$1"
|
||||
local entry_expected="$2"
|
||||
local test_name="$3"
|
||||
local journal_path_prefix="$4"
|
||||
|
||||
local path="/$journal_path_prefix/log/journal/$MACHINE_ID/system.journal"
|
||||
|
||||
if [ ! -e "$path" ] || ! grep -Fxq "MESSAGE=$TEST_MSG_PREFIX $msg" "$path"; then
|
||||
if [ "$entry_expected" == true ]; then
|
||||
echo "$test_name ERROR: Message not present in $journal_path_prefix journal. Checking archived journals..."
|
||||
if ! verify_archived_journals "$msg" "$journal_path_prefix"; then
|
||||
echo "$test_name ERROR: Message also not present in archived journals"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
else
|
||||
if [ "$entry_expected" == false ]; then
|
||||
echo "$test_name ERROR: Message present in $journal_path_prefix journal"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
verify_journals() {
|
||||
local msg="$1"
|
||||
local runtime_expected="$2"
|
||||
local system_expected="$3"
|
||||
local test_name="$4"
|
||||
|
||||
local failed=false
|
||||
|
||||
if ! verify_journal "$msg" "$runtime_expected" "$test_name" "run"; then
|
||||
failed=true
|
||||
fi
|
||||
|
||||
if ! verify_journal "$msg" "$system_expected" "$test_name" "var"; then
|
||||
failed=true
|
||||
fi
|
||||
|
||||
if [ "$failed" == true ]; then
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_num_archived_journals() {
|
||||
local journal_path_prefix="$1"
|
||||
|
||||
local journal_dir="/$journal_path_prefix/log/journal/$MACHINE_ID/"
|
||||
num_journal_files=$(find "$journal_dir" -type f -name "*.journal" ! -name "system.journal" | wc -l)
|
||||
|
||||
echo "$num_journal_files"
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
rm /run/systemd/journald.conf.d/reload.conf
|
||||
journalctl --vacuum-size=1M
|
||||
systemctl daemon-reload
|
||||
systemctl reload systemd-journald.service
|
||||
}
|
||||
|
||||
# Start clean slate.
|
||||
mkdir -p /run/systemd/journald.conf.d
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl restart systemd-journald.service
|
||||
|
||||
# Add entries in system.
|
||||
journalctl --flush
|
||||
rand_val1=$(write_to_journal)
|
||||
verify_journals "$rand_val1" false true "Confirming test setup after flush."
|
||||
|
||||
# Reload journald (persistent->persistent)
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
# Reload should persist persistent journal.
|
||||
verify_journals "$rand_val1" false true "Persistent->Persistent System Reload: "
|
||||
|
||||
rand_val1=$(write_to_journal)
|
||||
verify_journals "$rand_val1" false true "Persistent->Persistent System Post-Reload: "
|
||||
|
||||
# Add entries in runtime
|
||||
journalctl --relinquish
|
||||
rand_val2=$(write_to_journal)
|
||||
verify_journals "$rand_val2" true false "Confirming test setup after relinquish."
|
||||
|
||||
# Reload journald (persistent->persistent)
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
# System journal entries should stay in system journal, runtime in runtime.
|
||||
verify_journals "$rand_val1" false true "Persistent->Persistent Runtime Reload 1: "
|
||||
verify_journals "$rand_val2" true false "Persistent->Persistent Runtime Reload 2: "
|
||||
|
||||
# Write new message and confirm it's written to runtime.
|
||||
rand_val=$(write_to_journal)
|
||||
verify_journals "$rand_val" true false "Persistent->Persistent New Message After Reload: "
|
||||
|
||||
# Flush and confirm that messages are written to system.
|
||||
journalctl --flush
|
||||
rand_val=$(write_to_journal)
|
||||
verify_journals "$rand_val" false true "Persistent->Volatile New Message Before Reload: "
|
||||
|
||||
# Test persistent->volatile
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
EOF
|
||||
|
||||
# Confirm old message exists where it was written to (storage->storage).
|
||||
systemctl reload systemd-journald.service
|
||||
verify_journals "$rand_val" false true "Persistent->Volatile Reload: "
|
||||
|
||||
# Confirm that messages are written to only runtime journal.
|
||||
rand_val=$(write_to_journal)
|
||||
verify_journals "$rand_val" true false "Persistent->Volatile New Message After Reload: "
|
||||
|
||||
# Test volatile works and logs are NOT getting written to system journal despite flush.
|
||||
journalctl --flush
|
||||
rand_val=$(write_to_journal)
|
||||
verify_journals "$rand_val" true false "Persistent->Volatile New Message After Flush: "
|
||||
|
||||
# Test that the new limits (e.g., RuntimeMaxUse) take effect on reload.
|
||||
# Write 1M of data to runtime journal
|
||||
max_size=1048656 # (1 * 1024 * 1024) = 1048576, but centos has a different minimum value for some reason.
|
||||
set +x
|
||||
dd if=/dev/urandom bs=1M count=5 | base64 | systemd-cat -t "$SYSLOG_ID"
|
||||
set -x
|
||||
journalctl --vacuum-size=2M
|
||||
|
||||
total_size=$(du -sb "/run/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if [ "$total_size" -lt "$max_size" ]; then
|
||||
echo "ERROR: Journal size does not exceed RuntimeMaxUse limit"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Reload with RuntimeMaxUse=1M.
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
RuntimeMaxUse=1M
|
||||
EOF
|
||||
|
||||
# systemctl daemon-reload
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
sleep 15 # Wait for RuntimeMaxUse change to take effect.
|
||||
|
||||
# Confirm that runtime journal size shrunk to <=1M.
|
||||
total_size=$(du -sb "/run/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if [ "$total_size" -gt "$max_size" ]; then
|
||||
echo "ERROR: Journal size exceeds RuntimeMaxUse limit"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Prepare for volatile->persistent by getting rid of runtime limit. Otherwise, it will not write.
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl reload systemd-journald.service
|
||||
sleep 15 # Wait for RuntimeMaxUse change to take effect.
|
||||
|
||||
journalctl --vacuum-size=1M
|
||||
sleep 5
|
||||
|
||||
rand_val=$(write_to_journal)
|
||||
verify_journals "$rand_val" true false "Volatile->Persistent New Message Before Reload: "
|
||||
|
||||
# Reload volatile->persistent
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
EOF
|
||||
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
# Confirm that previous message is still in runtime journal.
|
||||
verify_journals "$rand_val" true false "Volatile->Persistent Reload: "
|
||||
|
||||
# Confirm that new messages are written to runtime journal.
|
||||
rand_val=$(write_to_journal)
|
||||
verify_journals "$rand_val" true false "Volatile->Persistent New Message After Reload: "
|
||||
|
||||
# Confirm that flushing writes to system journal.
|
||||
journalctl --flush
|
||||
verify_journals "$rand_val" false true "Volatile->Persistent New Message After Flush: "
|
||||
|
||||
set +x
|
||||
dd if=/dev/urandom bs=1M count=5 | base64 | systemd-cat -t "$SYSLOG_ID"
|
||||
set -x
|
||||
|
||||
max_size=$((2 * 1024 * 1024))
|
||||
total_size=$(du -sb "/var/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if [ "$total_size" -lt "$max_size" ]; then
|
||||
echo "ERROR: Journal size does not exceed SystemMaxUse limit"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure reloading without limit does not interfere with SystemMaxUse test.
|
||||
systemctl reload systemd-journald.service
|
||||
total_size=$(du -sb "/var/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if [ "$total_size" -lt "$max_size" ]; then
|
||||
echo "ERROR: Journal size does not exceed SystemMaxUse limit"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Write to storage to prepare for SystemMaxFiles test.
|
||||
journalctl --flush
|
||||
|
||||
num_var_journals=$(get_num_archived_journals "var")
|
||||
limit_var_journals=3
|
||||
if [ "$num_var_journals" -lt "$limit_var_journals" ]; then
|
||||
echo "Creating archive files."
|
||||
for (( i=0; i<=num_var_journals; i++ ))
|
||||
do
|
||||
echo "$TEST_MSG_PREFIX" | systemd-cat -t "$SYSLOG_ID"
|
||||
journalctl --rotate
|
||||
done
|
||||
|
||||
num_var_journals=$(get_num_archived_journals "var")
|
||||
if [ "$num_var_journals" -lt "$limit_var_journals" ]; then
|
||||
echo "ERROR: Number of journal files in /var/log/journal/$MACHINE_ID/ is less than $limit_var_journals"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Reload with less SystemMaxUse and SystemMaxFiles.
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
RuntimeMaxUse=2M
|
||||
SystemMaxUse=2M
|
||||
SystemMaxFiles=3
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
# New system journal needs to be created with the new configuration for change to take effect.
|
||||
journalctl --flush
|
||||
|
||||
# Check SystemMaxFiles
|
||||
num_var_journals=$(get_num_archived_journals "var")
|
||||
if [ "$num_var_journals" -gt "$limit_var_journals" ]; then
|
||||
echo "ERROR: Number of journal files in /var/log/journal/$MACHINE_ID/ is greater than $limit_var_journals"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 15
|
||||
|
||||
# Check SystemMaxUse
|
||||
total_size=$(du -sb "/var/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if [ "$total_size" -gt "$max_size" ]; then
|
||||
echo "ERROR: Journal size exceeds SystemMaxUse limit"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm /run/systemd/journald.conf.d/reload.conf
|
||||
journalctl --vacuum-size=1M
|
||||
systemctl daemon-reload
|
||||
systemctl reload systemd-journald.service
|
@ -1,236 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# shellcheck disable=SC2016
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
# shellcheck source=test/units/util.sh
|
||||
. "$(dirname "$0")"/util.sh
|
||||
|
||||
MACHINE_ID="$(</etc/machine-id)"
|
||||
SYSLOG_ID="$(systemd-id128 new)"
|
||||
|
||||
write_to_journal() {
|
||||
local service="test-${RANDOM}.service"
|
||||
|
||||
systemd-run -q --wait -u "$service" bash -c "echo service=$service invocation=\$INVOCATION_ID; journalctl --sync"
|
||||
echo "$service"
|
||||
}
|
||||
|
||||
verify_journals() {
|
||||
local service="${1:?}"
|
||||
local expected_storage="${2:?}"
|
||||
|
||||
local run_expected var_expected
|
||||
if [[ "$expected_storage" == runtime ]]; then
|
||||
run_expected=0
|
||||
var_expected=1
|
||||
elif [[ "$expected_storage" == persistent ]]; then
|
||||
run_expected=1
|
||||
var_expected=0
|
||||
else
|
||||
echo "unexpected storage: $expected_storage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
assert_rc "$run_expected" journalctl -q -D "/run/log/journal/$MACHINE_ID/" -u "$service" --grep "service=$service"
|
||||
assert_rc "$var_expected" journalctl -q -D "/var/log/journal/$MACHINE_ID/" -u "$service" --grep "service=$service"
|
||||
}
|
||||
|
||||
get_num_archived_journals() {
|
||||
local prefix=${1:?}
|
||||
|
||||
find "/$prefix/log/journal/$MACHINE_ID/" -type f -name "system@*.journal" | wc -l
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
set +e
|
||||
rm -rf /run/systemd/journald.conf.d
|
||||
systemctl reload systemd-journald.service
|
||||
}
|
||||
|
||||
trap cleanup EXIT ERR INT TERM
|
||||
|
||||
mkdir -p /run/systemd/journald.conf.d
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
EOF
|
||||
systemctl restart systemd-journald.service
|
||||
|
||||
: "Add entries in system."
|
||||
journalctl --flush
|
||||
VAL1=$(write_to_journal)
|
||||
verify_journals "$VAL1" persistent
|
||||
|
||||
: "Reload journald (persistent->persistent)"
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
: "Reload should persist persistent journal."
|
||||
verify_journals "$VAL1" persistent
|
||||
|
||||
: "Add entries in runtime"
|
||||
journalctl --relinquish
|
||||
VAL2=$(write_to_journal)
|
||||
verify_journals "$VAL2" runtime
|
||||
|
||||
: "Reload journald after relinquish (persistent->persistent)"
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
: "System journal entries should stay in system journal, runtime in runtime."
|
||||
verify_journals "$VAL1" persistent
|
||||
verify_journals "$VAL2" runtime
|
||||
|
||||
: "Write new message and confirm it's written to runtime."
|
||||
VAL=$(write_to_journal)
|
||||
verify_journals "$VAL" runtime
|
||||
|
||||
: "Flush and confirm that messages are written to system."
|
||||
journalctl --flush
|
||||
VAL=$(write_to_journal)
|
||||
verify_journals "$VAL" persistent
|
||||
|
||||
# Test persistent->volatile
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
EOF
|
||||
|
||||
: "Confirm old message exists where it was written to persistent journal."
|
||||
systemctl reload systemd-journald.service
|
||||
verify_journals "$VAL" persistent
|
||||
|
||||
: "Confirm that new message is written to runtime journal."
|
||||
VAL=$(write_to_journal)
|
||||
verify_journals "$VAL" runtime
|
||||
|
||||
: "Test volatile works and logs are NOT getting written to system journal despite flush."
|
||||
journalctl --flush
|
||||
VAL=$(write_to_journal)
|
||||
verify_journals "$VAL" runtime
|
||||
|
||||
: "Disable compression"
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
Compress=no
|
||||
EOF
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
: "write 2MB of data to runtime journal"
|
||||
set +x
|
||||
dd if=/dev/urandom bs=1M count=2 | base64 | systemd-cat -t "$SYSLOG_ID"
|
||||
set -x
|
||||
journalctl --sync
|
||||
journalctl --rotate
|
||||
|
||||
ls -l "/run/log/journal/$MACHINE_ID"
|
||||
|
||||
max_size=$((1 * 1024 * 1024))
|
||||
total_size=$(du -sb "/run/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if (( total_size < max_size )); then
|
||||
echo "ERROR: runtime journal size is smaller than 1MB."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "Reload with RuntimeMaxUse=1M."
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
RuntimeMaxUse=1M
|
||||
EOF
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
ls -l "/run/log/journal/$MACHINE_ID"
|
||||
|
||||
: "Confirm that runtime journal size shrunk to <= 1MB."
|
||||
total_size=$(du -sb "/run/log/journal/$MACHINE_ID" | cut -f1)
|
||||
num_archived_journals=$(get_num_archived_journals run)
|
||||
if (( total_size > max_size )) && (( num_archived_journals > 0 )); then
|
||||
echo "ERROR: Journal size exceeds RuntimeMaxUse= limit and exists archived journals."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "Write a message to runtime journal"
|
||||
VAL=$(write_to_journal)
|
||||
verify_journals "$VAL" runtime
|
||||
|
||||
: "Reload volatile->persistent"
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
EOF
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
: "Confirm that previous message is still in runtime journal."
|
||||
verify_journals "$VAL" runtime
|
||||
|
||||
: "Confirm that new messages are written to runtime journal."
|
||||
VAL=$(write_to_journal)
|
||||
verify_journals "$VAL" runtime
|
||||
|
||||
: "Confirm that flushing writes to system journal."
|
||||
journalctl --flush
|
||||
verify_journals "$VAL" persistent
|
||||
|
||||
: "Disable compression"
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
Compress=no
|
||||
EOF
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
: "Write 2MB of data to volatile journal"
|
||||
set +x
|
||||
dd if=/dev/urandom bs=1M count=2 | base64 | systemd-cat -t "$SYSLOG_ID"
|
||||
set -x
|
||||
journalctl --sync
|
||||
|
||||
max_size=$((1 * 1024 * 1024))
|
||||
total_size=$(du -sb "/var/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if (( total_size < max_size )); then
|
||||
echo "ERROR: volatile journal size is smaller than 1MB."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "Creating archive files."
|
||||
limit_var_journals=3
|
||||
for (( i = 0; i < limit_var_journals; i++ )); do
|
||||
write_to_journal
|
||||
journalctl --rotate
|
||||
done
|
||||
|
||||
ls -l "/var/log/journal/$MACHINE_ID"
|
||||
|
||||
num_archived_journals=$(get_num_archived_journals var)
|
||||
if (( num_archived_journals < limit_var_journals )); then
|
||||
echo "ERROR: Number of archived system journal files is ${num_archived_journals} < ${limit_var_journals}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "Reload with less SystemMaxUse= and SystemMaxFiles=."
|
||||
cat <<EOF >/run/systemd/journald.conf.d/reload.conf
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
RuntimeMaxUse=2M
|
||||
SystemMaxUse=1M
|
||||
SystemMaxFiles=3
|
||||
EOF
|
||||
systemctl reload systemd-journald.service
|
||||
|
||||
ls -l "/var/log/journal/$MACHINE_ID"
|
||||
|
||||
: "Check number of the system journal files"
|
||||
num_archived_journals=$(get_num_archived_journals var)
|
||||
if (( num_archived_journals >= limit_var_journals )); then
|
||||
echo "ERROR: Number of system journal files is ${num_archived_journals} >= ${limit_var_journals}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "Check the size of the system journal"
|
||||
total_size=$(du -sb "/var/log/journal/$MACHINE_ID" | cut -f1)
|
||||
if (( total_size > max_size )) && (( num_archived_journals > 0)); then
|
||||
echo "ERROR: Journal size exceeds SystemMaxUse limit and there exist archived journals."
|
||||
exit 1
|
||||
fi
|
@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
# shellcheck source=test/units/util.sh
|
||||
. "$(dirname "$0")"/util.sh
|
||||
|
||||
UNIT_NAME="TEST-07-PID1-issue-38320-$RANDOM"
|
||||
|
||||
at_exit() {
|
||||
systemctl stop "$UNIT_NAME".{socket,service}
|
||||
rm -f /run/systemd/system/"$UNIT_NAME".{socket,service}
|
||||
}
|
||||
|
||||
trap at_exit EXIT
|
||||
|
||||
cat >/run/systemd/system/"$UNIT_NAME.socket" <<EOF
|
||||
[Socket]
|
||||
ListenStream=/tmp/$UNIT_NAME
|
||||
EOF
|
||||
|
||||
cat >/run/systemd/system/"$UNIT_NAME.service" <<EOF
|
||||
[Service]
|
||||
ExecStart=true
|
||||
EOF
|
||||
|
||||
(! systemd-analyze fdstore "$UNIT_NAME.socket")
|
||||
|
||||
systemctl restart "$UNIT_NAME.socket"
|
||||
(! systemd-analyze fdstore "$UNIT_NAME.socket")
|
||||
|
||||
systemctl daemon-reload
|
||||
(! systemd-analyze fdstore "$UNIT_NAME.socket")
|
||||
|
||||
systemctl is-active "$UNIT_NAME.socket"
|
@ -14,14 +14,9 @@ systemd-run --wait --uid=nobody \
|
||||
assert_eq "$(cat /tmp/TEST-07-PID1.prefix-shell.flag)" "a"
|
||||
rm /tmp/TEST-07-PID1.prefix-shell.flag
|
||||
|
||||
# If the service exits too early, journald cannot find the source process of the log message.
|
||||
# Hence, we cannot use 'journalctl -u' below. Instead, let's use --since=.
|
||||
journalctl --sync
|
||||
TS="$(date '+%H:%M:%S')"
|
||||
|
||||
systemctl start prefix-shell.service
|
||||
assert_eq "$(cat /tmp/TEST-07-PID1.prefix-shell.flag)" "YAY!"
|
||||
|
||||
journalctl --sync
|
||||
journalctl --since "$TS" --grep "with login shell .*: lvl 101"
|
||||
journalctl --since "$TS" --grep "with normal shell"
|
||||
journalctl -b -u prefix-shell.service --grep "with login shell .*: lvl 101"
|
||||
journalctl -b -u prefix-shell.service --grep "with normal shell"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
mkdir /sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child
|
||||
|
Loading…
x
Reference in New Issue
Block a user