Protect your Raspberry PI SD card, use Read-Only filesystem

  • Hello! Can anybody help me with user crontab file? I have problem: i installed raspbian in Read-only mode, i have some scripts, (cron jobs) that works every 5 minutes, 10 etc. I set it by crontab -e command, but after reboot, system is clean it, i think, because i moved /var/spool dir to tmpfs (like howto), and user cronjob file stored at /var/spool/cron/crontabs dir. How i can fix it for not clearing after system reboot? Thanks!

  • Did anyone figured out how to use crontab? it is wiped after reboot and i really need it :(

  • Staff

    We need to put the system into Read Write Mode before changing the crontab
    If you followed this tuto should be something like that

    sudo mount -o remount,rw /

    Then edit your crontab

    sudo crontab -e

    put pack in Read Only or reboot

    sudo mount -o remount,ro /

  • Charles you are going wrong. crontab -e give us file on /tmp which has been deleted on boot. We need to go this way:
    sudo su
    nano /etc/crontab (dont forget to add user) example below:

            • root /usr/bin/ > /dev/null 2>&1

  • Hello Charles,
    I was wondering if I don't have entry about /tmp being a mount entry point for tmpfs neither in fstab nor mtab, what would be the point in moving things there? Am I missing something or?
    I am playing with Raspberry PI-2 and Raspbian Jessie.

  • This post is deleted!

  • Great article, thanx! To be able to use sudo i did have to add this line to /etc/fstab as well:

    tmpfs /var/lib/sudo/ts tmpfs nosuid,nodev 0 0

  • Has this tutorial worked for anyone? The 1st error is saw was under Move files to temp filesystem after running:

    touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf

    Failed to create symbolic link ‘etc/resolv.conf’ file exists. Next after reboot see errors regarding “a start job is running for dhcpd on all interfaces..." The raspi fails to boot and see pi@raspberrypi: prompt. Thanks in advance for any insights!

  • I followed the manual and created an IMG file which I shrieked to fit on smaller SD Cards. After using the image for another PI the startup fails.

    The problem might be related to the changed Partition table. The system is trying to do some I/O on startup which fails. I have no real log, since the PI gets stuck in a reboot loop.

    I just like to mention the problem, maybe someone has a fix for it or hint's how to find the exact issue.

    Any help is welcome. Thanks.

  • Tried this on Jessie Lite, it booted but it broke way too many things -- bluetooth, login service, ssh, etc. I recommend looking elsewhere for instructions.

Looks like your connection to Community Forum was lost, please wait while we try to reconnect.