Community
OpenEnergyMonitor

Community

Cannot login after updating to 9.8.29 (master branch)

Tags: #<Tag:0x00007fc91d75cf90>

Continuing the discussion from Can't login on localhost after updating emonpi to v9.8.27:

Just pulled the master off emoncms GitHub and now I am getting the “Database error, you may need to run database update” message.

The solution on the linked page does not work for me as this is a self hosted install and that php file is not in the main repository (as far as I can see).

The solution was to copy the ‘emoncmsdbupdate.php’ text into a file (in the home directory), make it executeable and run it.

Might be worth adding this to the useful scripts repository rather than exclusively in the emonpi repository. Even better would be to provide a link in the error message so you could just click it.

This just gets better…

loginerror

I haven’t got time to try the fix yet @borpin but users shouldn’t really have to mess about like this following an update to 9.8.29.

Paul

Hello @Paul, Have you tried updating the database following either @borpin’s approach or the one I documented?

There’s not really an easy way around requiring a database update after certain emoncms updates unfortunately, especially after we moved to prepared mysql queries to improve security which require explicit statement of the query fields…

Just got home, downloaded and ran emoncmsdbupdate.php which updated the database, and got me access OK.

If all users of self-builds are expected to have to run this script to update their database, wouldn’t it make sense to include the script (as an executable file) in the emoncms repo, probably within emoncms/scripts ?
So users who are locked out, can simply run a single command to update their database, instead of searching for the file, downloading it, making it executable, etc.

If so, let me know and I’ll add it.

Paul

Is there anyway to detect that an update has been done and if it has, emoncms can decide to run a dbupdate?

Actually, thinking about it, if the system knows it needs to run a database update (as per the error message), why does it not just do it?

1 Like

Hi,
ran into the same error (after illegal shutdown) . Copied emoncmsdbupdate.php to a file in home/pi$
made it executable : sudo chmod +x emoncmsdbupdate.php
run with: ./emoncmsdbupdate.php
and getting al kinds off errors:
./emoncmsdbupdate.php
./emoncmsdbupdate.php: line 1: ?php: No such file or directory
./emoncmsdbupdate.php: line 2: //: Is a directory
./emoncmsdbupdate.php: line 3: =: command not found
./emoncmsdbupdate.php: line 4: syntax error near unexpected token 'EMONCMS_EXEC',' ./emoncmsdbupdate.php: line 4:define(‘EMONCMS_EXEC’, 1);’

what am i doing wrong?

many thanks for your advice

ps : the same happens if done in /var/www/emoncms/

Ah, emoncmsdbupdate.php is not a shell script. If you try running with php it should work, e.g:

php emoncmsdbupdate.php

Thanks !!! that did it. Stupid me. i already did read that somewhere but forgot.

3 posts were split to a new topic: Update issue from v9.8.24 to v10.1.10 on a shared server