Version 9.8.10 is far enough back to eliminate any of the changes to emoncms login and user schema made late last year for security fixes.
Once you try it use
git checkout master
(or stable depending on the branch you were originally on) to return to the latest version. If it was successful and you created a user it looks like an emoncms issue, otherwise it’s likely to be external to the emoncms code itself. You will most likely need to check&update the database from the admin page once you’re in.
[edit] Also are there any errors reported in the dev console of your browser?
Paul, thanks for the suggestion. I tried 9.8.10 - it behaves the same way. There are no errors showing in the browser dev console. I am still seeing that it is able to access the db as before. I have also proven it by trying to register a new user with an existing name at which gives the correct error.
I also tried changing the settings.php file to modify the db login details. If I use an incorrect user/password/host, I get “Can’t connect to database, please verify credentials/configuration in settings.php
Error message: Access denied for user ‘<>’@‘localhost’ (using password: YES)”
thanks for the suggestion and link to the password reset script. Although it didn’t work straightaway, it did solve it. I was monitoring the database directly with SequelPro so I could see the password hash and salt change. It wasn’t until the third attempt that the random reset password was acceptable. No idea why. Still, thanks very much for getting me in. I have now amended the password in the emon account settings and everything appears to be nominal (as SpaceX would say)
Fresh installation inside zone on illumos/smartOS, all dependencies/needed modules installed and loaded (BTW: there is absolutely no proper dependency list; dependencies have to be extrapolated from the messy sudo-code-dump called “Installation Instructions”…)
When trying to register a new user, the form just fails with “error creating user”. No errors are logged by emoncms; no errors by apache; access log shows a successfull POST: "POST /emoncms/user/register.json HTTP/1.1" 200
When creating a user manually in the db and using the password reset script, working accounts can be created; but for a real deployment this is completely useless.
on a fresh Ubuntu installtaion I have the same problems:
I got “Error creating user” for the firstregister procedure, no errors in apache error-log or mysql log.
I have also tried to get more information with “$stmt->errno” and “$stmt-error” statement line 225 in Modules/user/user_model.php, without any succsess. It seems that the object don’t know this items.
Any further ideas?
4 fresh emoncms installs, cannot create the first user via normal means, seems to work ok once an initial user is set up via a backdoor method.
I would have expected a run of similar issues to usually be caused by a recent change in the source and yet backdating to 9.8.10 didn’t help the issue.
@Stian, @belba, @rostwald and @markafleming can you please confirm what database you are running is it mariadb or mysql, if you are running php 5 or 7 and have you installed and enabled redis and/or the redis-php extension? If you have actually got in and can access the admin page, please use the system details “copy to clipboard” so we can see it there’s anything odd there.
@pb66, my info is basically the same as @belba, see bellow:
uname -a
Linux vir5ubuntu 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
mysqld -V
mysqld Ver 5.7.21-0ubuntu0.16.04.1 for Linux on x86_64 ((Ubuntu))
apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2017-09-18T15:09:02
php -v
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/20151012/redis.so’ - /usr/lib/php/20151012/redis.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
redis-server -v
Redis server v=3.0.6 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=687a2a319020fa42
I did not manage to create a user manually in the database, I tried this
mysql> INSERT INTO users ( username, password, email, salt ,apikey_read, apikey_write, admin ) VALUES (‘emoncms’, ‘testpwd’, ‘[email protected]’,‘1’, ‘1’,‘1’,‘1’);
ERROR 1364 (HY000): Field ‘tags’ doesn’t have a default value
Any idea why I get the error? What is the value of apikey_read, apikey_write and admin?
I’m not at work today, but here’s what I know from the top of my head:
After manually creating a user and resetting the PW I was able to
access the admin panel. I didn’t test creating/modifying anythnig, but
from browsing around in the backend no errors were logged either by
apache or emoncms; so it seemed to work nominal.
All packages were installed from pkgsrc.joyent.com. These packages are
usually in sync with NetBSD package Versions.
Apache 2.4
PHP 7.2
MySQL 5.7
redis 4.0.8
Enabling or disabling redis didn’t change the behaviour; in both cases
the error was reproducible.
I will give you the system details, the rest of the packages and
full version numbers on monday when I’m back at work and have access to
the system.
Unfortunately I won’t be on site again until at least next week to get the Admin settings. However I can say the installation is on a bare Ubuntu 16.04LTS + NodeRED + MySQL + PHP7. Redis is installed but I don’t know if it is enabled
Sorry @Stian no idea on the error at the moment. The admin field is 1 for an emoncms administrator and 0 for all other users. By default only the first user created is admin. Both the apikey field are unencrypted 32char 128 bit hexadecimal string apikeys (eg 5cd93050a8163115c85590a428f27fd7)
The column “tags” from the table “users” is not installed as default null. That means that the DB expect a input for that column which is not given at the first registration.
The possible solution for that problem is:
ALTER TABLE `users` CHANGE `tags` `tags` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
This could be solve the problem, but…
WARNING!
I think a developer should verify my post and agree if that solves the problem.
All other who use this change of the database make it on their own risk.
PS: I wonder very much that such kind of errors are not found at any logs! Why?
I had hoped that backdating to 9.8.10 would have ruled out the changes to the user schema, perhaps the emoncms tables need to be dropped when backdating so that new tables are created when creating the first user with 9.8.10.
There have been 3 changes to the “tags” field in the user schema
I’m back at work and as promised here are the details to our installation:
[root@emoncms ~]# uname -a
SunOS emoncms 5.11 joyent_20171026T003127Z i86pc i386 i86pc
[root@emoncms ~]# mysqld -V
mysqld Ver 5.7.20 for solaris11 on x86_64 (Source distribution)
[root@emoncms ~]# httpd -v
Server version: Apache/2.4.29 (Unix)
Server built: Jan 3 2018 12:04:u5408
[root@emoncms ~]# php -v
PHP 7.2.1 (cli) (built: Jan 8 2018 16:36:39) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
[root@emoncms ~]# redis-server -v
Redis server v=4.0.6 sha=00000000:0 malloc=libc bits=64 build=e1320b37e529b7ca
I can confirm the sql error about ‘tags’ not having a default value:
mysql> INSERT INTO users ( username, password, email, salt ,apikey_read, apikey_write, admin ) VALUES ('test','8c624673cd2319e39b521358f0eba98aa82db07380f10706d8429532d0c9a4f6','[email protected]','24f2d5d96fd5a640c7724a36021d372b','9abdeb7512ced8437e63553b21eb47e7','96991b45ca4806927be38a173b555f85',0);
ERROR 1364 (HY000): Field 'tags' doesn't have a default value
(edit) This is the actual statement generated by the emoncms register form; logged by activating @@general_log.
This indeed solves the problem.
I’ve modified the schema for the user table to set the default for the ‘tags’ column to NULL and user registration works as intended with a fresh DB. I created a PR for this fix: