Web Based Backup Fails

I’m trying to backup my local emoncms, I’ve tried web based and get:

So I then tried SSH as per Paul B on the forum with
pi@emonpi(rw):backup$ ./emoncms-export.sh
I get:

pi@emonpi(rw):backup$ ./emoncms-export.sh
=== Emoncms export start ===
Thu 20 Dec 07:12:23 UTC 2018
Backup module version:
    "version"      : "1.1.4"
EUID: 1000
Reading /home/pi/backup/config.cfg....
Location of mysql database: /home/pi/data
Location of emonhub.conf: /home/pi/data
Location of emoncms.conf: /home/pi/data
Location of Emoncms: /var/www/emoncms
Backup destination: /home/pi/data
Image version: emonSD-26Oct17
./emoncms-export.sh: line 74: /home/pi/data/emoncms.sql: Permission denied
Error: failed to export mysql data
emoncms export failed

Nevertheless, the SSH backup works when using
pi@emonpi(rw):backup$ sudo ./emoncms-export.sh
any help appreciated on trying fix web based emoncms backup.

Hi @andrewhf01

Try updating to the latest version of the backup module, I see your running 1.1.4. The latest version is 1.1.6. It should update if you run emonPi update (Setup > Admin > emonPi update) in local Emoncms

The issue seems to be that the database dump file /home/pi/data/emoncms.sql has got root permissions. This could have been caused by the backup module being run as root in the past.

You could try to delete the database dump file then run the web export again:

sudo rm -rf /home/pi/data/emoncms.sq

Hi Glyn,
I ran the

emonPi update (Setup > Admin > emonPi update) in local Emoncms

just last month but this appears not to have updated, when was the backup module upgraded to 1.1.6?

Andrew

Apologies, I just realised that V1.1.6 had not yet been released to the stable branch. It’s been done now :+1:

Hi Glyn,
just got round to updating the emonpi and the backup etc. now running backup 2.0 and still will not backup using web based backup. Nevertheless, I managed to manually backup to pi/data/emoncms-backup-2019-06-03.tar.gz, I’ve tried SSH using:

sudo scp [email protected]: ~/data/emoncms-backup-2019-06-03.tar.gz /Volumes/User_Data/andrewfindlow/Desktop

but I’m struggling trying to copy tar files any ideas how I can transfer this file?
Just need to get this file on to my desktop computer so that I can do fresh install of emonpi and upload all the inputs and feeds etc.
Any help would be most appreciated.

WinSCP is a good tool.

I use a Mac OSX

What error do you get?

@Jon Can you help?

Are you running this command in the SSH session connected to the Pi, or a local terminal window? i.e. are you trying to pull the file or push it?

In a terminal on the local machine use sftp so

sftp [email protected]

Then type help (commands like pwd, cd, etc are the same). Use get to get the file.

Hi @andrewhf01
I run MacOS and use CyberDuck to transfer files to and from my emonPi. It is easy to use!
https://cyberduck.io/download/

There are many other SFTP transfer applications.

@borpin looks like he has the right idea. I’ll give that a try later today.

1 Like

I think the issue is an extra space before the tilde “~”.

The command to transfer from an emonPi to a Mac is done via your local computer (your Mac).

The first password is your Mac login. The second password is for the emonPi.

Open Terminal on your Mac and enter:

sudo scp [email protected]:/home/pi/data/emoncms-backup-2018-02-07.tar.gz /Users/jon/Desktop

Password: (this is your Mac user password)
[email protected]'s password:  (this is your emonpi password)

emoncms-backup-2018-02-07.tar.gz              100%  135MB   7.4MB/s   00:18    

Hope this helps!
Jon

2 Likes

Hi Jon,
Thanks for the info, I’ll try CyberDuck to transfer files at some point in the very near future.

At present I’m imaging the old SD card before I do anything else then I’m going to try accessing the drive with these backup files directly (I have Paragon extFS) then I can try uploading my old Emoncms data to the new installed emonpi, which I’m having issues with connecting via wifi as per WiFi connection issues

So, I’m using the wired ethernet connection and will try and fix each of the issues and glitches throughout this upgrade to get it functioning the same, prior to the system crash at the beginning of last month that necessitated the the overhaul.
Not played with this kit for some while therefore, need to refamiliarise myself and improve my knowledge as well.
Many thanks
Andrew

Hi Jon,
Long story, short, it’s all hopefully sorted now.
Still had problems with web based backup (import and export) however, I managed to get CyberDuck working and downloaded last backup but tar.gz file was corrupt so managed to make one from all the files that supposed to be backed up manually using CLI

tar -zcvf test3.tar.gz ./

test3 being the filename. Transferred the file to

pi@emonpi:~/data/uploads

then

pi@emonpi:~/backup $ ./emoncms-import.sh

was then pleased to see:

=== Emoncms import complete! ===

Sorted my WIFI issues by editing

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

to

network={
ssid=“yourSSID”
scan_ssid=1
psk=“Your_wifi_password”
}

which allowed me to connect to my WIFI network and I could then see setting in web based EmonCMS WIFI tab.

Tried to get to edit src.ino file to set emonpi voltage calibration then import the firmware via platformio (which I have done successfully in the past) using the firmware from

This git page only shows emonpi firmware version 2.9.0, which did not work i.e. a the inputs and feeds on all the other nodes stopped working. That used in the EmonCMS web based firmware update is the most up to date 2.9.1 version; using this version and update method got the inputs and feeds all back to normal etc. Is there anyway that git version for clone/download can be updated to 2.9.1?

Therefore, I used the work-around suggest by Robert in

EmonPi - accuracy of new install - calibration required?

Now for the adjustment: you can edit emonhub.conf in your web browser. You’re looking for this section:

[[5]]
    nodename = emonpi
    [[[rx]]]
        names = power1,power2,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulsecount
        datacodes = h, h, h, h, h, h, h, h, h, h, L
        scales = 1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1,1
        units = W,W,W,V,C,C,C,C,C,C,p

Change the 4th item in scales = ... so that the emonPi shows the correct voltage according to your meter. So “0.01” might end up as “0.0105”, etc

and incidentally 0.01049 was the value for my emonpi.

All is good so far.
Many thanks for all the help.

1 Like