Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: raspberry Pi poweroff options  (Read 5728 times)

0 Members and 1 Guest are viewing this topic.

leapinlew

  • Some questionable things going on in this room with cheetos
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7906
  • Last login:March 19, 2024, 06:19:27 pm
raspberry Pi poweroff options
« on: September 30, 2018, 04:12:09 am »
I didn't realize we had a Pi sub board. I posted a question in the main forum, that I should have posted here. The other thread is here:
http://forum.arcadecontrols.com/index.php/topic,158411.0.html

This is what I asked:
I've been tinkering with the idea of rebuilding my bartop Defender. If I do, I'll post a small update in Project Announcements.

The problem with it is that I used a PC on the initial build. It worked fine for a couple years, but 1 reboot and it was dead. I'm fairly sure the windows install is corrupt. It was a tight squeeze putting PC guts in it, so this time around I want to do things different. This bartop only plays Defender (doesn't even play Stargate). I want to be able to power off with a lightswitch and not worry about having to reboot it.

  • 19-n-1 multigame: disable all games but Defender. I already own a jamma harness and power supply. The 19-n-1 costs less than $50.
  • Raspberry Pi: Launch directly into Defender. I already have a Pi, power supply and encoder.

I'd use the pi, if there is a way to power it off without worrying about corrupting the image. The 19-n-1 is pretty rock solid, but I'd prefer to not shell out the $50. One way or another, I got to get this bartop back in business. Is my Rpi knowledge out of date? Is there a way to power it off abruptly and not worry about corruption? If there isn't, I'm going with the 19-n-1.

Sorry for the cross board post.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: raspberry Pi poweroff options
« Reply #1 on: September 30, 2018, 09:46:02 am »
I'd use the pi, if there is a way to power it off without worrying about corrupting the image.
Del posted one good option here along with a handy cheat-sheet based on this video by ETA Priime.




Scott

barrymossel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:October 29, 2021, 11:25:52 am
  • Spectrum
    • forum.arcadecontrols.com/index.php/topic,157647.0.html

leapinlew

  • Some questionable things going on in this room with cheetos
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7906
  • Last login:March 19, 2024, 06:19:27 pm
Re: raspberry Pi poweroff options
« Reply #3 on: September 30, 2018, 05:31:27 pm »
It seems apparent there isn’t a fix for dealing with corruption other than to create an easier method to power down.

Appreciate the effort everyone! I’ve learned a lot.

ekinskofer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 29
  • Last login:September 18, 2021, 02:55:48 pm
  • I want to build my own arcade controls!
Re: raspberry Pi poweroff options
« Reply #4 on: September 30, 2018, 07:39:56 pm »
Hi guys, I too was looking for a way to do this, however, I am also looking for a way to stater/shut down my arcade monitor at the same time. Can I use this power block or the PI to switch a relay that will shut off my monitor or is there an easier way to do this. I'm looking for one switch to do:

1. On - start the PI (or wake it up from sleep), turn on the monitor.
2. Off - shut down the PI (or put it to sleep), and turn off the monitor.

many thanks,
E

barrymossel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:October 29, 2021, 11:25:52 am
  • Spectrum
    • forum.arcadecontrols.com/index.php/topic,157647.0.html
Re: raspberry Pi poweroff options
« Reply #5 on: October 01, 2018, 07:42:06 am »
Hi guys, I too was looking for a way to do this, however, I am also looking for a way to stater/shut down my arcade monitor at the same time. Can I use this power block or the PI to switch a relay that will shut off my monitor or is there an easier way to do this. I'm looking for one switch to do:

1. On - start the PI (or wake it up from sleep), turn on the monitor.
2. Off - shut down the PI (or put it to sleep), and turn off the monitor.

many thanks,
E
I tried it with a cheap relay which was switched by the 5V from the RPi (to switch the 230V of the monitor). Worked ok. The RPi was turned on by a Mausberry circuit. Unfortunately the monitor has to be turned on before the RPi in my case, as otherwise the resolution settings are off. So I will keep my (LCD) monitor in standby mode.

thebrokenjoystick

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:December 01, 2018, 08:23:18 pm
  • The cake is a lie
    • My Vogon Poetry
Re: raspberry Pi poweroff options
« Reply #6 on: October 01, 2018, 02:36:45 pm »
if you're only running one game, couldn't you make the disk readonly? then you wouldn't have to worry about writing to disk - no corruption. Not sure how all the other parts of the system would react to being readonly though. I have a full size tapper that dies and I put in a raspberry pi. i just make sure i shut it down properly.

pbj

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10871
  • Last login:Today at 09:18:31 am
  • Obey.
    • The Chris Burke Band
Re: raspberry Pi poweroff options
« Reply #7 on: October 01, 2018, 02:56:00 pm »
Boot times are what kills the Pi for me.  It's ridiculous.

barrymossel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 498
  • Last login:October 29, 2021, 11:25:52 am
  • Spectrum
    • forum.arcadecontrols.com/index.php/topic,157647.0.html
Re: raspberry Pi poweroff options
« Reply #8 on: October 02, 2018, 02:34:33 am »
if you're only running one game, couldn't you make the disk readonly? then you wouldn't have to worry about writing to disk - no corruption. Not sure how all the other parts of the system would react to being readonly though. I have a full size tapper that dies and I put in a raspberry pi. i just make sure i shut it down properly.
I believe that would work. Put roms/config on a USB stick then...

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: raspberry Pi poweroff options
« Reply #9 on: November 09, 2018, 11:25:34 pm »
Yeah I have one of those Nintendoh NES Pi cases with the power off button and script you have to add to the config, but I too have serious doubts with this as I have almost lost a 64gb sdcard to accidental reboots.

So why not add a fsck command at the end of the power down script to check it, or do what I do and never turn off the pi.  I also added a 64gb Samsung USB stick with a backup of all my games, just in case.  I got it at Frys for $20.  I'd pay $20 not to lose all my stuff on that 64 GB SDcard and it its a Unirex one too.   :lol
If I had only one wish, it would be for three more wishes.

Grasshopper

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2380
  • Last login:November 08, 2023, 07:20:31 am
  • life, don't talk to me about life
Re: raspberry Pi poweroff options
« Reply #10 on: November 11, 2018, 07:29:43 am »
The best way to prevent an SD card from being written to is to make its root filesystem read-only and then overlay the root filesystem with a read-write tmpfs (which is essentially a RAM disk). This is how most Linux Live CDs work.

There are lots of guides on the internet that explain how to do this. But one of the better ones can be found here:

https://yagrebu.net/unix/rpi-overlay.md

If you also want to retain the ability to add/remove ROMS and change settings then it's possible for the ROMS and settings to be stored on an external USB flash drive. A guide that explains how to do this can be found here:

https://github.com/RetroPie/RetroPie-Setup/wiki/Running-ROMs-from-a-USB-drive

Personally, I think the SD card corruption issue has been massively overblown. As long as you stick to branded cards bought from reputable suppliers, and you always check them to make sure they're not fake (I use h2testw.exe to do this) you're unlikely to run into any problems.

The only time I've had a USB flash failure is when I bought a dodgy brand (Netac) directly from China. All my mainstream branded cards have been rock solid.
"Patriotism is the last refuge of the scoundrel." - Samuel Johnson

Grasshopper

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2380
  • Last login:November 08, 2023, 07:20:31 am
  • life, don't talk to me about life
Re: raspberry Pi poweroff options
« Reply #11 on: November 11, 2018, 10:39:50 am »
Here's another guide that looks fairly easy to follow:

https://github.com/janztec/empc-arpi-linux-readonly
"Patriotism is the last refuge of the scoundrel." - Samuel Johnson

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: raspberry Pi poweroff options
« Reply #12 on: November 11, 2018, 02:25:54 pm »
Grasshopper;
that write up is not for the Debian Jessie, which I have on my photobooth.
Will it work on it?
My photobooth does a lot of writing to the SDCard.
If a USB stick is not plugged in, it defaults to saving photos and videos to the SDCard.
Also, the program keeps a log file while running and it is saved to the SDCard, as well as all the settings for the photobooth, in a text file, but it only reads that file. The setup program only writes to it.
I am tossing around the idea of making the sdcard read only and require that a dedicated usb stick be plugged in with program and everything else on it.
Appreciate your thoughts on this.

Grasshopper

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2380
  • Last login:November 08, 2023, 07:20:31 am
  • life, don't talk to me about life
Re: raspberry Pi poweroff options
« Reply #13 on: November 11, 2018, 03:17:20 pm »
that write up is not for the Debian Jessie, which I have on my photobooth.
Will it work on it?

From what I've been reading, there are small differences between the procedure for Jessie and Stretch. But if you google for "raspbian jessie overlayfs" or similar, a lot of links pop up. For example:

https://www.monocilindro.com/2017/02/18/how-to-make-raspberry-pi-3-with-raspbian-jessie-read-only/
"Patriotism is the last refuge of the scoundrel." - Samuel Johnson

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1847
  • Last login:October 06, 2023, 10:20:39 pm
  • Web Developer.
Re: raspberry Pi poweroff options
« Reply #14 on: November 14, 2018, 05:32:04 am »
Are you using arcade crt, tv crt, or lcd?

There are ways to have the raspberry pi in read only mode. You would loose high scores. Perhaps installing mame on usb in read/write could resolve this, but could still get corrupted. At least it would be an easy fix.

I hate to say it, but multiboard is easy solution. Or original board.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: raspberry Pi poweroff options
« Reply #15 on: November 15, 2018, 04:55:18 am »
Newegg sells the SSD interface for the PI3+.  You can boot directly into it, which would end the corruption issue for the SD card but will not stop OS corruption issues when powering off a PI without a shutdown.
If I had only one wish, it would be for three more wishes.

Grasshopper

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2380
  • Last login:November 08, 2023, 07:20:31 am
  • life, don't talk to me about life
Re: raspberry Pi poweroff options
« Reply #16 on: November 17, 2018, 01:10:34 pm »
Grasshopper;
that write up is not for the Debian Jessie, which I have on my photobooth.
Will it work on it?
My photobooth does a lot of writing to the SDCard.
If a USB stick is not plugged in, it defaults to saving photos and videos to the SDCard.
Also, the program keeps a log file while running and it is saved to the SDCard, as well as all the settings for the photobooth, in a text file, but it only reads that file. The setup program only writes to it.
I am tossing around the idea of making the sdcard read only and require that a dedicated usb stick be plugged in with program and everything else on it.
Appreciate your thoughts on this.

I don't really need this facility right now, but just as a proof of concept, I decided to try and make one of my Retropie images read-only. I followed the tutorial here:

https://github.com/janztec/empc-arpi-linux-readonly

I took a risk and didn't bother backing up the image. However, I did take copies of the cmdline.txt and config.txt files on the boot partition. I believe these are the only important files that get changed, and as the boot partition is readable from Windows, I figured it would be easy to restore them if something went wrong.

It turned out that my Retropie image was also based around Jessie (which I didn't realise). The installation script detected this and stopped with an error message. So I took another chance and commented out the lines in the script that detect the kernel and linux versions, and then re-ran the script.

I'm pleased to report that it appears to have worked!

As a test, I booted the image and then changed a few settings like the Emulation Station theme, and the video shader being used. I then rebooted, and all the settings I had changed had reverted back to what they were before.

I also created a dummy file in the /home/pi directory. When I rebooted the file had gone.

I then checked the status of the two partitions on the SD card by running the following command:

mount | grep /mmcblk0

I got the following output:

/dev/mmcblk0p2 on /ro type ext4 (ro,relatime,data=ordered)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

So it does appear that the root partition is now read-only. The boot partition is still read/write but that's easily fixed.
"Patriotism is the last refuge of the scoundrel." - Samuel Johnson

morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 336
  • Last login:July 23, 2021, 09:36:59 am
  • I want to build my own arcade controls!
Re: raspberry Pi poweroff options
« Reply #17 on: November 18, 2018, 07:46:08 am »
On the Pi3 I believe it can be set up to boot primarily from a USB, which is less apt to be corrupted. The main boot is still on the SD, but all other files are moved off to USB. Also really improves boot time.

There are ways to disable a lot in the boot and get it up and running a bit quicker as well via command line and config... I usually find a guide or FAQ to follow.