User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

RPi not booting after power out

Fri Aug 11, 2017 3:44 pm

Hi

I've been setting up an RPi under the latest Raspbian to use as a kiosk (I've tried other ways and none of them have worked). I have used instructions from here: https://medium.com/stories-from-upstate ... c2724acaa1 and it works fine, although I had to make a couple of adjustments as things seemed to have changed since it was written. Basically it's a mix if this and Dan Purdy's instructions out there (neither of them worked if I followed them to the letter).

Anyway, included in them is a line to not display any errors after rebooting following a power out... but I can never get to this point.

I have the Pi booting into Chromium, showing the website no problem, all working as it should. But if I simulate a power out, and unplug the Pi, the only way to get it working again is by starting from scratch (reformatting, reinstalling Jessie, reconfiguring everything again, etc.). If I turn on the Pi, my screen just remains blank, nothing... not even the rainbow screen... and the screen eventually just goes into sleep mode.

I don't know what it is that is going wrong when this happens, and I would like to know if there is any way around it (not involving a UPS or battery).

Thanks

pcmanbob
Posts: 12841
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RPi not booting after power out

Fri Aug 11, 2017 3:53 pm

Hi.

Sounds like you are corrupting your SD card by pulling the power without shutting down the pi first. This is a common occurrence, how did the instructions say to get round this, as just having a line saying don't display error wont help if the SD card is corrupt.

Edit.

Having looked at the linked site I can see nothing on there about ignoring errors after a power fail.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 3:59 pm

I haven't actually found anything that says to solve that... still new to all this hehehe

Thing is, I live in a very power-dodgy area, so the electricity goes out all the time, especially in summer.

It's an installation of Jessie (without NOOBS), then add the lines to get the RPi to run in kiosk mode with the addition of unclutter and this line in the autostart

@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences

But I never realised this was going to be an issue, and it has me wondering about another project I am working on with a Zero running RetroPie, and if this is going to have the same problem if there is a power out mid-game

Thanks

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:05 pm

At the moment I'm installing again, but with Noobs this time, see if that is what might be missing in this case (does Noobs have some kind of power out protection involved?)... see how this goes.

User avatar
DougieLawson
Posts: 42155
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: RPi not booting after power out

Fri Aug 11, 2017 4:09 pm

Epitaph wrote:
Fri Aug 11, 2017 4:05 pm
At the moment I'm installing again, but with Noobs this time, see if that is what might be missing in this case (does Noobs have some kind of power out protection involved?)... see how this goes.
NOOBS has nothing. It's an installer/boot manager nothing more. If you only want Raspbian on your SDCard you are completely wasting your time and losing 1.3GB of space with NOOBS.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:12 pm

I know, but at the moment, being this lost, it's throwing everything against the wall and seeing what sticks, because I have a friend who asked a friend and said they don't have any problems just unplugging the Pi, and the only difference is they have NOOBS on it.

As a fully fledged NOOB myself, it's trial and error with ridiculous reasoning to see if somethign works hehehehe

gkaiseril
Posts: 679
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: RPi not booting after power out

Fri Aug 11, 2017 4:20 pm

Because SD cards and most removable media have a long write cycle, the data to write to the card is cached until there is a lull in processing or the cache buffer is full and then the data cached data is written to the media and the system slows down. On other systems there is a routine that should be used before removing the media. On Windows one needs to "Eject" the card and wait for the "Safe to remove" message. You might need to add some circuitry and software that will trigger a shut down script through the use of the GPIO pins.

Pi Supply Switch – On/Off Power Switch for Raspberry Pi
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:28 pm

But surely that wouldn't help when it comes to power outages...

User avatar
DougieLawson
Posts: 42155
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: RPi not booting after power out

Fri Aug 11, 2017 4:30 pm

sudo shutdown -h now or sudo poweroff or sudo shutdown -P now
Wait for ten winks on green LED
Pull power.

It's not rocket science.

It depends when a power outage happens. If the RPi is idle or hanging then it's no big deal. There are OEM UPS hardware add-ons if your power outages are frequent.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:31 pm

As I said, that doesn't help with power outs... the power company doesn't call me to say "hey, there's going to be a power out in one minute... better shut your Pi off"

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:36 pm

the RPi is literally in Chromium, displaying a website, and nothign more... no one is using it, no one is accessing it, nothing, so it's as close to idle as you're going to get really... but I've also tried before with just Raspbian on, and the CPU usage showing 0%, being idle for a while, unplug and plug in to see what happens, and nothing.

And, as I said, UPS and batteries are not an option on this

gkaiseril
Posts: 679
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: RPi not booting after power out

Fri Aug 11, 2017 4:42 pm

One can add the power switch to a battery UPS is needed.

Or if one is not gathering data with the kiosk, just keep a backup SD card handy.

You can create a backup SD card using either SD Copier on the desktop or piclone on the command line.
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:49 pm

It's a solution if I was in situ, but if I'm going to have to drive down to the shop every time the power goes out to change the SD card because otherwise it's going to be all weekend possibly (until I go back on the monday, if the electricity goes on the friday night) with no advertising in the window

User avatar
RaTTuS
Posts: 10818
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: RPi not booting after power out

Fri Aug 11, 2017 4:50 pm

use a battery backup hat solution
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:52 pm

Well... I've forced the power off a few times with the NOOBS installation, like when the processing is at 100%, as in, in the middle of doing something, and it takes a couple of seconds longer to power back up, but it powers up and enters the operating system. On a Raspbian installation without NOOBS, it wouldn't do that even once on idle, it would just refuse to boot up, so it seems NOOBS is doing something...

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 4:53 pm

Again... UPS and battery are not options in this specific case... they just aren't

(I bet someone else is going to come on now and say "a battery would solve it")

gkaiseril
Posts: 679
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: RPi not booting after power out

Fri Aug 11, 2017 5:04 pm

You might want to clearly explain why you think a small AA battery backup UPS will not work.
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 5:17 pm

Would the reason as to why a battery cannot be used change in any way the issue or the possible answers?

Well, must have unplugged it at least 20 times so far with the installation via NOOBS, and still no problems, and yet the direct Raspbian couldn't survive 1 power cut, so it seems NOOBS does more than just simply installing the easy way...

NotRequired
Posts: 266
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: RPi not booting after power out

Fri Aug 11, 2017 5:31 pm

Just an idea.. Have you tried to either disable the cache in Chromium or to move it to volatile memory (eg. /dev/shm)? This will reduce writes to SD card an lower the possibility of corruption caused by dirty shutdowns. The problem could also be that the SD card itself is not able to handle a power outage and this is not really a Pi fault :)
Glowing in the dark!

User avatar
Burngate
Posts: 6525
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore

Re: RPi not booting after power out

Fri Aug 11, 2017 5:48 pm

At any random time, a Pi running off an SD card could be writing to the card, or the card itself could be doing housekeeping.
If the power is cut during either of those, the card can become corrupted.
Only after a full shut-down is the card not being written to, or doing housekeeping.

But, at random times and without warning, your power company cuts your power.

It seems to me you have two choices: prevent your power company from cutting the power to yor Pi, or not allow writing to your SD card.
The first is a UPS of some sort, which you don't want.
The second requires your Pi to run totally in memory (which could mean saving stuff over your network)

NotRequired
Posts: 266
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: RPi not booting after power out

Fri Aug 11, 2017 5:53 pm

In another thread a read only SD card approach is discussed, maybe a solution as well: viewtopic.php?t=161416
Glowing in the dark!

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 5:55 pm

NotRequired wrote:
Fri Aug 11, 2017 5:31 pm
Just an idea.. Have you tried to either disable the cache in Chromium or to move it to volatile memory (eg. /dev/shm)? This will reduce writes to SD card an lower the possibility of corruption caused by dirty shutdowns. The problem could also be that the SD card itself is not able to handle a power outage and this is not really a Pi fault :)
I was considering it being the SD card, but as I said, I've just done the same again, and the only difference I've made this time around is that I have installed it under NOOBS instead of preping the card on my computer and using Raspbian directly. Under the direct method, it would lose the ability to reboot every time, and yet under NOOBS, it has had no problems whatsoever... and this is with the same SD card, and the same Pi.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 5:59 pm

Burngate wrote:
Fri Aug 11, 2017 5:48 pm
At any random time, a Pi running off an SD card could be writing to the card, or the card itself could be doing housekeeping.
If the power is cut during either of those, the card can become corrupted.
Only after a full shut-down is the card not being written to, or doing housekeeping.

But, at random times and without warning, your power company cuts your power.

It seems to me you have two choices: prevent your power company from cutting the power to yor Pi, or not allow writing to your SD card.
The first is a UPS of some sort, which you don't want.
The second requires your Pi to run totally in memory (which could mean saving stuff over your network)
The fixing of the power company isn't much of an option. The issue is this is a rustic area that has had a boom in tourism over the years. The mains power system is from the 60's, and the power company can't be bothered to upgrade it, and there are ever more houses and commercial centres all being added onto the same grid. They refuse to upgrade because "what's the point for 2 months a year", but we get blackouts all year round, but especially in summer... the problem isn't local to me, it's the entire grid, and the CEOs have more urgency in getting a new yacht than to invest in their grid. The issues of living in a third world country that thinks it's in the first world...

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 6:01 pm

NotRequired wrote:
Fri Aug 11, 2017 5:53 pm
In another thread a read only SD card approach is discussed, maybe a solution as well: viewtopic.php?t=161416
I was considering that approach, but I see one issue with that, and that is if I need to access remotely to change something, liek any changes in the webpage it's displaying or something like that. If it's in read only mode, I would have to change it every time something like that is done, and when you're not physically all the time where the Pi is, it's a bit if an issue.

User avatar
Epitaph
Posts: 18
Joined: Wed Jul 26, 2017 6:12 pm

Re: RPi not booting after power out

Fri Aug 11, 2017 6:03 pm

Anyway, it seems a solution was found, although I was hoping not to have to use NOOBS for this, but it seems to have solved the problem I was having, so, a small price to pay if it gets the job done I think...

Return to “General discussion”