mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
busybox: cleanup persistent log setup when debugging is enabled
The ancient approach of symlinking /var/log to /storage/log doesn't play nice with systemd as it doesn't setup proper dependencies and unmounting /storage during shutdown may fail because systemd doesn't know that it's needed for /var/log. Use a conditional bind mount instead so systemd can automatically create proper dependencies and unmount filesystems in the correct order. Also store the persistent logfiles on /storage in a .cache/log directory instead of log to avoid confusing users - users can access logfiles via /var/log. Note: we can't use tmpfiles.d to create the .cache/log directory on /storage because that would run after local-fs.target but we need the .log directory before that so it has to be done via a one-shot service. Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
parent
28ecf8f4ac
commit
78080a6a46
@ -185,7 +185,6 @@ post_install() {
|
|||||||
enable_service shell.service
|
enable_service shell.service
|
||||||
enable_service show-version.service
|
enable_service show-version.service
|
||||||
enable_service var.mount
|
enable_service var.mount
|
||||||
enable_service var-log-debug.service
|
|
||||||
enable_service fs-resize.service
|
enable_service fs-resize.service
|
||||||
listcontains "${FIRMWARE}" "rpi-eeprom" && enable_service rpi-flash-firmware.service
|
listcontains "${FIRMWARE}" "rpi-eeprom" && enable_service rpi-flash-firmware.service
|
||||||
|
|
||||||
|
9
packages/sysutils/busybox/system.d/storage-log.service
Normal file
9
packages/sysutils/busybox/system.d/storage-log.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Create Persistent Log Directory on /storage
|
||||||
|
DefaultDependencies=no
|
||||||
|
RequiresMountsFor=/storage
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/bin/mkdir -p /storage/.cache/log/journal
|
@ -1,18 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Debug /var/log relink
|
|
||||||
DefaultDependencies=false
|
|
||||||
After=var.mount
|
|
||||||
Before=systemd-journal-flush.service
|
|
||||||
ConditionKernelCommandLine=!installer
|
|
||||||
ConditionKernelCommandLine=|debugging
|
|
||||||
ConditionPathExists=|/storage/.cache/debug.libreelec
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStartPre=/bin/rm -rf /var/log
|
|
||||||
ExecStartPre=-/bin/mkdir -p /storage/log/journal
|
|
||||||
ExecStart=-/bin/ln -sf /storage/log /var/log
|
|
||||||
RemainAfterExit=yes
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sysinit.target
|
|
13
packages/sysutils/busybox/system.d/var-log.mount
Normal file
13
packages/sysutils/busybox/system.d/var-log.mount
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Persistent Log Storage
|
||||||
|
RequiresMountsFor=/var /storage
|
||||||
|
Requires=storage-log.service
|
||||||
|
After=storage-log.service
|
||||||
|
ConditionKernelCommandLine=!installer
|
||||||
|
ConditionKernelCommandLine=|debugging
|
||||||
|
ConditionPathExists=|/storage/.cache/debug.libreelec
|
||||||
|
|
||||||
|
[Mount]
|
||||||
|
What=/storage/.cache/log
|
||||||
|
Where=/var/log
|
||||||
|
Options=bind
|
Loading…
x
Reference in New Issue
Block a user