{"action":"created","issue":{"url":"https://api.github.com/repos/cyoung/stratux/issues/78","repository_url":"https://api.github.com/repos/cyoung/stratux","labels_url":"https://api.github.com/repos/cyoung/stratux/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/cyoung/stratux/issues/78/comments","events_url":"https://api.github.com/repos/cyoung/stratux/issues/78/events","html_url":"https://github.com/cyoung/stratux/issues/78","id":110707939,"number":78,"title":"Request: Read-Only Filesystem","user":{"login":"ssokol","id":350268,"avatar_url":"https://avatars.githubusercontent.com/u/350268?v=3","gravatar_id":"","url":"https://api.github.com/users/ssokol","html_url":"https://github.com/ssokol","followers_url":"https://api.github.com/users/ssokol/followers","following_url":"https://api.github.com/users/ssokol/following{/other_user}","gists_url":"https://api.github.com/users/ssokol/gists{/gist_id}","starred_url":"https://api.github.com/users/ssokol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssokol/subscriptions","organizations_url":"https://api.github.com/users/ssokol/orgs","repos_url":"https://api.github.com/users/ssokol/repos","events_url":"https://api.github.com/users/ssokol/events{/privacy}","received_events_url":"https://api.github.com/users/ssokol/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cyoung/stratux/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-10-09T17:55:39Z","updated_at":"2016-02-20T21:36:18Z","closed_at":null,"body":"I know this has been discussed ad nauseum on previous issue, but I've seen enough requests that it's probably worth collecting thoughts in one place.\r\n\r\n## Background\r\n\r\nThe Raspberry Pi is not a traditional embedded system. It's a full Linux computer system on a very small board. Like all Linux systems, the Pi normally requires an orderly shutdown to prevent data loss and filesystem corruption. If the power is pulled in the middle of a write operation, bad things (tm) can happen, including a complete corruption of the system. This is always painful, but it is particularly painful in an avionics system.\r\n\r\n## Stratux Read Only Requirements\r\n\r\n1. Store DHCP lease information. This data *does not* need to be persistent between reboots.\r\n1. Store the stratux.conf configuration data. This data *does* need to be persistent between reboots.\r\n1. Store log files when logging is enabled. This data *may* need to be persistent between reboots.\r\n\r\n[Please add other requirements here.]\r\n\r\n## Strategies For Read Only Operation\r\n\r\n1. Remove unnecessary stuff that tries to write to the filesystem:\r\n  1. dphys-swapfile\r\n  1. other packages?\r\n1. Replace the default syslog system with the BusyBox syslogd which writes to memory\r\n1. Use tmpfs (ramdisk) for:\r\n  1. /tmp\r\n  1. /var/tmp\r\n  1. /var/log\r\n  1. /var/lib/dhcp\r\n1. Disable fsck by appending \"fastboot\" to the /boot/cmdline.txt file\r\n1. Disable swap by appending \"noswap\" to the /boot/cmdline.txt file\r\n1. Force read-only file access by appending \"ro\" to the /boot/cmdline.txt file\r\n1. Add an \"ro\" and an \"rw\" script to \"/usr/bin\" to allow advanced users to easily switch between read-only and read/write modes.\r\n\r\nThat handles the basics. I've done some experiments with this and it seems to work with a small tweak to the isc-dhcp-server init file (have to add \"touch /var/lib/dhcp/dhcp.leases\" before you start up the server).\r\n\r\nWhat this doesn't handle are:\r\n\r\n1. Creation of and edits to /etc/stratus.conf made by the UI\r\n1. Log file persistence\r\n\r\nMy personal thought on that is to create an additional small partition as part of the image. Something like 500 mb to 1 gb. Format it with something that can be read by any computer (i.e. FAT32). When Stratux boots up it checks to see if it can mount this partition. If so, great - it mounts it and uses it for the configuration file and for logging. If it can't mount / read / use the filesystem it uses the format command to recreate it. It then writes a default stratux.conf and alerts the user through the GUI that the configuration was recreated and needs some attention. (The stratux.conf config data can easily be cached on the browser in localStorage, making replacement trivial.)\r\n\r\nA variation on this theme:\r\n\r\nMount the config / log partition read only at boot. Remount it read/write when necessary to update the configuration or to copy log data from memory to the filesystem. Have a log rotation feature built into Stratux that handles this so that every minute or so the log data gets saved. This minimizes the chance of data loss.\r\n\r\n## Experience\r\n\r\nI've tested the first part of this scenario and it seems to work. I have yet to try the additional partition. I'm not sure how much complexity that adds to the spindle configuration that is currently being used to build images.\r\n\r\nI will attach the scripts that I've been using to this issue in case anyone wants to try it out. "},"comment":{"url":"https://api.github.com/repos/cyoung/stratux/issues/comments/186684197","html_url":"https://github.com/cyoung/stratux/issues/78#issuecomment-186684197","issue_url":"https://api.github.com/repos/cyoung/stratux/issues/78","id":186684197,"user":{"login":"skypuppy","id":13644705,"avatar_url":"https://avatars.githubusercontent.com/u/13644705?v=3","gravatar_id":"","url":"https://api.github.com/users/skypuppy","html_url":"https://github.com/skypuppy","followers_url":"https://api.github.com/users/skypuppy/followers","following_url":"https://api.github.com/users/skypuppy/following{/other_user}","gists_url":"https://api.github.com/users/skypuppy/gists{/gist_id}","starred_url":"https://api.github.com/users/skypuppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skypuppy/subscriptions","organizations_url":"https://api.github.com/users/skypuppy/orgs","repos_url":"https://api.github.com/users/skypuppy/repos","events_url":"https://api.github.com/users/skypuppy/events{/privacy}","received_events_url":"https://api.github.com/users/skypuppy/received_events","type":"User","site_admin":false},"created_at":"2016-02-20T21:36:18Z","updated_at":"2016-02-20T21:36:18Z","body":"I imagine most pilots want to just plug and go, not fiddle with things. \nUnlike geeks like us!  :)  :)\nBut sometimes you just can't do that with new technology.\n\nSkypuppy\n\n\n\nOn 02/20/2016 01:23 PM, bkwny wrote:\n>\n> If nothing else, people need to be able to configure the wireless\n> access point.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/cyoung/stratux/issues/78#issuecomment-186668620>.\n>\n\n"}}