5 Replies Latest reply on Jun 5, 2019 1:59 PM by shabaz

    Issue with power off

    didierb

      It appears that, when activating the power-off function (long push on on/off button) when an Ap is still running, this Ap doesn't have enough time to save its configuration file before the power is cut off, and all config is lost (conf file length = zero)...

      Distribution : open plotter,

      Application : OpenCPN

      Any suggestion, other than warning user not to do that ?

        • Re: Issue with power off
          shabaz

          Hi Didier,

           

          I guess you're talking about the 'Pi Desktop' product?

          I don't have one so can't be sure how long it allows the process to shut down. Even if the button and the script that is running on the Pi is doing the correct thing, some applications won't behave correctly and shut-down in a safe manner. Most applications that people write, are not packaged with full (decent) appliance behaviour. If they are, then they will either install as a service, or will have a separate process to manage startup/shutdown and associated scripts perhaps. You could explore using systemd, which is a Linux capability to try and manage processes startup/shutdown, but as mentioned the application you're referring to may not even recognise the correct signal and save the config accordingly. That may need software application changes (feasible, since it is open source, but would require delving into the code). It may need to be a request to the developers, to either have an installation with the correct startup/shutdown scripts, and/or to have the code modified to have an option to auto-save the config whenever changes are made (note- I'm not familiar with the application software, perhaps there are reasons not to do this). In summary, it's not really a Pi Desktop issue, but an application issue - it needs some investigating how the application (in its code) handles shutdown.

          3 of 3 people found this helpful
            • Re: Issue with power off
              didierb

              Hi Shabaz,

               

              You  are right, I was talking about the 'Pi Desktop' product !

              The application which causes the issue is OpenCPN 5.0 (and former versions ..). The developpers claim they close clearly and it is a Linux issue, but due to latency to write on the SSD the config file is not properly saved when the Pi is powered down. The issue happens randomly, 1 time out of 10~20. The solution could be a time-out before the power down take place, in the Pi Desktop software, I guess a few seconds would make the difference !

              Not a developer myself I am ready to test an alpha or beta version to help validating the concept and the chosen time-out !

              I have built a (dirty) walk around, with 2 bash scripts to save the conf file (when all is OK) and restore it when it gets faulty, but it is less than elegant, and I think a time out would more cleanly address the issue...

                • Re: Issue with power off
                  shabaz

                  Hi Didier,

                   

                  I think that's what I would have done too, just write some scripts to restore a config, unless you're really keen to go into the code to find a way to auto-save whenever there has been a modification.

                  The problem is, the Pi doesn't have a lot of documentation or guidelines for appliance use, and probably untested in Raspbian releases too - I just tried writing a systemd service to see if I could help you, but it didn't work - I suspect some issue with systemd in the Raspbian I'm using. There's some information here but it didn't function for me (I'm using Jessie manually upgraded to Stretch): https://www.raspberrypi.org/forums/viewtopic.php?t=149425

                    • Re: Issue with power off
                      didierb

                      I would definitely prefer than PiDesktop doesn't switch the power off before the apps have finished cleanly their saving process !

                      I had written  a walk around script to restore the config, allowing to use the application, but what is lost at each premature power-off will never be recovered ...

                      To me, its not clear where is the bug (in Linux Stretch or in Pi desktop), but this impacts badly the usability of Pi Desktop for any critical application !

                      I imagined this major drawback for the product could easily be cured with a 5 s. time-out in PiDesktop software !

                      So sad

                        • Re: Issue with power off
                          shabaz

                          Hi Didier,

                           

                          I'm fairly sure it is a Raspbian issue, but simply Raspbian as supplied isn't ready for appliance use without the appliance-creator doing additional work to verify the Raspbian image is not buggy in this area, and also depends on the application behaviour, and correct use of systemd.

                          Any of these things not being in place (i.e. a bug in systemd, or application not using signals correctly, or systemd not used or not used correctly), will cause the problem described.

                          A desktop user can click to shutdown apps and the Pi. Apps such as word processing, or spreadsheets, or games. You're using it in a different way where you require the button to allow saving to occur, but that needs the things above to be in place.

                          I'm fairly sure the Pi Desktop is an education/consumer item for people (kids/adults) learning about computing, and no-one has tested your scenario.