detached c693e8f

feat(zram): add compressed swap with optimized sysctl parameters

commit
c693e8f6a69926424ace998b1353bcd4598e78a0
author
bnema · · 2025-10-21 16:25 UTC
committer
bnema · · 2025-10-21 21:54 UTC
parent
5592596
signature
unsigned
5 files · +37 -5
M install/base.packages +5 -1
@@ -20,7 +20,8 @@ ttf-fira-sans
2020 ttf-jetbrains-mono-nerd
2121
2222 # Networking
23-iwd
23+networkmanager
24+broadcom-wl
2425 openssh
2526
2627 # Essential Tools
@@ -30,5 +31,8 @@ man-db
3031 git
3132 bash-completion
3233
34+# Memory Management
35+zram-generator
36+
3337 # Encryption (added if LUKS enabled)
3438 # cryptsetup
@@ -20,7 +20,8 @@ ttf-fira-sans
20 ttf-jetbrains-mono-nerd20 ttf-jetbrains-mono-nerd
21 21
22 # Networking22 # Networking
23-iwd23+networkmanager
24+broadcom-wl
24 openssh25 openssh
25 26
26 # Essential Tools27 # Essential Tools
@@ -30,5 +31,8 @@ man-db
30 git31 git
31 bash-completion32 bash-completion
32 33
34+# Memory Management
35+zram-generator
36+
33 # Encryption (added if LUKS enabled)37 # Encryption (added if LUKS enabled)
34 # cryptsetup38 # cryptsetup
M install/config/all.sh +1 -0
@@ -7,3 +7,4 @@ source "$ARCHUP_INSTALL/config/user.sh" # Interactive (gum input)
77 start_log_output # Resume after prompts
88
99 run_logged "$ARCHUP_INSTALL/config/network.sh" # Non-interactive
10+run_logged "$ARCHUP_INSTALL/config/zram.sh" # Non-interactive
@@ -7,3 +7,4 @@ source "$ARCHUP_INSTALL/config/user.sh" # Interactive (gum input)
7 start_log_output # Resume after prompts7 start_log_output # Resume after prompts
8 8
9 run_logged "$ARCHUP_INSTALL/config/network.sh" # Non-interactive9 run_logged "$ARCHUP_INSTALL/config/network.sh" # Non-interactive
10+run_logged "$ARCHUP_INSTALL/config/zram.sh" # Non-interactive
A install/config/zram.sh +25 -0
@@ -0,0 +1,25 @@
1+#!/bin/bash
2+# Configure zram compressed swap
3+
4+gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Configuring zram swap..."
5+
6+# Create zram-generator config
7+cat > /mnt/etc/systemd/zram-generator.conf << 'EOF'
8+[zram0]
9+zram-size = min(ram / 2, 4096)
10+compression-algorithm = zstd
11+EOF
12+
13+echo "Created /etc/systemd/zram-generator.conf" >> "$ARCHUP_INSTALL_LOG_FILE"
14+
15+# Create sysctl config for zram optimization
16+cat > /mnt/etc/sysctl.d/99-vm-zram-parameters.conf << 'EOF'
17+vm.swappiness = 180
18+vm.watermark_boost_factor = 0
19+vm.watermark_scale_factor = 125
20+vm.page-cluster = 0
21+EOF
22+
23+echo "Created /etc/sysctl.d/99-vm-zram-parameters.conf with optimized settings" >> "$ARCHUP_INSTALL_LOG_FILE"
24+
25+gum style --foreground 2 --padding "0 0 1 $PADDING_LEFT" "[OK] zram swap configured"
@@ -0,0 +1,25 @@
1+#!/bin/bash
2+# Configure zram compressed swap
3+
4+gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Configuring zram swap..."
5+
6+# Create zram-generator config
7+cat > /mnt/etc/systemd/zram-generator.conf << 'EOF'
8+[zram0]
9+zram-size = min(ram / 2, 4096)
10+compression-algorithm = zstd
11+EOF
12+
13+echo "Created /etc/systemd/zram-generator.conf" >> "$ARCHUP_INSTALL_LOG_FILE"
14+
15+# Create sysctl config for zram optimization
16+cat > /mnt/etc/sysctl.d/99-vm-zram-parameters.conf << 'EOF'
17+vm.swappiness = 180
18+vm.watermark_boost_factor = 0
19+vm.watermark_scale_factor = 125
20+vm.page-cluster = 0
21+EOF
22+
23+echo "Created /etc/sysctl.d/99-vm-zram-parameters.conf with optimized settings" >> "$ARCHUP_INSTALL_LOG_FILE"
24+
25+gum style --foreground 2 --padding "0 0 1 $PADDING_LEFT" "[OK] zram swap configured"
M install/helpers/download.sh +1 -1
@@ -46,7 +46,7 @@ download_archup_files() {
4646
4747 # Configuration
4848 download_section "Downloading config scripts..." "config" \
49- all.sh system.sh user.sh network.sh
49+ all.sh system.sh user.sh network.sh zram.sh
5050
5151 # Bootloader
5252 download_section "Downloading bootloader setup..." "boot" \
@@ -46,7 +46,7 @@ download_archup_files() {
46 46
47 # Configuration47 # Configuration
48 download_section "Downloading config scripts..." "config" \48 download_section "Downloading config scripts..." "config" \
49- all.sh system.sh user.sh network.sh49+ all.sh system.sh user.sh network.sh zram.sh
50 50
51 # Bootloader51 # Bootloader
52 download_section "Downloading bootloader setup..." "boot" \52 download_section "Downloading bootloader setup..." "boot" \
M install/post-install/verify.sh +5 -3
@@ -89,11 +89,13 @@ verify_file "/etc/fstab" "Filesystem table"
8989 verify_file "/etc/hostname" "Hostname"
9090 verify_file "/etc/locale.conf" "Locale configuration"
9191 verify_file "/etc/locale.gen" "Locale generation file"
92+verify_file "/etc/systemd/zram-generator.conf" "zram configuration"
93+verify_file "/etc/sysctl.d/99-vm-zram-parameters.conf" "zram sysctl parameters"
9294
93-if [ -f "/mnt/etc/systemd/network/20-wired.network" ] || [ -f "/mnt/etc/NetworkManager/NetworkManager.conf" ]; then
94- echo "[OK] Network configuration present" >> "$ARCHUP_INSTALL_LOG_FILE"
95+if arch-chroot /mnt systemctl is-enabled NetworkManager &>/dev/null; then
96+ echo "[OK] NetworkManager enabled" >> "$ARCHUP_INSTALL_LOG_FILE"
9597 else
96- echo "[ERROR] Network configuration missing" >> "$ARCHUP_INSTALL_LOG_FILE"
98+ echo "[ERROR] NetworkManager not enabled" >> "$ARCHUP_INSTALL_LOG_FILE"
9799 VERIFICATION_FAILED=1
98100 fi
99101
@@ -89,11 +89,13 @@ verify_file "/etc/fstab" "Filesystem table"
89 verify_file "/etc/hostname" "Hostname"89 verify_file "/etc/hostname" "Hostname"
90 verify_file "/etc/locale.conf" "Locale configuration"90 verify_file "/etc/locale.conf" "Locale configuration"
91 verify_file "/etc/locale.gen" "Locale generation file"91 verify_file "/etc/locale.gen" "Locale generation file"
92+verify_file "/etc/systemd/zram-generator.conf" "zram configuration"
93+verify_file "/etc/sysctl.d/99-vm-zram-parameters.conf" "zram sysctl parameters"
92 94
93-if [ -f "/mnt/etc/systemd/network/20-wired.network" ] || [ -f "/mnt/etc/NetworkManager/NetworkManager.conf" ]; then95+if arch-chroot /mnt systemctl is-enabled NetworkManager &>/dev/null; then
94- echo "[OK] Network configuration present" >> "$ARCHUP_INSTALL_LOG_FILE"96+ echo "[OK] NetworkManager enabled" >> "$ARCHUP_INSTALL_LOG_FILE"
95 else97 else
96- echo "[ERROR] Network configuration missing" >> "$ARCHUP_INSTALL_LOG_FILE"98+ echo "[ERROR] NetworkManager not enabled" >> "$ARCHUP_INSTALL_LOG_FILE"
97 VERIFICATION_FAILED=199 VERIFICATION_FAILED=1
98 fi100 fi
99 101

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close