1

This has to be the strangest thing I have seen on Linux yet. It's almost like I'm running a live CD but clearly not. I did a standard raspberry install and have been using it for a long time. I wanted to update my date on boot and now realize the rc.local file does not work. I tried to add a line and on reboot the rc.local file is reverted. I made my changes with sudo and verified, reboot and it is back to default. I then set a root password and edited with su and wiped the file clean, save, rebooted. It's back to its default. What in the heck is going on here?

ok... so I just tried crontab and the same thing happened?

From what I read online it's a sd card issue, I guess I'm editing a ram drive? Can't anyone help on this. I'm not really used to this type of set up, sd cards, ram drives etc...I don't know where to start.

user2144480
  • 111
  • 2

3 Answers3

1

It is most likely that your SD Card has finished to work properly but it seems that it is still readable. So the very first action should be to take a backup of the card.

The problem with SD Cards is that they fail to write data but does not report this failure to the overlaying operating system so it does not recognize the error. Linux caches data that should written to a device and also read its data back from the cache so access to the SD Card is not direct involved. So write and read to/from the cache works but the cache will never flushed to the SD Card. On a reboot the caches are empty and you will only find the old content read from the SD Card. You can verify this behavior with Detect an SD card that became read-only.

Ingo
  • 42,961
  • 20
  • 87
  • 207
0

It will not usually be recreated, though if it is missing or corrupt it may be - even if corrupt it should not be touched. Paste it, and we'll see. Try ls -l /etc/rc.local as well. Did you play with permissions?

user2497
  • 681
  • 5
  • 8
0

You would see this if you have the filesystem that contains /etc on a RAM disk rather than on the SD directly. In such cases, you'll have to unmount the RAM disk, change the underlying data, then remount (or reboot, which will copy the files to RAM disk).

If you're doing something like: https://andrewmemory.wordpress.com/2016/04/06/mounting-a-pi-with-wheezy-read-only/

then you will want to:

sudo umount /etc
sudo mount -o remount,rw /

then make your change.

If you're not using RAM disks / tmpfs, then it's likely that the SD card is getting worn out and has gone to read-only mode. If that's the case, make a copy soon!

user3486184
  • 256
  • 4
  • 7