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.

  • 1
    Are you sure your microSD card is still RW? I have had cards go bad, but everything appears to be working. Any changes made are not persistent. I haven't found a fix for these cards and discard them. – bobstro Jul 24 '17 at 20:22
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.

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?

  • Well, if I unplug the sd while in use, it mess up the os..., perms says -rwxr-xr-x 1 root root 420 Nov 25 2016 /etc/rc.local. Should there not be a w in there. How do I added write to this card. – user2144480 Jul 24 '17 at 21:43
  • @user2144480 that's 0755, it's alright. Try setting immutable flag with chattr +i /etc/rc.local and rebooting. Does it disappear? Remove immutable flag with chattr -i /etc/rc.local – user2497 Jul 24 '17 at 23:22
  • If I run the +I what am I looking to disappear? I still have -rwxr-xr-x 1 root root 420, I did reboot. A +i should add the flag yes? So in this case it did not appear. Or do I have something confused here? – user2144480 Jul 25 '17 at 0:14
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!

  • Just a tab bit unclear on how to know if I have a ram disk. but I see a lot of ram, 0-15 in dev? If I do a "sudo umount /etc" I get /etc is not mounted. SD card is about 6 months old and is only used to operate the web, nothing else really. Is this the average life expectancy? – user2144480 Jul 24 '17 at 22:51
  • FYI. I do not have any sdd's in dev. – user2144480 Jul 24 '17 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.