From 010c0d669f63ca1b3e8584a82c60351b98229dd6 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 4 Feb 2022 14:09:25 -0500 Subject: [PATCH] Add log2ram packages. --- build/build-stormux.sh | 6 ++--- files/etc/log2ram.conf | 37 ++++++++++++++++++++++++++ files/etc/systemd/journald.conf | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 files/etc/log2ram.conf create mode 100644 files/etc/systemd/journald.conf diff --git a/build/build-stormux.sh b/build/build-stormux.sh index e5a07ed..78f4b4d 100755 --- a/build/build-stormux.sh +++ b/build/build-stormux.sh @@ -140,7 +140,7 @@ arch-chroot /mnt << EOF # set up pacman pacman-key --init pacman-key --populate archlinuxarm -pacman -Syyu --needed --noconfirm alsa-firmware alsa-utils base base-devel bash-completion bluez bluez-utils cronie espeak-ng git magic-wormhole man man-pages networkmanager rhvoice-voice-bdl rng-tools sox w3m wget xdg-user-dirs xdg-utils +pacman -Syyu --needed --noconfirm alsa-firmware alsa-utils base base-devel bash-completion bluez bluez-utils cronie espeak-ng git magic-wormhole man man-pages networkmanager rhvoice-voice-bdl rng-tools rsync sox w3m wget xdg-user-dirs xdg-utils # set the language sed -i "s/#$imageLanguage/$imageLanguage/" /etc/locale.gen echo "LANG=$imageLanguage" > /etc/locale.conf @@ -171,7 +171,7 @@ cd yay makepkg -si --noconfirm cd ~ rm -rf yay -yay -S --noconfirm fenrir-git growpartfs informant +yay -S --noconfirm fenrir-git growpartfs informant log2ram exit gpasswd -a stormux informant informant read --all @@ -180,7 +180,7 @@ echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel # Set the hostname echo stormux > /etc/hostname # Enable services -systemctl enable cronie.service fenrirscreenreader.service NetworkManager.service +systemctl enable cronie.service fenrirscreenreader.service log2ram.service NetworkManager.service # Update fstab for Raspberry Pi 4. #[[ $imageVersion -eq 4 ]] && sed -i 's/mmcblk0/mmcblk1/g' /etc/fstab EOF diff --git a/files/etc/log2ram.conf b/files/etc/log2ram.conf new file mode 100644 index 0000000..10f1240 --- /dev/null +++ b/files/etc/log2ram.conf @@ -0,0 +1,37 @@ +# Configuration file for Log2Ram (https://github.com/azlux/log2ram) under MIT license. +# This configuration file is read by the log2ram service + +# Size for the ram folder, it defines the size the log folder will reserve into the RAM. +# If it's not enough, log2ram will not be able to use ram. Check you /var/log size folder. +# The default is 40M and is basically enough for a lot of applications. +# You will need to increase it if you have a server and a lot of log for example. +SIZE=128M + +# This variable can be set to true if you prefer "rsync" rather than "cp". +# I use the command cp -u and rsync -X, so I don't copy the all folder every time for optimization. +# You can choose which one you want. Be sure rsync is installed if you use it. +USE_RSYNC=true + +# If there are some errors with available RAM space, a system mail will be send +# Change it to false and you will have only a log if there is no place on RAM anymore. +MAIL=false + +# Variable for folders to put in RAM. You need to specify the real folder `/path/folder` , the `/path/hdd.folder` will be automatically created. Multiple path can be separeted by `;`. Do not add the final `/` ! +# example : PATH_DISK="/var/log;/home/test/FolderInRam" +PATH_DISK="/var/log" + +# **************** Zram backing conf ************************************************* + +# ZL2R Zram Log 2 Ram enables a zram drive when ZL2R=true ZL2R=false is mem only tmpfs +ZL2R=false +# COMP_ALG this is any compression algorithm listed in /proc/crypto +# lz4 is fastest with lightest load but deflate (zlib) and Zstandard (zstd) give far better compression ratios +# lzo is very close to lz4 and may with some binaries have better optimisation +# COMP_ALG=lz4 for speed or Zstd for compression, lzo or zlib if optimisation or availabilty is a problem +COMP_ALG=lz4 +# LOG_DISK_SIZE is the uncompressed disk size. Note zram uses about 0.1% of the size of the disk when not in use +# LOG_DISK_SIZE is expected compression ratio of alg chosen multiplied by log SIZE +# lzo/lz4=2.1:1 compression ratio zlib=2.7:1 zstandard=2.9:1 +# Really a guestimate of a bit bigger than compression ratio whilst minimising 0.1% mem usage of disk size +LOG_DISK_SIZE=100M + diff --git a/files/etc/systemd/journald.conf b/files/etc/systemd/journald.conf new file mode 100644 index 0000000..bd0871e --- /dev/null +++ b/files/etc/systemd/journald.conf @@ -0,0 +1,47 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Entries in this file show the compile time defaults. Local configuration +# should be created by either modifying this file, or by creating "drop-ins" in +# the journald.conf.d/ subdirectory. The latter is generally recommended. +# Defaults can be restored by simply deleting this file and all drop-ins. +# +# Use 'systemd-analyze cat-config systemd/journald.conf' to display the full config. +# +# See journald.conf(5) for details. + +[Journal] +#Storage=auto +#Compress=yes +#Seal=yes +#SplitMode=uid +#SyncIntervalSec=5m +#RateLimitIntervalSec=30s +#RateLimitBurst=10000 +SystemMaxUse=20M +#SystemKeepFree= +#SystemMaxFileSize= +#SystemMaxFiles=100 +#RuntimeMaxUse= +#RuntimeKeepFree= +#RuntimeMaxFileSize= +#RuntimeMaxFiles=100 +#MaxRetentionSec= +#MaxFileSec=1month +#ForwardToSyslog=no +#ForwardToKMsg=no +#ForwardToConsole=no +#ForwardToWall=yes +#TTYPath=/dev/console +#MaxLevelStore=debug +#MaxLevelSyslog=debug +#MaxLevelKMsg=notice +#MaxLevelConsole=info +#MaxLevelWall=emerg +#LineMax=48K +#ReadKMsg=yes +#Audit=yes