WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: piCore : lost connection and home content!  (Read 2633 times)

Offline lahorde

  • Newbie
  • *
  • Posts: 5
piCore : lost connection and home content!
« on: February 08, 2016, 07:38:37 AM »
Hi,

I'm using piCore player with an Amp+. Sometimes after startup, it does not reconnect to wifi and previously saved home folder content misses. In this case I restore a previously backed up image to my SD, but it's not convenient ;-)

In all cases, I'm using :

Code: [Select]
filetool.sh -b
to backup my changes. I do not always reboot properly raspberry : often, it is rebooted unplugging DC switch, but in all cases, unplug is done when backup is terminated.

First I thought it was an SD Card corruption problem. So I replaced SD, but I got same issue with new one.
So, I'm wondering what could cause this issue?
 * is there some automatic backup done by piCore system?
 * is it possible a backup is done during startup whereas some files have not been restored?
 * is filetool safe? ie when it displays done, can I safety unplug Power without any issues?

Another question, I need to llaunch a binary asap during boot sequence. I've used bootlocal.sh but it starts my process too late. I think I need to add an init service. Am I right?

lah

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1107
Re: piCore : lost connection and home content!
« Reply #1 on: February 08, 2016, 10:40:58 AM »
Are you running piCore 7.0, or are you running sbp's piCorePlayer?

There is no automated backup process in piCore, and I've never seen an issue using filetool.sh.   I don't have my rPi here at work, but I'm reasonably sure that the last thing that filetool.sh does is sync the filesystems.    The majority of SD Card corruption comes from using poor power supplies.   

As for your startup issue.   /opt/bootsync.sh is the earliest in the boot process that you can run a custom binary.    If you need to run something sooner, then you are more than likely looking at remastering the initrd.    But please give us more information as to what you are trying to do.

Offline lahorde

  • Newbie
  • *
  • Posts: 5
Re: piCore : lost connection and home content!
« Reply #2 on: February 08, 2016, 11:23:28 AM »
Hi Paul,

I'm using piCore 7.0 alpha 3. In filetool.sh script sync is called. Power supply to rpi is provided from Amp+ thanks to a MeanWell 18V transformer.
Today I got described issue twice whereas I always restarted/halted raspberry gracefully.
Last time I got this issue, after halting raspberry, I observed WIPI dongle was still lighted but I was unable to ssh on Raspberry, moreover ACT led was not active. This time, I have no wifi, squeezelite is not launched, but my home folder is present.

For startup issue, I'm just trying to blink a LED asap, and now, it only blinks after ~15s.
 
« Last Edit: February 08, 2016, 11:36:03 AM by lahorde »

Offline lahorde

  • Newbie
  • *
  • Posts: 5
Re: piCore : lost connection and home content!
« Reply #3 on: February 09, 2016, 03:12:02 AM »
After checking filesystem last time I got issue about Connection lost and home content lost, I checked home content, some files still here, but important file like /home/tc/www/cgi-bin/do_rebootstuff.sh disappeared.

Offline lahorde

  • Newbie
  • *
  • Posts: 5
Re: piCore : lost connection and home content!
« Reply #4 on: February 17, 2016, 01:12:33 AM »
After deeper investigations I think I found a solution to my issues.

* To launch a process during startup, I first used bootlocal.sh that is launched in background by bootsync.sh . After I launched my process in background from bootsync.sh in order to run it sooner.

* For issue about lost connection and home content, I've found some explanations in do_rebootstuff.sh called during startup by bootlocal.sh . In all cases, a backup of user persistent data is done L421:

In do_rebootstuff.sh L421:
Code: [Select]
# Save the parameters to the config file
echo -n "${BLUE}Updating configuration... ${NORMAL}"
pcp_backup_nohtml >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"

In pcp-functions L1182

Code: [Select]
pcp_backup_nohtml() {
# Delete any previous backup_done file
[ -e /tmp/backup_done ] && sudo rm -f /tmp/backup_done

# Do a backup - filetool.sh backs up files in .filetool.lst
echo -n "[ INFO ] "
sudo filetool.sh -b
sync

# If backup_status file exists and is non-zero in size then an error has occurred
if [ -s /tmp/backup_status ]; then
echo '[ ERROR ] Backup status.'
cat /tmp/backup_status
fi

# If backup_done exists then the backup was successful
if [ -f /tmp/backup_done ]; then
echo '[ OK ] Backup successful.'
else
echo '[ ERROR ] Backup failed.'
fi
}

No flag indicating some parameters have been updated is checked before doing this backup.

But you do not have do_rebootstuff.sh logs you have no idea of precise timing of this backup, e.g. if wifi connection can't be established, backup will be done after several wifi connections are attempted.  I preferred commenting out line backuping persistent data and backup it manually when needed.
Moreover, with an home folder of some megas filetool.sh takes lot of time compressing it and writing it to sd, so if you do not have access to do_rebootstuff.sh log you can halt your raspberry when it is still backuping your data. Using tee command in order to write  do_rebootstuff.sh logs to stdout and a file in /var/log/do_reboot.log, and checking no tar process is ongoing is useful when rebooting / halting.
Now with these changes, I do not lost some data anymore.
For me, as user do not knwow precisely when this backup is done, it should be done in safe backup mode in pcp_backup_nohtml function. Additionally, when restoring backup fails it could restore saved backup done in safe mode.

lah
 

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: piCore : lost connection and home content!
« Reply #5 on: February 17, 2016, 02:29:46 AM »
Hi lahorde,

Thanks for your feedback. I think you might have a unique setup, otherwise we would have had lots of problems in the last few years.

How big is your mydata.tcz?

What class is your SD card?

How many attempts does it take wifi to connect?

regards
Greg

Offline lahorde

  • Newbie
  • *
  • Posts: 5
Re: piCore : lost connection and home content!
« Reply #6 on: February 17, 2016, 04:27:16 AM »
Hi Greg,

mydata.tcs is 3.2MB
uncompressed home is 8.5MB
SDcard is sandisk class 10
=> restoration takes ~5s
      backup takes       ~ 1min10s (with no additional process started in bootsync.sh or bootlocal.sh)
Raspberry is pi b+ with picore 2.
Sometimes wifi does 1 attempt to reconnect.

lah

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: piCore : lost connection and home content!
« Reply #7 on: February 17, 2016, 04:48:41 AM »
Hi Greg,

mydata.tcs is 3.2MB
uncompressed home is 8.5MB
SDcard is sandisk class 10
=> restoration takes ~5s
      backup takes       ~ 1min10s (with no additional process started in bootsync.sh or bootlocal.sh)
Raspberry is pi b+ with picore 2.
Sometimes wifi does 1 attempt to reconnect.

lah

Hi lahorde,

On the standard piCorePlayer it takes a couple of seconds to do a backup. Even the standard 135kb mydata.tcz is too big, and we will reduce it in future.

You need to rationalize what you are including in the backup to mydata.tgz. (sorry I said mydata.tcz before)

My understanding is the filetool.sh -b mechanism is really only intended to backup configuration files.

regards
Greg