Optimizing Debian for Low-Spec x86 and ARM Systems

This guide covers essential system configurations to optimize the Debian operating system for resource-constrained, embedded x86 and ARM environments. By pruning background services, minimizing memory consumption, optimizing storage input/output (I/O) to prevent flash media degradation, and tuning kernel parameters, you can build a responsive, lightweight, and reliable system tailored for low-spec hardware.

Minimal Base Installation

Optimizing Debian begins at installation:

  • Install Only the Base System: Use the minimal Debian Netinst ISO or generate a custom rootfs using debootstrap --variant=minbase. Deselect the "Debian desktop environment" and standard system utilities during the tasksel phase.
  • Prevent Recommended Packages: By default, APT installs optional dependencies that consume storage and memory. Configure APT to ignore recommended and suggested packages by creating /etc/apt/apt.conf.d/99no-recommends:
APT::Install-Recommends "0";
APT::Install-Suggests "0";

Storage and Filesystem Tweaks

Embedded x86 and ARM boards commonly run on SD cards, eMMC, or slow flash storage with limited write endurance.

  • Mount Options in /etc/fstab: Reduce unnecessary write cycles by appending noatime and commit=60 to your root and data partitions. The noatime option disables metadata updates when files are read:
UUID=xxxx-xxxx  /  ext4  defaults,noatime,commit=60  0  1
  • Mount Temporary Directories in RAM: Place temporary directories in tmpfs to avoid hitting physical storage:
tmpfs  /tmp      tmpfs  defaults,nosuid,nodev,noatime,size=64M  0  0
tmpfs  /var/log  tmpfs  defaults,nosuid,nodev,noatime,size=32M  0  0

Memory Optimization and ZRAM

On systems with 512 MB to 2 GB of RAM, running out of memory (OOM) is a frequent point of failure.

  • Enable ZRAM Swap: Instead of wearing out flash media with disk-based swap partitions, use compressed RAM swap via zram-tools:
sudo apt install zram-tools

In /etc/default/zramswap, configure the compression algorithm and allocation:

ALGO=lz4
PERCENT=50
  • Tune Virtual Memory Behavior: Edit /etc/sysctl.d/99-lowspec.conf to adjust swap behavior and release memory more aggressively:
# Favor ZRAM usage over filesystem cache drop
vm.swappiness=100

# Aggressively reclaim directory and inode caches
vm.vfs_cache_pressure=150

# Prevent aggressive overcommitting of memory
vm.overcommit_memory=2
vm.overcommit_ratio=80

Apply settings immediately with:

sudo sysctl --system

Pruning Systemd and Background Daemons

Debian ships with several daemons that are unnecessary in headless or embedded appliances.

  • Audit Active Services:
systemctl list-units --type=service --state=running
  • Disable Unneeded Services: Remove or disable services that do not apply to your hardware use-case:
sudo systemctl disable --now exim4          # MTA/mail daemon
sudo systemctl disable --now avahi-daemon   # mDNS discovery
sudo systemctl disable --now bluetooth.service
sudo systemctl disable --now ModemManager.service
  • Restrict Journald Logging: Unconstrained logs exhaust memory and write cycles. Edit /etc/systemd/journald.conf:
[Journal]
Storage=volatile
RuntimeMaxUse=16M

Kernel and Console Optimization

  • Reduce Boot Delay: If using GRUB (common on x86), set GRUB_TIMEOUT=0 in /etc/default/grub and run sudo update-grub. On ARM systems running U-Boot, modify bootdelay=0 within your boot script or environment.
  • Suppress Console Output: Add quiet loglevel=3 to your kernel command line parameters to reduce CPU interrupts caused by writing dmesg messages to serial or TTY consoles.