Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Error clearing script

Mon Feb 20, 2017 4:12 pm

Hi all. I received some amazing help here setting up my pi to auto open and loop a libre impress presentation.

This will be used by staff who don't know anything about IT at all. With this in mind i'm looking to make it as user friendly as possible.

If the power goes out the Pi won't loop the presentation automatically as it says it needs to be recovered. Seems to me there is a 'last session' clashing with the script to open and play the presentation.

Is there a simple script I can add or do I need to do anything to the script I have? I followed another (very very helpful) users instructions

The thread was called...
Auto start presentation (sorry I do think know how to link threads)

To be honest I am a total noob and don't want to frustrate the more advanced users.

Thanks again. This place is awesome

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Error clearing script

Tue Feb 21, 2017 1:09 am

i have no idea how to deal with that from the IMPRESS side,
possibly
sudo nano /usr/bin/soffice

Code: Select all

# file locking now enabled by default
SAL_ENABLE_FILE_LOCKING=1
export SAL_ENABLE_FILE_LOCKING
set to 0???

but first try to make the file read only

for the *lock* files i have 2 ideas:
-1- try to delete the files prior to start impress
rm /path/*lock*
-2- change the start script to
cp /path/file /run/shm/file
... impress --show /run/shm/file

this -2- uses a nice trick
/run/shm/ is the user RAM disk
it is always empty at start, at stop all is lost.
so if you copy your presentation to that RAM disk and execute it from there i think,
if impress generates *lock* files there at reboot they are gone.
( this temporary ram disk is limited to 400MB ? how big is your presentation? )

alphanumeric
Posts: 2547
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Error clearing script

Tue Feb 21, 2017 11:05 am

When your posting, there should be a row of buttons across the top of the box your typing your reply in. That's what you use to add links or post code. Click the URL button to get two URL tags, then past your link between them. The Code button will let you post Python code etc and keep its formatting. Just past your code between the two tags. [tag] past here [/tag]
Sorry can't help with the other issue.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Error clearing script

Wed Feb 22, 2017 3:22 pm

The bellow is the original post.

[url]viewtopic.php?f=91&t=173163/[url]

I am not sure where to start. I can't seen to locate the bin file KLL mentioned. To be clear this will be my failing as KLL sorted me out last time and gets full credit.


If there is more detailed error details needed, just let me know where to find them.

This isn't essential either as this error only pops up when the Pi isn't powered off properly or there is a power cut. But as it's one error and it's theasy only one I wondered if it was possible?

This is to make sure i'm not called in on a day off because some one doesn't know how to plug in a USB mouse.
Last edited by Kingcanon002 on Fri Feb 24, 2017 2:24 pm, edited 1 time in total.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Error clearing script

Thu Feb 23, 2017 2:31 pm

Ok so yet again my typing ability has lead me to goof up.

I found where KLL mentions and have tried to change the value to 0

I get the message

"file to insert [from ./]:"

Any idea what next? Am I keying in my presentations location?
Last edited by Kingcanon002 on Fri Feb 24, 2017 2:16 pm, edited 1 time in total.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Error clearing script

Thu Feb 23, 2017 4:27 pm

Kingcanon002 wrote:tried to change the value to 0
I get the message "file to insert [from ./]:"
ahm..got that message from what program at doing what?

i mentioned 4 possible things what could be done
-1- disable locking by
sudo nano /usr/bin/soffice and change
SAL_ENABLE_FILE_LOCKING=1
to
SAL_ENABLE_FILE_LOCKING=0

-2- write protect your presentation
chmod -w mypresentation.odp

-3- delete existing *lock* files
-4- copy and start from /run/shm RAM disk

so my
nano presentation.sh

Code: Select all

#!/bin/bash
echo '30s'
env sleep 10s
echo '20s'
env sleep 10s
echo '10s'
env sleep 10s

#sudo rm /home/pi/Documents/*lock*
#/usr/bin/libreoffice --show /home/pi/Documents/mypresentation.odp
cp /home/pi/Documents/mypresentation.odp /run/shm/mypresentation.odp
sudo rm /run/shm/*lock*
/usr/bin/libreoffice --show /run/shm/mypresentation.odp
works, but that is no proof about solving your power fail problem.
Last edited by KLL on Fri Feb 24, 2017 9:45 pm, edited 1 time in total.

Kingcanon002
Posts: 12
Joined: Tue Jan 31, 2017 3:56 pm

Re: Error clearing script

Fri Feb 24, 2017 2:53 pm

i mentioned 4 possible things what could be done
-1- disable locking by
sudo nano /usr/bin/soffice and change
SAL_ENABLE_FILE_LOCKING=1
to
SAL_ENABLE_FILE_LOCKING=0
When I try thr above I get the "file to insert [from ./]:" error.

I've tried the number 4th option and it auto plays the presentation but doesn't clear the error if it's powered off incorrectly.

I don't know how to prevent the file locking or requiring recovery in the event of power loss.

Ernst
Posts: 1334
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Error clearing script

Fri Feb 24, 2017 3:12 pm

Kingcanon002 wrote: When I try thr above I get the "file to insert [from ./]:" error.
One step at a time. Do you get this error when you use nano to edit the file ?
If the answer is yes then you have problem with entering commands in nano because ctrl-r / F5 are used to insert information from another file into the file you are editing. I suggest you start nano from the command line and then press ctrl-g to bring up the help screen.

In the meanwhile, the following command to be entered on the console should be able to do the change:

Code: Select all

sudo sed -i 's/SAL_ENABLE_FILE_LOCKING=1/SAL_ENABLE_FILE_LOCKING=0/' /usr/bin/soffice
The road to insanity is paved with static ip addresses

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Error clearing script

Fri Feb 24, 2017 10:15 pm

so you see, even i use usually nano i did not understand that you might have used [ctrl][r] why?
anyhow, if you use only desktop .. you might need some tips:

use the file manager with the option
/view/show hidden/
so you can find subdirs or files like
/home/pi/.config/autostart

if you find the target subdirectory you can open terminal for that by
/tools/open current folder in terminal/


any time i use "nano" from terminal you can use leafpad editor by
[start][accessories][text editor]
or filemanager, point at file [right mouse click]/text editor/

unless i say
"sudo nano"
then you should open a terminal and use
"sudo leafpad"

_______________________________________
for my
-2- write protect your presentation
chmod -w mypresentation.odp

make sure first that the file is good / recovered!!
_______________________________________

Return to “Beginners”