RapsberryPi Operating System Adjustments

Introduced with 1.1.3. For reducing the write cycles on the SDCard we implemented some changes on the default ArchLinux system configuration. These changes contain the move to “in memory” filesystems and kernel parameters. The kernel changes are stored in /etc/sysctl.d/50-sdcard.conf, which are applied during boot-up.

  1. (fstab) /var/log, /tmp, /var/tmp & /run to memory. These folders are runtime folders and are frequently used by the system. The flaw is, that after a reboot the logs are gone. If logs are needed, comment /var/log in /etc/fstab with a #.
  2. (Kernel) vm.swappiness = 1 ⇒ This means, that if swap is available it will only be used if the system is short on memory. Default is 40/60 (depends on Kernel version), which cause the Kernel to page out unused buffers to swap. Read more about: Swappiness
  3. (Kernel) vm.dirty_background_ratio = 50 & vm.dirty_ratio = 80. This Option makes more use of available ram to store written pages. On the one hand, it does increase write speed and the SD card is used more consolidated then with smaller high frequent IO. If 50% free memory is used with written pages, a background tasks starts to write the data to disk. At 80% the system starts to do “blocking writes”, which is more like a “hanging” task.
  4. (Kernel) vm.dirty_expire_centisecs = 30000 (5 minutes) is default value is '3000' which is 30s. This means a page is written to disk latest after vm.dirty_expire_centisecs. This means that a powered off PirateBox will loose data which is up to 5 Minutes old.

Building a custom images

The generated images are automatically build by a build chain. You can find it on the corresponding Github repository arch_rpi_image_prepare. The image is prepared via a Makefile following the original steps. The customization is done with the scripts in the “chroot”-folder. These contain the following steps:

  • Enable sudo for user alarm.
  • Install needed packages and build needed aur packages.
  • Deploy PirateBoxScripts and Change some minor OS parts to let it work.

The PirateBox service is started by an udev rule, which triggers after an USB wifi stick is recognized. Since 1.1.3 it does only trigger once, if two wifi cards are available. For further details, have a look into the repository or ask in the PirateBox forum.