Skip to content
  • Blog
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Community Forum

  1. Home
  2. Categories
  3. Blog articles comments
  4. Protect your Raspberry PI SD card, use Read-Only filesystem

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

Scheduled Pinned Locked Moved Blog articles comments
lifefilesystemcardlogend
69 Posts 42 Posters 64.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjeanne
    wrote on last edited by
    #56

    you need to be root..
    use 'sudo'

    1 Reply Last reply
    • M Offline
      M Offline
      mocart2
      wrote on last edited by
      #57

      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!

      1 Reply Last reply
      • C Offline
        C Offline
        Cavallonzio
        wrote on last edited by
        #58

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

        1 Reply Last reply
        • CharlesC Offline
          CharlesC Offline
          Charles
          wrote on last edited by
          #59

          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 /
          
          1 Reply Last reply
          • Damian MacD Offline
            Damian MacD Offline
            Damian Mac
            wrote on last edited by
            #60

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

                    • root /usr/bin/vpncheck.sh > /dev/null 2>&1
            1 Reply Last reply
            • N Offline
              N Offline
              Neoromantic
              wrote on last edited by
              #61

              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.

              1 Reply Last reply
              • R Offline
                R Offline
                ricky
                wrote on last edited by
                #62
                This post is deleted!
                1 Reply Last reply
                • Rok JarcR Offline
                  Rok JarcR Offline
                  Rok Jarc
                  wrote on last edited by
                  #63

                  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

                  1 Reply Last reply
                  • D Offline
                    D Offline
                    dev
                    wrote on last edited by
                    #64

                    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!

                    1 Reply Last reply
                    • A Offline
                      A Offline
                      Antoine Megens
                      wrote on last edited by
                      #65

                      I don't seem to be able to copy/paste from your crayon syntax highlighter widgets? The copy button doesn't work, nor does the button to expand the code.

                      1 Reply Last reply
                      • P Offline
                        P Offline
                        Piotr Mackowiak
                        wrote on last edited by
                        #66

                        OK, nice tutorial. But where (I mean about file) I have to place:

                        rm -rf /var/lib/dhcp/ /var/lib/dhcpcd5 /var/run /var/spool /var/lock /etc/resolv.conf
                        ln -s /tmp /var/lib/dhcp
                        ln -s /tmp /var/lib/dhcpcd5
                        ln -s /tmp /var/run
                        ln -s /tmp /var/spool
                        ln -s /tmp /var/lock
                        touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf

                        1 Reply Last reply
                        • E Offline
                          E Offline
                          Elliott Balsley
                          wrote on last edited by
                          #67

                          Nice guide. I used it on Stretch.

                          • I had to symlink /var/lib/sudo/ts to /tmp because it gives an error every time running sudo, then I made a systemd service to make that folder
                          • The /tmp/random-seed file does not get created at startup, even though I added the ExecStartPre line. It says success, but I can't figure out why that file isn't being created:
                            Process: 97 ExecStartPre=/bin/echo a > /tmp/random-seed (code=exited, status=0/SUCCESS)
                          • Stretch uses systemd-timesyncd, so there's no need for ntp and it would conflict.
                          • I like the bash_logout idea to mount ro, but it fails because mount: only root can use "--options" option
                          • Fail2ban isn't working. Anybody know if it's possible to configure that to monitor the busybox ring buffer?
                          1 Reply Last reply
                          • H Offline
                            H Offline
                            HemantJoshi
                            wrote on last edited by
                            #68

                            I am following this article in order avoid any/every write to /var/log/ (for example /var/log/wtmp, /var/log/last.log etc.
                            Is it possible?

                            Note that by disabling rsyslog.service, I could suppress write to messages and syslog files.

                            Using systemd mask operation I could mask systemd-update-utmp.service and systemd-update-utmp-runlevel.service. However the wtmp and lastlog files are still updated.

                            Please advise.

                            1 Reply Last reply
                            • H Offline
                              H Offline
                              hernaninf
                              wrote on last edited by
                              #69

                              Great article, thanks! Can I use this tip to make a Pi print server for some voucher printers and it stay well when it be turned off? Do you suggest some type of memory to be installed on Pi in order to run this way?

                              1 Reply Last reply

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              3

                              Online

                              5.8k

                              Users

                              565

                              Topics

                              5.3k

                              Posts

                              Top Topics

                              Popular Tags

                              teleinfo
                              25 topics
                              arduino
                              19 topics
                              remora
                              16 topics
                              esp8266
                              10 topics
                              arduipi
                              10 topics
                              raspberry
                              8 topics
                              wifinfo
                              7 topics
                              broadcast
                              7 topics
                              Copyright © 2022 Charles-Henri Hallard | Return to blog page | Powered by NodeBB
                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Blog
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups