{"id":21707804,"url":"https://github.com/flightaware/readonly-pi","last_synced_at":"2025-04-12T16:16:24.735Z","repository":{"id":66872748,"uuid":"106687346","full_name":"flightaware/readonly-pi","owner":"flightaware","description":"Run a Pi with a readonly sdcard","archived":false,"fork":false,"pushed_at":"2017-10-12T12:09:21.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-12T16:15:56.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flightaware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-12T12:04:24.000Z","updated_at":"2023-04-04T14:53:39.000Z","dependencies_parsed_at":"2023-02-27T10:46:40.868Z","dependency_job_id":null,"html_url":"https://github.com/flightaware/readonly-pi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flightaware%2Freadonly-pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flightaware%2Freadonly-pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flightaware%2Freadonly-pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flightaware%2Freadonly-pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flightaware","download_url":"https://codeload.github.com/flightaware/readonly-pi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248594190,"owners_count":21130316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T22:19:19.264Z","updated_at":"2025-04-12T16:16:24.696Z","avatar_url":"https://github.com/flightaware.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# readonly-pi\n\nThis is a set of initrd scripts that run early during boot and, based on\nthe boot commandline, arrange for the \"real\" root filesystem to be kept\nreadonly. An overlayfs is used as the runtime root filesystem, with the\non-disk filesystem as a readonly lower layer and tmpfs used to store changes\nin RAM at runtime.\n\n## CAUTION\n\nSimilar scripts are used in FlightAware's FlightFeeder software, where they\nwork well, but this separate package has not been tested - consider it a\nstarting point.\n\nAlso, this has only ever been used on Raspberry Pis - it may need changes\nfor other systems.\n\nPull requests to improve it are welcome!\n\n## Prerequisites\n\nYou need a Pi setup that uses an initrd. The FlightFeeders have some custom\nlogic to do this as Raspbian did not support it at the time. Subsequently\nRaspbian seems to be adding direct support for initrds, but I haven't looked\ninto the details.\n\n## Build it\n\n```\n$ dpkg-buildpackage -b\n```\n\n## Install it\n\n```\n# dpkg -i readonly-pi_*.deb\n```\n\n## Use it\n\nAdd `overlay=yes` to /boot/cmdline.txt and reboot.\nTo switch back to a normal root FS, change it to `overlay=no` or remove the\noverlay arg.\n\n## Helper scripts\n\n`switch-to-readonly` and `switch-to-readwrite` will handle updating cmdline.txt\nfor you. Pass `-r` if you want to reboot after making a change. The scripts\nare no-ops (and will tell you about it) if the system is already in the\nrequested mode.\n\n## How overlay=yes works\n\nWhen in readonly mode, the filesystem layout looks like this:\n\n```\n/          overlayfs using /ro (lower layer) and /rw (upper layer)\n/ro        readonly-mounted real root FS\n/rw        tmpfs that will be used for changes\n/rw/upper  overlayfs upper dir\n/rw/work   overlayfs work dir\n```\n\nThe tmpfs on /rw is sized as: 25% of RAM in excess of 128MB, constrained to [64MB,256MB]\n\n## Gotchas\n\nMost obviously, _all changes you make to the root filesystem in readonly mode will be lost\non reboot_.\n\nIf you do lots of filesystem changes on a readonly system, you might run out of tmpfs space.\n\nMake sure you switch to readwrite mode before doing kernel/firmware upgrades.\n/boot is still read-write in readonly mode, so if you forget to do this then\nchanges will be made in /boot but the corresponding package accounting\ninformation on the root filesystem won't be updated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflightaware%2Freadonly-pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflightaware%2Freadonly-pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflightaware%2Freadonly-pi/lists"}