Skip to content

Commit

Permalink
v8.21
Browse files Browse the repository at this point in the history
- DietPi-Set_swapfile | Resolved an issue on Bookworm systems where zram swap space was not enabled automatically on boot due to missing syscall permissions. Many thanks to @magicfoxt-magicfox for reporting this issue: #6511
  • Loading branch information
MichaIng committed Jul 30, 2023
1 parent 2abad37 commit 55019bb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.txt
@@ -1,3 +1,15 @@
v8.21
(2023-07-26)

Enhancements:

Bug fixes:
- DietPi-Set_swapfile | Resolved an issue on Bookworm systems where zram swap space was not enabled automatically on boot due to missing syscall permissions. Many thanks to @magicfoxt-magicfox for reporting this issue: https://github.com/MichaIng/DietPi/issues/6511

As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX

-----------------------------------------------------------------------------------------------------------

v8.20
(2023-07-29)

Expand Down
11 changes: 8 additions & 3 deletions dietpi/func/dietpi-set_swapfile
Expand Up @@ -88,6 +88,8 @@
# zram-swap
[[ -f '/etc/modules-load.d/dietpi-zram-swap.conf' ]] && rm -v /etc/modules-load.d/dietpi-zram-swap.conf
[[ -f '/etc/udev/rules.d/98-dietpi-zram-swap.rules' ]] && rm -v /etc/udev/rules.d/98-dietpi-zram-swap.rules
[[ -f '/etc/systemd/system/systemd-udevd.service.d/dietpi-zram.conf' ]] && rm -v /etc/systemd/system/systemd-udevd.service.d/dietpi-zram.conf
[[ -d '/etc/systemd/system/systemd-udevd.service.d' ]] && rmdir -v --ignore-fail-on-non-empty /etc/systemd/system/systemd-udevd.service.d

}

Expand All @@ -108,9 +110,12 @@
G_EXEC mkswap "$SWAP_PATH"
G_EXEC swapon "$SWAP_PATH"
# Make persistent, proceed with failure in case of R/O rootfs
G_EXEC_NOHALT=1 G_EXEC eval "echo 'zram' > /etc/modules-load.d/dietpi-zram-swap.conf" || return 1
G_EXEC_NOHALT=1 G_EXEC eval "echo 'SUBSYSTEM==\"block\", KERNEL==\"zram0\", ACTION==\"add\", ATTR{disksize}=\"${SWAP_SIZE}M\", RUN+=\"chmod 0600 /dev/zram0\", RUN+=\"/sbin/mkswap /dev/zram0\", RUN+=\"/sbin/swapon /dev/zram0\"' > /etc/udev/rules.d/98-dietpi-zram-swap.rules" || return 1
G_EXEC_NOHALT=1 G_EXEC eval "echo 'swappiness=50' > /etc/sysctl.d/98-dietpi-zram-swap.conf" || return 1
G_EXEC_NOHALT=1 G_EXEC eval 'echo '\''zram'\'' > /etc/modules-load.d/dietpi-zram-swap.conf' || return 1
G_EXEC_NOHALT=1 G_EXEC eval "echo 'SUBSYSTEM==\"block\", KERNEL==\"zram0\", ACTION==\"add\", ATTR{disksize}==\"0\", ATTR{disksize}=\"${SWAP_SIZE}M\", RUN+=\"/bin/chmod 0600 /dev/zram0\", RUN+=\"/sbin/mkswap /dev/zram0\", RUN+=\"/sbin/swapon /dev/zram0\"' > /etc/udev/rules.d/98-dietpi-zram-swap.rules" || return 1
G_EXEC_NOHALT=1 G_EXEC eval 'echo '\''swappiness=50'\'' > /etc/sysctl.d/98-dietpi-zram-swap.conf' || return 1
# Bookworm: Permit udev to run swapon: https://github.com/MichaIng/DietPi/issues/6511
G_EXEC_NOHALT=1 G_EXEC mkdir -p /etc/systemd/system/systemd-udevd.service.d
G_EXEC_NOHALT=1 G_EXEC eval 'echo -e '\''[Service]\nSystemCallFilter=@swap'\'' > /etc/systemd/system/systemd-udevd.service.d/dietpi-zram.conf'
return 0

# Swap file pre-allocation: Try faster and less write-intense fallocate first and dd as fallback
Expand Down

0 comments on commit 55019bb

Please sign in to comment.