Community
OpenEnergyMonitor

Community

Ver 10.1.2 Backup Import Missing

I was running ver 9.?.? and, via th web interface dropdown Backup, I exported my data.
I then did an update which installed ver 10.1.2
But I can find nothing on the new web interface that now allows me to import what I had previously exported.
In the Guidance section there is reference to running a script emoncms-iimport.sh but I cannot find this file.

Help please

This is all the more strange …
I have another instance of an emoncms/RPi running on the site which I upgraded from ver 9.?.? to 10.1.2 a few days ago.
No problem there - the Backup module is available on its web interface and emoncms-import.sh is available in its directory /home/pi/backup.

I suspect the problem maybe related to this in the emonpiupdate log:

 modified:   stretch/rc.local

no changes added to commit (use "git add" and/or "git commit -a")
error: Your local changes to the following files would be overwritten by merge:
	stretch/rc.local
Please commit your changes or stash them before you merge.
Aborting

I needed to modify rc.local when running ver 9.?.? because of then well known/much discussed log problems (on this Forum)

This mod is no longer required.
So how to revert to a ‘kosher’/official rc.local that does not throw an error when updating to ver 10.1.2?

Any suggestions?

From the command line in the emoncms folder, do a (you might not need sudo)

sudo git reset --hard

Then

sudo git fetch --all --prune -v
sudo git pull

The fetch is belt and braces.

Then run an update.

@borpin
There’s a directory /home/pi/data/mysql/emoncms but when I try to cd to it I get Permission denied.

There’s a directory /home/pi/emonhub so I tried yr suggested commands in that directory and finally ended up with the message … Already up to date

I want the 10.1.2 update to overwrite the previous rc.local.
The update log says it will not do this
My question is how to force it to overwrite rc.local?

Thx

Please commit your changes or stash them before you merge.

Wouldn’t stashing the changes, then updating let the update process overwrite the old rc.local file?
I’m not well-versed in Git, so may be way off-track here…

Sorry I though you were more familiar with the structure

cd /var/www/emoncms

Yes but it shouldn’t be necessary now and it would mean you’d ned to do it every time. If you wanted to, the commands would be git stash before the update and git stash pop afterwards. That can though cause issues and generally I tend to put folk back to a vanilla git repo so there are no further issues.

@borpin
I’ve tried the Git commands you’ve suggested in /var/www/emoncms but it did not solve the problem.
Update to 10.1.2 is still refusing to overwrite stretch/rc.local and Server information shows emonhub as failed.

Should I cd to /home/pi/emonpi/stretch directory and try your suggested Git commands there?

I really am clutching at straws.

Can you post the whole log please.

You are on the right path, it is the emonpi repo not emoncms that maintains the rc.local file. You could cd to the /home/pi/emonpi/ folder and run Brian’s commands from there.

Alternatively you can specify the working directory path in the git command using -C /path/to/repo immediately after git but before any sub-command for example, in this instance I would use

git -C /home/pi/emonpi checkout -f -B  master

to force a git checkout of the master branch, resetting it in the process. This command can be run from anywhere as it defines the repo path.

One thing to watch is that it is for the master branch and not suitable for all repos where you might be using a different (stable) branch.

Ah yes.

Indeed, the “master” would need to be swapped out for whatever branch you are targeting, as would the path need changing to the repo in question. The command was for use “in this instance” but should work fine for any repo or branch combo.

The reset hard command works no matter what the current branch is and there is a risk that someone could take the checkout command and use it out of context. TIMTOWTDI.

Which is exactly why I never use it! It’s a bit of a sledge hammer to bang in a tack. I’ve lost valuable work in other branches due to using reset without fully appreciating the potential outcome. When the issue is that changes to a specific branch cannot be pulled in due to some changes in said branch the better approach (IMO & of course YMMV) is to remove the changes to that branch that prevent that branch from updating. For the record I cringe each and every time you tell users to fully reset the whole repo without even asking them if they have anything of value in any other branch but I refrain from commenting as hopefully very few users will have changes in other branches and we all have different ways of doing things.

I have simply offered up an alternative, whilst, I have to point out, also saying your commands could still be used (despite my reservations), that’s all it is, an alternative, more appropriate in some scenarios, not so much in others. The important thing here was a) getting the right repo and b) you do not need to navigate to it.

@borpin and @pb66
Thank you both
The suggested Git commands executed in /home/pi/emonpi fixed things :smile:

1 Like