raspap-webgui icon indicating copy to clipboard operation
raspap-webgui copied to clipboard

Run RaspAp on ReadOnly FS

Open matzrm opened this issue 6 years ago • 5 comments

Your environment

  • Pi 3 Model B+
  • Stretch Lite
  • RaspAP Quick Install
  • Pi Read Only script by Adafruit

Steps to reproduce

On a fresh stretch lite install RaspAp Quick Install and ReadOnly Adafruit script.

Adjust Log Path for Lighttpd

Append to /etc/fstab tmpfs /var/log/lighttpd tmpfs nodev,nosuid 0 0

Adjust Lease file folder for dnsmasq

Append to /etc/dnsmasq.conf dhcp-leasefile=/tmp/dnsmasq.leases

Adjust PHP Session folder

Append to Session section of /etc/php/7.0/cgi/php.ini (line 1340)

session.save_path = "/var/log/lighttpd"

Expected behavior

I think that would be great have a RASPI_READ_ONLY_FS variable inside config.php to handle readonly filesystem performing a remount rw/ro before/after each shell command.

Actual behavior

Web-Gui is showed but obviously it cannot saves the changes or make other fs operations.

matzrm avatar Mar 28 '19 11:03 matzrm

is possible? how can i add a command in the webgui?

pietrondo avatar Jul 18 '20 10:07 pietrondo

Perhaps an easier way to handle this is to allow the user to configure two hooks that gets called before and after commands that need to write to the file system.

In the case of https://gitlab.com/larsfp/rpi-readonly, we would use rw and ro

This seems better, simpler than detecting it. The only issue is that if the user has temporarily enabled rw mode, this would revert that. So maybe a (configurable) test would be nice.

This is far more important than it seems. I'm tired of having to rebuild a raspap server because the filesystem was corrupted.

ericraymond avatar Aug 02 '20 21:08 ericraymond

This functionality would be great for my use case.

I use a Pi Zero W as a dashcam drive for my Tesla using this project. I was hoping to use RaspAP as a means to easily join the Pi to new wifi networks as I travel so the Pi can connect to my home OpenVPN connection and upload any dashcam footage. The TeslaUSB project makes the SD card read only so that it doesn't get trashed when the car abruptly cuts power to the Pi when it goes to sleep but that obviously conflicts with RaspAP as any changes made in the web gui can't be saved.

mattenz avatar Oct 04 '20 10:10 mattenz

Log2ram by azlux handles the file logging (https://github.com/azlux/log2ram). I install it by default on all my RPi projects. It saves the log data to RAM and then periodically (daily or weekly) syncs and compresses the logs to disk i.e. flash memory. I don't believe it handles the DHCP leases which is a good point that I hadn't thought of.

From: /etc/log2ram.conf

# Variable for folders to put in RAM. You need to specify the real folder /path/folder , the /path/hdd.folder will be automatically created. Multiple path can be separeted by ;. Do not add the final / ! # example : PATH_DISK="/var/log;/home/test/FolderInRam" PATH_DISK="/var/log"

PATH_DISK="/var/log;/var/lib/misc" should include the DHCP leases.

Dude4Linux avatar Mar 23 '21 21:03 Dude4Linux

Give https://github.com/RaspAP/raspap-tools a look, in particular raspian_min_write.sh. This moves several temp and log files to RAM. Credit to @zbchristian for this repo.

billz avatar Jun 06 '21 11:06 billz

Dedicated doc page is here https://docs.raspap.com/minwrite/

billz avatar Mar 30 '23 08:03 billz