池塘

你今日飲咗未﹖

为 Armbian 配置只读 rootfs

本文是 How to use with write protected filesystems todays? - forum.armbian.com 的翻译。

Armbian 是为单板计算机和嵌入式设备优化的 Linux 发行版,我最近在家里放了一块 tpm312, 作为 VPN 网关,方便我在外访问家里的网络。

这块板子不支持从 SD 卡和 U 盘启动,为了尽可能减小读写对 emmc 的损耗,我选择将 rootfs 配置成只读。

armbian-config 工具可以自动配置 overlayroot 包,使用以下命令

armbian-config --cmd SY007

但是这个包有点问题,它要求 initramfs 中包含 grep,但是默认情况不包含它,我们可以手动安装 busybox 让 initramfs 包含这个命令。

第一步,安装 busybox-static

apt install busybox-static

第二步,在 initramfs 中启用 busybox 修改 /etc/initramfs-tools/initramfs.conf 中的 busybox 配置项,改成 y

# BUSYBOX: [ y | n | auto ]
BUSYBOX=y

第三步,重新生成 initramfs

update-initramfs -c -k all

重启,然后就可以了。overlayfs 的日志位于 /run/initramfs/overlayroot.log