I made a digital frame with my photos which run on Libre Office. I'm faced with the following issue:

If someone accidentally pulls out the Raspberry Pi the LibreOffice can not use the file anymore. I tried to find solution here like block the SD card switch or set the ReadOnly settings, but as I've read I can not use it in a GUI environment.

How can I prevent the files being corrupted?

Update 1

It is stuck like this: LibreOffice Splash Logo

If I reset Ctrl+Alt+F1 and startx and open start LibreOffice and I am able to open the file without any complication. Its seems the file is not corrupted just the Libreoffice can't autorun.

I added this line to Profile:

sudo libreoffice -show photos.odp

The file is exist

Update 2

Using command sudo libreoffice -norestore -show photos.odp solves the stuck issue, but the photo slide doesn't load. Only the graph operating system loads.

Aborting with Ctrl+Alt+F1 I can read the following: failed to open display. It is unclear because I've added to the profile which must run after GUI is loading.

Update 3

It seems I was able solve the issue.

Instead of the profile I've added my command to:

sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
sudo libreoffice --show Slideshow.odp

When I added this to the profile its works, until the first power loss. After that, I got the error Failed to open display that's because the GUI has not started yet.

  • To save you wasting time: You can edit in as much information as you want here, there is no way to safe-guard 100% against corruption (other than a read-only fs) on any computer using any operating system. You might as well say, "I want to be able to yank the cord on my desktop any time and make sure everything is okay" -> No deal, if you do it enough times you will have a problem eventually. The Pi may be more susceptible to this (I'd guess the slow write speed of the SD controller is too blame) but that's life; $35 is $35. – goldilocks Jan 28 '17 at 17:32

I think it should be possible to run the GUI off a read-only root if you put critical locations like /var in RAM (using tmpfs), or rebuild the kernel to support FS overlays. However, I never bothered to try this, since I can't remember when was the last time I had an SD corruption. What I would do:

  • enable journalling with tune2fs -o journal_data /dev/mmcblk0p1, so that corrupted files are recovered from the journal at boot
  • make the presentation file read-only, so that LibreOffice doesn't even try to modify it

It won't be a 100% guarantee against corruption, but it may be good enough for a practical solution.

  • thank you for your help.I made the file readonly mode but it still has the problem.Its seems the LibreOffice stack while its try to load the odb file.Reseting with startx and run LibreOffice open the file without any problem.I have no idea what can be wrong now – Andrewboy Jan 13 '17 at 22:00
  • I don't quite understand what is the exact behaviour you see. Could you amend your question with details on how to reproduce the issue and what it is exactly, including eventual error messages? Something like (1) boot RPi, LibreOffice starts the slide show automatically, (2) unplug power, (3) plug power back on (4) RPi starts successfully? LibreOffice starts automatically? LibreOffice complains about the file being corrupt? (5) After manual logout and login, Libre office opens the file successfully? – Dmitry Grigoryev Jan 14 '17 at 16:04

No computer can guarantee file integrity on power loss. Most computers won't let you power off unsafely, but are still vulnerable to loss of power.

The only solution is a UPS of some sort.

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.