element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Issue with power off
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 5 replies
  • Subscribers 662 subscribers
  • Views 962 views
  • Users 0 members are here
  • raspberry_pi
Related

Issue with power off

didierb
didierb over 6 years ago

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 ?

  • Sign in to reply
  • Cancel
  • shabaz
    0 shabaz over 6 years ago

    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.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • didierb
    0 didierb over 6 years ago in reply to shabaz

    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...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 6 years ago in reply to didierb

    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

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • didierb
    0 didierb over 6 years ago in reply to shabaz

    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 image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 6 years ago in reply to didierb

    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.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube