I run rpi 3b headless with 'feh' for a slideshow so cannot run 'shutdown' when we switchoff power at night. The SD card has not yet been undamaged.
Presumably the risk is that the raspbian OS writes to an sd card at the time the power is removed ?
Is there a version of raspbian that never writes to the sd card after startup (perhaps writes to ram instead) please ?
Thanks
angus1024
Re: Headless sdcard shutdown power off
if you connect to your RPi with SSH, you could give a shutdown command from there.
most operating systems will write back the info and data they have in cache.
most operating systems will write back the info and data they have in cache.
headless RPi 3B running from usbhdd.
- Z80 Refugee
- Posts: 358
- Joined: Sun Feb 09, 2014 1:53 pm
Re: Headless sdcard shutdown power off
Presumably you meant the opposite.
Military and Automotive Electronics Design Engineer (retired)
For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!
For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!
-
- Posts: 2787
- Joined: Tue Jan 19, 2016 2:17 pm
- Location: Sydney, Nova Scotia, Canada
Re: Headless sdcard shutdown power off
I have several Pi's I run headless. I have a button wired to a GPIO pin to do the shutdown via a python script. Then I just wait for the act LED to stop blinking and kill the power.
Re: Headless sdcard shutdown power off
Thank you everyone .
PiCore appears to be 'the bees knees'. I had not heard of this before. Presumably it will run 'feh' and I can mount a USB with the data on it. Thank you.
I wonder - if one reads data from a USB flashdrive and powers it off without unmounting - could that damage it? It may be that reading data from a usb involves rewriting it?
PiCore appears to be 'the bees knees'. I had not heard of this before. Presumably it will run 'feh' and I can mount a USB with the data on it. Thank you.
I wonder - if one reads data from a USB flashdrive and powers it off without unmounting - could that damage it? It may be that reading data from a usb involves rewriting it?
- Z80 Refugee
- Posts: 358
- Joined: Sun Feb 09, 2014 1:53 pm
Re: Headless sdcard shutdown power off
The risk is that a write operation (rather than a read operation) is not completed if you just unplug it hot without unmounting first. If doing a controlled shut-down, unmounting is not necessary.
Military and Automotive Electronics Design Engineer (retired)
For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!
For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!
-
- Posts: 633
- Joined: Sat Feb 24, 2018 4:09 am
- Location: Buffalo, NY, USA
Re: Headless sdcard shutdown power off
If 'when we switch off power at night' is a predictable time, you can always create a cron job to shut down the Pi shortly before you turn the power off.
Re: Headless sdcard shutdown power off
cron - good idea - thanks.
It used to be that a memory read erases the information , then it writes it back. Dont know if this is still the case.
It used to be that a memory read erases the information , then it writes it back. Dont know if this is still the case.
Re: Headless sdcard shutdown power off
PiCore (tiny core linux) is a very smart OS indeed. It uses ramfs and squashfs, making it quite robust and stateless. It works about like this:
1 - Kernel is found on boot medium, loaded along with a skeleton root file system in RAM,
2 - User area of boot medium is mounted read-only,
3 - User-defined packages, e.g. feh.tcz (I don't know if the package exists) are read and expanded into loop devices in RAM
4 - Loop devices are mounted over the root filesystem to populate it.
You can save to the loop device, but unless you commit the loop device to the package on the boot medium (with filetool.sh), your changes are lost upon reboot. It's a bit like containers before containers were invented.
With a system like that, it is quite unlikely/unlucky to actually kill an SD or corrupt the filesystem when cutting power to a Pi.
You can make the system almost bulletproof (except during boot, saves) by using option "copy2fs". With copy2fs, step 2 becomes:
2a - User area of boot medium is mounted read-only, copied to RAM
2b - Boot medium is unmounted
1 - Kernel is found on boot medium, loaded along with a skeleton root file system in RAM,
2 - User area of boot medium is mounted read-only,
3 - User-defined packages, e.g. feh.tcz (I don't know if the package exists) are read and expanded into loop devices in RAM
4 - Loop devices are mounted over the root filesystem to populate it.
You can save to the loop device, but unless you commit the loop device to the package on the boot medium (with filetool.sh), your changes are lost upon reboot. It's a bit like containers before containers were invented.
With a system like that, it is quite unlikely/unlucky to actually kill an SD or corrupt the filesystem when cutting power to a Pi.
You can make the system almost bulletproof (except during boot, saves) by using option "copy2fs". With copy2fs, step 2 becomes:
2a - User area of boot medium is mounted read-only, copied to RAM
2b - Boot medium is unmounted
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel
Re: Headless sdcard shutdown power off
Thank you very much - this is new to me (especially Loop devices - just looked up in wikepedia). What imagine I want to do is somehow define a directory in ram (gparted ?) , copy a few .jpg files from usb into this directory and point feh to this directory.
Need to skill myself up in linux - I wrote my first script in 1968 and strill know nothing !
angus1024
Need to skill myself up in linux - I wrote my first script in 1968 and strill know nothing !
angus1024
- thagrol
- Posts: 4034
- Joined: Fri Jan 13, 2012 4:41 pm
- Location: Darkest Somerset, UK
- Contact: Website
Re: Headless sdcard shutdown power off
IF you have nothing that writes to the SD card, this might be worth a look: https://learn.adafruit.com/read-only-raspberry-pi
Arguing with strangers on the internet since 1993.
Re: Headless sdcard shutdown power off
Should be simpler than that.
- Download and burn piCore 9.0.3 to an SD
- Setup the Pi with a local console, boot
- Follow the directions in the Readme file and start browsing the tinycore forum. There are some TCL/piCore users here too, I think.
It looks like feh got the boot by piCore 8.x, I spotted a thread where the response was "install ImageMagick instead".
In general it is not difficult to create a custom package (.tcz) if you need to. You can install gcc and all other utils required to compile from source,
and existing tcz packages can be opened/created with unsquashfs/mksquashfs.
Once you have your application ready to work, what I would probably do it simply copy the image files to the home directory of user "tc" (default user under piCore). Then a swift call to filetool.sh should backup the files to archive.tgz. Archive.tgz is always auto-expanded at boot to populate tc's homedir.
I would put there any script necessary to control the display program, too. Then you'd need to add a call to your script in /opt/bootlocal.sh, and the program would start at boot.
Overall piCore is a bit strange at start, but its simplicity is refreshing.
HTH
- Download and burn piCore 9.0.3 to an SD
- Setup the Pi with a local console, boot
- Follow the directions in the Readme file and start browsing the tinycore forum. There are some TCL/piCore users here too, I think.
It looks like feh got the boot by piCore 8.x, I spotted a thread where the response was "install ImageMagick instead".
In general it is not difficult to create a custom package (.tcz) if you need to. You can install gcc and all other utils required to compile from source,
and existing tcz packages can be opened/created with unsquashfs/mksquashfs.
Once you have your application ready to work, what I would probably do it simply copy the image files to the home directory of user "tc" (default user under piCore). Then a swift call to filetool.sh should backup the files to archive.tgz. Archive.tgz is always auto-expanded at boot to populate tc's homedir.
I would put there any script necessary to control the display program, too. Then you'd need to add a call to your script in /opt/bootlocal.sh, and the program would start at boot.
Overall piCore is a bit strange at start, but its simplicity is refreshing.
HTH
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel
Re: Headless sdcard shutdown power off
Thanks. It will be a few days before I attempt this.
I need be able to easily change the content (set of slideshow .jpg ) so it be reading a USB flashdrive - perhaps at each powerOn.
I need be able to easily change the content (set of slideshow .jpg ) so it be reading a USB flashdrive - perhaps at each powerOn.