Skip to content

Instantly share code, notes, and snippets.

@yeokm1
Last active July 17, 2024 01:31
Show Gist options
  • Save yeokm1/8b0ffc03e622ce011010 to your computer and use it in GitHub Desktop.
Save yeokm1/8b0ffc03e622ce011010 to your computer and use it in GitHub Desktop.

Revisions

  1. yeokm1 revised this gist May 2, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ reboot

    #Update everything first, remove cache then reboot to detect problems
    pacman -Syu
    # Delete certs if you see a message like "/etc/ssl/certs/ca-certificates.crt exists in filesystem"
    # Delete certs if you see a message like "/etc/ssl/certs/ca-certificates.crt exists in filesystem" then rerun pacman -Syu
    rm /etc/ssl/certs/ca-certificates.crt
    #May be needed if the pacman version has changed during the update
    pacman-db-upgrade
  2. yeokm1 revised this gist May 2, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ##Read-only FS on Arch Linux ARM
    ## Read-only FS on Arch Linux ARM

    Unlike your typical computer where you usually shutdown properly, I cannot rely on this during the use of my Raspberry Pi. If the Raspberry Pi is improperly shutdown too many times, data corruption in the file system leading to unbootable SD card may result. So we should use a read-only file system.

    @@ -18,6 +18,8 @@ reboot

    #Update everything first, remove cache then reboot to detect problems
    pacman -Syu
    # Delete certs if you see a message like "/etc/ssl/certs/ca-certificates.crt exists in filesystem"
    rm /etc/ssl/certs/ca-certificates.crt
    #May be needed if the pacman version has changed during the update
    pacman-db-upgrade
    #Optional if you want to clear the cache
  3. yeokm1 revised this gist Dec 21, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,10 @@ tmpfs /var/log tmpfs nodev,nosuid 0 0
    tmpfs /var/tmp tmpfs nodev,nosuid 0 0
    #end

    #Adjust journald service to not log the system log to prevent flooding of the /var/log folder
    nano /etc/systemd/journald.conf
    #Uncomment and set "Storage=none"

    #To mount / partition as read-only
    nano /boot/cmdline.txt
    #Replace the "rw" flag with the "ro" flag right after the root= parameter.
  4. yeokm1 revised this gist Mar 25, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -51,8 +51,8 @@ systemctl disable systemd-random-seed
    #systemctl disable ntpd #Not working now

    #Put shortcut shell scripts to re-enable read-write temporarily if needed
    printf "mount -o remount,rw /" > writeenable.sh
    printf "mount -o remount,ro /" > readonly.sh
    printf "mount -o remount,rw /\nmount -o remount,rw /boot" > writeenable.sh
    printf "mount -o remount,ro /\nmount -o remount,ro /boot" > readonly.sh
    chmod 500 writeenable.sh
    chmod 500 readonly.sh

  5. yeokm1 revised this gist Jan 28, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ chmod 500 writeenable.sh
    chmod 500 readonly.sh

    #Change your password if needed (Optional)
    passwd
    "passwd root" or "passwd alarm"

    #Remove history
    history -c -w
  6. yeokm1 revised this gist Jan 28, 2016. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,18 @@ Unlike your typical computer where you usually shutdown properly, I cannot rely

    Full instructions and explanations are obtained from this [link](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html) but you can run these commands directly. I modified some of the instructions for personal convenience.

    Login with default username: alarm, password: alarm

    ```bash
    #Optionally enable root over SSH. The rest of these instructions assume u are in root.
    su
    nano /etc/ssh/sshd_config
    #Add "PermitRootLogin yes" to the Authentication section after "#PermitRootLogin prohibit-password" then save
    reboot

    #Login as root


    #Update everything first, remove cache then reboot to detect problems
    pacman -Syu
    #May be needed if the pacman version has changed during the update
  7. yeokm1 revised this gist Jan 28, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -35,9 +35,9 @@ nano /boot/cmdline.txt
    #Replace the "rw" flag with the "ro" flag right after the root= parameter.

    #Disable systemd services
    systemctl disable systemd-readahead-collect
    #systemctl disable systemd-readahead-collect #Not working now
    systemctl disable systemd-random-seed
    systemctl disable ntpd
    #systemctl disable ntpd #Not working now

    #Put shortcut shell scripts to re-enable read-write temporarily if needed
    printf "mount -o remount,rw /" > writeenable.sh
  8. Yeo Kheng Meng revised this gist May 9, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -45,6 +45,9 @@ printf "mount -o remount,ro /" > readonly.sh
    chmod 500 writeenable.sh
    chmod 500 readonly.sh

    #Change your password if needed (Optional)
    passwd

    #Remove history
    history -c -w

  9. Yeo Kheng Meng revised this gist Mar 7, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@ Full instructions and explanations are obtained from this [link](http://ruiabreu
    pacman -Syu
    #May be needed if the pacman version has changed during the update
    pacman-db-upgrade
    #Optional if you want to clear the cache
    pacman -Sc
    reboot

  10. Yeo Kheng Meng revised this gist Feb 16, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ reboot
    rm /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

    #Relocate DNS cache (This step causes problems on latest Arch Linux ARM kernels so skip this)
    #Relocate DNS cache (This step causes DNS problems on the latest Arch Linux ARM kernels so skip this)
    #rm /etc/resolv.conf
    #ln -s /tmp/resolv.conf /etc/resolv.conf

  11. Yeo Kheng Meng revised this gist Feb 16, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -16,9 +16,9 @@ reboot
    rm /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

    #Relocate DNS cache
    rm /etc/resolv.conf
    ln -s /tmp/resolv.conf /etc/resolv.conf
    #Relocate DNS cache (This step causes problems on latest Arch Linux ARM kernels so skip this)
    #rm /etc/resolv.conf
    #ln -s /tmp/resolv.conf /etc/resolv.conf

    #Adjust /etc/fstab, add/modify to the following hashed lines. Mount certain directories to RAM disk.
    nano /etc/fstab
  12. Yeo Kheng Meng revised this gist Feb 9, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ tmpfs /var/tmp tmpfs nodev,nosuid 0 0

    #To mount / partition as read-only
    nano /boot/cmdline.txt
    #Add an ro flag right after the root= parameter.
    #Replace the "rw" flag with the "ro" flag right after the root= parameter.

    #Disable systemd services
    systemctl disable systemd-readahead-collect
  13. Yeo Kheng Meng revised this gist Jan 8, 2015. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -22,9 +22,12 @@ ln -s /tmp/resolv.conf /etc/resolv.conf

    #Adjust /etc/fstab, add/modify to the following hashed lines. Mount certain directories to RAM disk.
    nano /etc/fstab
    #/dev/mmcblk0p1 /boot vfat defaults,ro,errors=remount-ro 0 0
    #tmpfs /var/log tmpfs nodev,nosuid 0 0
    #tmpfs /var/tmp tmpfs nodev,nosuid 0 0
    #Add the following lines up to the #end. Include the first commented line in case you have to set to write enabled next time.
    #/dev/mmcblk0p1 /boot vfat defaults 0 0
    /dev/mmcblk0p1 /boot vfat defaults,ro,errors=remount-ro 0 0
    tmpfs /var/log tmpfs nodev,nosuid 0 0
    tmpfs /var/tmp tmpfs nodev,nosuid 0 0
    #end

    #To mount / partition as read-only
    nano /boot/cmdline.txt
  14. Yeo Kheng Meng revised this gist Jan 8, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,8 @@ Full instructions and explanations are obtained from this [link](http://ruiabreu
    ```bash
    #Update everything first, remove cache then reboot to detect problems
    pacman -Syu
    #May be needed if the pacman version has changed during the update
    pacman-db-upgrade
    pacman -Sc
    reboot

  15. Yeo Kheng Meng revised this gist Jan 8, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -5,15 +5,15 @@ Unlike your typical computer where you usually shutdown properly, I cannot rely
    Full instructions and explanations are obtained from this [link](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html) but you can run these commands directly. I modified some of the instructions for personal convenience.

    ```bash
    #Change timezone (optional)
    rm /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

    #Update everything first, remove cache then reboot to detect problems
    pacman -Syu
    pacman -Sc
    reboot

    #Change timezone (optional)
    rm /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

    #Relocate DNS cache
    rm /etc/resolv.conf
    ln -s /tmp/resolv.conf /etc/resolv.conf
  16. Yeo Kheng Meng revised this gist Sep 9, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -34,9 +34,9 @@ systemctl disable systemd-random-seed
    systemctl disable ntpd

    #Put shortcut shell scripts to re-enable read-write temporarily if needed
    printf "mount -o remount,rw /" > readwrite.sh
    printf "mount -o remount,rw /" > writeenable.sh
    printf "mount -o remount,ro /" > readonly.sh
    chmod 500 readwrite.sh
    chmod 500 writeenable.sh
    chmod 500 readonly.sh

    #Remove history
    @@ -45,7 +45,7 @@ history -c -w
    reboot
    ```

    To enable read-write temporarily to do say an update, just run `./readwrite.sh`.
    To enable read-write temporarily to do say an update, just run `./writeenable.sh`.


    ## References
  17. Yeo Kheng Meng revised this gist Sep 9, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ Unlike your typical computer where you usually shutdown properly, I cannot rely
    Full instructions and explanations are obtained from this [link](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html) but you can run these commands directly. I modified some of the instructions for personal convenience.

    ```bash
    #Change timezone.
    #Change timezone (optional)
    rm /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

    @@ -45,7 +45,7 @@ history -c -w
    reboot
    ```

    To enable read-write temporarily to do say an update, just run `./readwrite.sh` . Volume changes do not persist if a read-only file system is used. To change volume permanently, set to read-write, change to desired volume then reboot.
    To enable read-write temporarily to do say an update, just run `./readwrite.sh`.


    ## References
  18. Yeo Kheng Meng revised this gist Sep 9, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    ##Read-only FS on Arch Linux ARM

    Unlike your typical computer where you usually shutdown properly, I cannot rely on this during the use of my Raspberry Pi. If the Raspberry Pi is improperly shutdown too many times, data corruption in the file system leading to unbootable SD card may result. So we should use a read-only file system.

    Full instructions and explanations are obtained from this [link](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html) but you can run these commands directly. I modified some of the instructions for personal convenience.
  19. Yeo Kheng Meng revised this gist Sep 9, 2014. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions Read-only FS on Arch Linux ARM.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    ## Convert to a read-only file system (Optional)

    Unlike your typical computer where you usually shutdown properly, I cannot rely on this during the use of my Raspberry Pi. If the Raspberry Pi is improperly shutdown too many times, data corruption in the file system leading to unbootable SD card may result. So we should use a read-only file system.

    Full instructions and explanations are obtained from this [link](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html) but you can run these commands directly. I modified some of the instructions for personal convenience.
  20. Yeo Kheng Meng renamed this gist Sep 9, 2014. 1 changed file with 0 additions and 0 deletions.
  21. Yeo Kheng Meng created this gist Sep 9, 2014.
    53 changes: 53 additions & 0 deletions Read-only FS on Arch Linux ARM
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    ## Convert to a read-only file system (Optional)

    Unlike your typical computer where you usually shutdown properly, I cannot rely on this during the use of my Raspberry Pi. If the Raspberry Pi is improperly shutdown too many times, data corruption in the file system leading to unbootable SD card may result. So we should use a read-only file system.

    Full instructions and explanations are obtained from this [link](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html) but you can run these commands directly. I modified some of the instructions for personal convenience.

    ```bash
    #Change timezone.
    rm /etc/localtime
    ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

    #Update everything first, remove cache then reboot to detect problems
    pacman -Syu
    pacman -Sc
    reboot

    #Relocate DNS cache
    rm /etc/resolv.conf
    ln -s /tmp/resolv.conf /etc/resolv.conf

    #Adjust /etc/fstab, add/modify to the following hashed lines. Mount certain directories to RAM disk.
    nano /etc/fstab
    #/dev/mmcblk0p1 /boot vfat defaults,ro,errors=remount-ro 0 0
    #tmpfs /var/log tmpfs nodev,nosuid 0 0
    #tmpfs /var/tmp tmpfs nodev,nosuid 0 0

    #To mount / partition as read-only
    nano /boot/cmdline.txt
    #Add an ro flag right after the root= parameter.

    #Disable systemd services
    systemctl disable systemd-readahead-collect
    systemctl disable systemd-random-seed
    systemctl disable ntpd

    #Put shortcut shell scripts to re-enable read-write temporarily if needed
    printf "mount -o remount,rw /" > readwrite.sh
    printf "mount -o remount,ro /" > readonly.sh
    chmod 500 readwrite.sh
    chmod 500 readonly.sh

    #Remove history
    history -c -w

    reboot
    ```

    To enable read-write temporarily to do say an update, just run `./readwrite.sh` . Volume changes do not persist if a read-only file system is used. To change volume permanently, set to read-write, change to desired volume then reboot.


    ## References

    1. [Read-only file system](http://ruiabreu.org/2013-06-02-booting-raspberry-pi-in-readonly.html)