Missing file operations during power recycle

Started by Navaneeth, June 21, 2024, 01:08:16 PM

Previous topic - Next topic

Navaneeth

Hello,
we are using A10, with bullseye image, latest version. Encountering strange phenomenon..
Problem statement: File modifications by applications are not getting stored, when there is a power recycle.
OS details:
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/

Static hostname: 3333
         Icon name: computer
        Machine ID: 57316ac0e5304ad2bee68886b639d895
           Boot ID: 2ad339e77f3d4f8880641e87152c1925
  Operating System: Debian GNU/Linux 11 (bullseye)
            Kernel: Linux 5.10.105-olimex
      Architecture: arm

Explanation:
We have a PHP application running on top of Apache server. System has few xml configuration files, which can be edited in the PHP webpages.  When we edit the configurations, it gets stored in to the file, we can externally check the same. However after power off and on, the file modifications are gone, and old data is restored.
Case 1: when we reboot the Linux, file modifications are retained
Case 2: when we halt the Linux, and power recycle, then the file modifications are stored.
Case 3: when we do manually "sync" command in the command line before power recycle, then the file modifications are stored..
Case 4: After the file modifications, leave the system for few mins, and power recycle, file modifications disappear.
Case 5: when we create some files using nano and edit it, it gets retained.
Up on checking out further, came across there 2 settings
cat /proc/sys/vm/dirty_writeback_centisecs
cat /proc/sys/vm/dirty_expire_centisecs
both of them set to default values of 5 sec and 30 secs.
But these settings are not working. OS doesn't update the file modifications to the SD card.
Basic file operations doesn't get retained, when we do power recycle.
Is here any way out?.
How we can ensure that write back settings are working?.
Is there any size settings also?.


Thanks & Regards
Navaneeth
 

LubOlimex

The easiest workaround until you figure out this issue is to apply the changes everytime upon boot up. Create a cronjob to apply the needed modifications on each boot.
Technical support and documentation manager at Olimex

Navaneeth

"apply the changes everytime upon boot up"
could you explain this more.
This was not the issue in older operating system.. when we move to bullseye we started facing all these problems..

LubOlimex

You store the changes you want in a cronjob that would be executed on power up.

By the way, what do you mean by power down? Does this mean remove all power supply suddenly?
Technical support and documentation manager at Olimex

Navaneeth

Power recylce => Power down and then power on.
Yes removing the power suddenly.

dirty_writeback_centisecs
dirty_expire_centisecs

these two settings are ment to update the file system of different changes happend.
It doesn't work in the bullseye version. It doesn't work in A10 & A20.
It is OS releated issue.. Need to be addressed.

LubOlimex

It is not good idea to power down these boards suddenly without extra measures taken for the Linux. That might lead to file system corruption. There was an old article here:

https://www.embeddedts.com/assets/preventing-filesystem-corruption-in-embedded-linux

It is best idea to always have Li-Po battery and perform a software shutdown when main power supply goes missing or Li-Po gets discharged enough.
Technical support and documentation manager at Olimex

Navaneeth

Yes I understand your point.

Have two questions.
1) dirty_writeback_centisecs, dirty_expire_centisecs why these settings are not working?.

2) how much time it will take for typical shutdown?. Is there any pin which can trigger automatic shutdown?.