Page 1 of 1
Programme settings lost after reboot
Posted: Sun Sep 24, 2017 8:22 am
by rjmusto
Hi all,
Running Jessie v8 on a RaspPi2.
For some reason it has stopped saving programme settings after a reboot - even new files saved to, say, Documents disappear.
I tried adding a new user and gave it sudo privileges, as I thought maybe I could get round the issue if using a new user - but on reboot, the new user has also disappeared.
I have tried running sync before rebooting, but has not made any difference.
Any help much appreciated.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 8:28 am
by rpdom
The most likely cause is that your SD card has failed and gone into "safe" read-only mode. They do this to preserve your existing data before the failure gets too severe.
Your files appear to get written correctly, but in reality the writes are all being buffered up and never get written to the actual storage.
I'm afraid that it is time to buy a new card and use the SD card copier to copy the old one to the new one.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 9:07 am
by rjmusto
Hi,
Thanks for the quick reply - and yes, I think you're right: it was fine until about a week ago. Never knew that SD's could behave that way, so have learnt something new.
I'll copy it over to a new card.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 11:24 am
by Heater
Re: SD cards becoming write protected.
I have a few questions:
1) Why does this happen? What is the root cause?
2) Why does the Raspberry Pi do this so much?
3) Has anyone acknowledged this as a Pi specific problem?
4) Is anyone looking into fixing it ?
These might sound like provocative or controversial questions, I don't mean to be.
Judging by the number of questions about and problems with this that have been passing through here for years I would say it is a real problem with the Pi somewhere.
Perhaps it is not so common but there are billions of SD cards in use in all kind of devices, phones, camera, etc. If cards randomly becoming write protected on those devices were as common as it is with the Pi we would be hearing about it all over the place. We do not.
Personally I have used SD cards in other boards, ARM based or otherwise. Even my own home made boards using files systems and drivers snagged off the net. The only time cards have become write protected is when being used with the Pi.
I conclude there is an issue here that has not been acknowledged yet.
Edit:
When I talk of SD cards becoming write protected I am not talking about file systems or the files on them becoming write protected. I am not talking about any kind of file system corruption due to random power outage etc. All of that can be fixed by copying a new image to the card.
No, I mean the actual raw SD, in whole or perhaps just certain blocks within it, becoming write protected. So far, when this has happened to me I have failed to find any tool to remove write protection of the whole card or blocks within it.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 12:57 pm
by beta-tester
Heater wrote: ↑Sun Sep 24, 2017 11:24 am
So far, when this has happened to me I have failed to find any tool to remove write protection of the whole card or blocks within it.
somewhere here in this forum it was already discussed and there was a link to a tool...
but the contents was, if a µSD card once became writeprotect because of the flash memory controller on the µSD card detected bad block by itself, it was not able to remove that protection anymore.
there are three reasons why a µSD card itself becomes write protect.
1. by setting a temoprary flag on the µSD cards flash memory controller, that will temporarity switch the µSD card into write protection mode. this is able to reverse.
2. by setting a permanent flag on the µSD cards flash memory controller, that will permanent switch the µSD card into write protect mode, that is permanent and non-reversible.
3. the µSD cards flash memory controller itself detected some faults (bad blocks/flash cells where dead because of reaching its maximum lifetime/write cycles), then this controller switch the whole µSD card into write protection mode, to protect further data destructions. this write protection is non-reversible as well.
depending on the µSD card and its controller on its flash memory a µSD card can handle bad cells/blocks/regions more and less well. depending of the internal organization and the used controller.
i guess very cheap µSD cards tend to just lock up the whole memory as soon it detects something weird.
i think it was this tool:
https://github.com/BertoldVdb/sdtool
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 1:25 pm
by Heater
beta-tester,
Thank you for your reply.
Unfortunately it does not address my concerns. It is typical of the replies we see to this issue which does not actually get us any further.
Re: Your bullet points 1) and 2)
I am aware of the possibility of telling the SD card to protect itself, permanently or otherwise. However I'm guessing that Pi users do not do that. Some how it happens anyway.
Why/how is that?
Re: item 3)
Perhaps so. But why are SD cards used with Pi having so many errors? I refuse to believe they are reaching their write cycle limit. Especially as many new users are coming here with such problems. Personally I have seen this with new cards with almost no use.
I have also seen cards have areas of blocks become unwritable, rather than the whole thing. I spent hours verifying this using dd to write and read back from cards and compare results.
Now, we could just write this off as a phenomena caused by people using cheap/fake SD cards.
Frankly, I'm not convinced by that argument.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 1:44 pm
by beta-tester
it never happen to me, that any of my SD cards of my many RPi's were falling into write protected mode.
even i stress my SD cards beyond normal usage - specially one test SD card, i can't beleave that this is still working after that many times of completely filling up to nearly the very last byte and reflashing it again.
so i can't really understand how SD cards fallin in to write protection mode by itself.
the only plausible reason to me is broken filesystem, but that is not a big problem, and the other reason is the card controller itself.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 2:04 pm
by Heater
beta-tester,
It never happened to you. However it has happened to me. And it has happened to many other posters arriving here. As this thread demonstrates.
As I said above, a broken file system is not the issue. That is easily fixed by rewriting the card with a good fs image. But if an SD has write protected itself, in whole or in part, that does not work.
I'm inclined to discount hand waving arguments about cheap/fake SD cards. Perhaps mine were fake, how would I know, they were purchased from reputable regular consumer outlets.
Given that this seems to be a Pi phenomena I think it is worthy of investigation and perhaps fixing rather than hand waving away all the time.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 2:18 pm
by pcmanbob
Personally I have never experienced this SD cards going read only.
I have used Kingston SD card right for my first pi B which used full size SD cards, and moved to Kingston micro Sd cards from the B+. I don't even use the fastest one only the class4 versions.
I have had several pi's that ran 24/7 one wrote to the SD card 10 -16 times a day and even suffered several sudden power outages with no harmful affects and ran for 2 years on the same SD card before the pi was no longer required, the card is still in use on other shorter term projects and works to this day.
My other long running pi has been running for 3 years 24/7 has suffered one card corruption which was my fault as I let the card become full which crashed the system, a re-flash of the OS and software re-load and it was back working, it writes to the card every 2 mins and every 15 min saving 2 different sets of data and creating new data files every 24 hours while archiving the old ones.
I have 4 or 5 SD cards which I use as test cards when helping people here which regularly get re-flashed with new OS image.
So with all this writing to and flashing of SD cards if it was a pi problem I would have expected to see such failures myself by now, I may be it just down to poor quality or fake SD cards.
With the number of pi's out there now if it was an inherent problem on the pi its self I would have expected to see many many many more reports of SD card failures, with 12.5 million pi's having been sold if just 1% of people experienced this problem that would be 120,000 people having a problem, I think by now if that many people were having this problem this forum would be snowed under with reports of SD card failures.
just my humble opinion.

Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 2:35 pm
by rpdom
Not trying to give an explanation, as I don't know the details of what causes it, but pointing out that repeated flashing of the card is one thing that isn't going to wear it out quickly. You will be writing exactly once to each block, in sequence, which the card will buffer and perform one erase/write per page.
However, day to day running, with log files in particular, may require many thousands of read/erase/write cycles per page per hour. I don't know how well the cards handle non-sequential writing (one line to file A, one line to file B, another line to file A, a line to file C etc), but they were ultimately designed for media storage with sequential writes.
As I said, I don't really understand what causes it, but it does appear to be a thing.
I've had two cards fail in total. Neither went "read only", they just died completely. At least one of them was probably a fake. I run "Lite" on all my systems, so there is probably less going on with them than on a full fat GUI system.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 2:47 pm
by Heater
pcmanbob,
Your story is that you never had a problem. My story is that I did, a few times.
Anecdotes don't get us very far.
I agree that it looks like statistically this is not a common problem.
On the other hand, there is a steady trickle of such problems passing through here all the time.
I could argue that of those 1% that have a problem, 99% of them just bin the SD card, try again with a new one and be happy. Which I think would be a natural thing to do.
That leaves us with 1200 people, according to your guestimate, who get stuck with it. Like our poster here.
I could further argue that perhaps 10% of those bother to post here about their problem. The rest give up.
Which kind of leaves us with the trickle of failed SD cards posts we see here.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 3:06 pm
by pcmanbob
Heater, rpdom
I don't disagree with your comments or arguments, I was mealy expressing my own options, I don't think this problem will be resolved until someone can produce a repeatable pi example that will cause an SD card to go read only every time, then and only then will it be possible to actually get to the bottom of this problem and prove if its a pi hardware/software problem or just an inherent SD card problem, until then we can only surmise and mull over the problem.
I would be nice to know how many posts / people there are with this problem.
At least thinking about problems like this keeps the little grey cells working.
Re: Programme settings lost after reboot
Posted: Sun Sep 24, 2017 7:00 pm
by rjmusto
Just to conclude from my original post:
having used DD to copy the old card to a new one, I now have normal function restored on the PI.
The old SD is a Kingston 16GB HC10 and seems now to be non-writable. I've tried re-partioning etc, but all attempts fail.
Lets hope the new one doesn't go the same way.
And thanks for the help.