Emoncms "Error creating user"

Hi, I have a clean install of emoncms following the guide from

Ubuntu 16.04, Server

When trying to connect (from another computer, the server is headless) to
http://192.168.15.xx/emoncms/
I choose Register and fill out email, username, password and confirm password. When pressing “Register” it says “Error creating user”.

Any ideas what is wrong?

It seems like the error message is from

/var/www/html/emoncms/Modules/user/user_model.php

when trying to create the user in the database. As in the tutorial, I have made the database and updated the settings.php with the user/pwd information.

mysql> CREATE DATABASE emoncms DEFAULT CHARACTER SET utf8;
mysql> CREATE USER ‘emoncms’@‘localhost’ IDENTIFIED BY ‘YOUR_SECURE_PASSWORD_HERE’;
mysql> GRANT ALL ON emoncms.* TO ‘emoncms’@‘localhost’;
mysql> flush privileges;

I have checked the user table in SQL, and it is still empty…

Anybody know what can be wrong?

I am in a similar position. I have a Ubuntu 16.04 VM running with EMonCMS installed as per the instructions at emoncms/LinuxInstall.md at master · emoncms/emoncms · GitHub.

Following other forum posts I have verified that mod_rewrite is enabled.

When I use SequelPro to view the database, I can enter a username into the user table. When I attempt to login through the web portal, It tells me the password is wrong. This proves the connection to the database is ok. If I try to use a username that does not exist, I get the ‘user does not exist’ warning instead of the password warning.

What is the next thing to try?

Can I manually enter sufficient detail directly into the database to allow me to login through the web portal?

Can you try an earlier emoncms version? eg run

git checkout 9.8.10

from the emoncms folder.

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.

Any other suggestions?

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)”

Unfortunately not, there’s not that much to go on.

The password held is encrypted so if you just add a password (without encrypting manually somehow) it will be wrong.

Perhaps you can change the password using the password reset script in usefulscripts, I’ve not used it so I don’t know exactly how it works off hand.

Needless to say this shouldn’t be necessary, but if 2 of you have arrived in the same tight spot, I’m not even sure starting over would be a solution.

Paul,

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)

1 Like

Same problem here.

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.

Hi,

I am trying to enter a user manually and change the password with the script, but I am having problems entering the data:

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?

Hi,

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?

I just wrote an issue at github for this problem:

@TrystanLea - any idea’s on this?

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.

1 Like

I was not enable to get an acces to the admin page without a registered user.

My OS is a fresh installed LUbuntu 16.04 with the latest updates:

root@Solarlogger:~# uname -a
Linux Solarlogger 4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:25 UTC 2018 i686 i686 i686 GNU/Linux

My mysql version:

root@Solarlogger:~# mysqld -V
mysqld  Ver 5.7.21-0ubuntu0.16.04.1 for Linux on i686 ((Ubuntu))

My Apache version:

root@Solarlogger:~# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2017-09-18T15:09:02

My PHP version:

root@Solarlogger:~# php -v
PHP 7.0.25-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.25-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by     Zend Technologies

My redis-server:

root@Solarlogger:~# redis-server -v
Redis server v=3.0.6 sha=00000000:0 malloc=jemalloc-3.6.0 bits=32 build=687a2a319020fa42

My complete php-info.php:

phpinfo.txt (90.0 KB)

Should I post the detailed information further here or in the github issue thread?

@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?

Hello Paul,

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.

Thanks,
Sebastian

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

Lets keep it in one place for now, thanks @belba.

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)

Thanks @rostwald

Thanks @markafleming

Hopefully @TrystanLea can find the time to take a look soon, it’s a bit beyond my emoncms knowledge.

I hacked a little bit PHP-code to get a access to the Administration Page of emoncms, here is my result:

Server Information
| | | |
| --- | --- | --- |
|Emoncms|Version|9.8.28 : 2018.01.27
||Modules|Administration : App v1.1.0 : Dashboard v1.1.1 : EventProcesses : Feed : Input : CoreProcess : Schedule : Time : User : Visualisation
|Server|OS|Linux 4.13.0-32-generic
||Host|Solarlogger Solarlogger (127.0.1.1)
||Date|2018-02-09 16:00:46 CET
||Uptime| 16:00:46 up  2:21,  1 user,  load average: 1.65, 0.74, 0.36
|HTTP|Server|Apache/2.4.18 (Ubuntu) HTTP/1.1 CGI/1.1 80
|MySQL|Version|5.7.21-0ubuntu0.16.04.1
||Host|localhost (127.0.0.1)
||Date|2018-02-09 16:00:46 (UTC 01:00‌​)
||Stats|Uptime: 8455  Threads: 1  Questions: 1610  Slow queries: 0  Opens: 184  Flush tables: 1  Open tables: 89  Queries per second avg: 0.190
|Memory|RAM|Used: 59.39% Total: 987.51 MB Used: 586.52 MB Free: 400.99 MB
||Swap|Used: 4.82% Total: 1012 MB Used: 48.75 MB Free: 963.25 MB
|Disk|Mount|Stats
||/|Used: 5.88% Total: 71.77 GB Used: 4.22 GB Free: 63.89 GB
||/boot|Used: 25.23% Total: 471.6 MB Used: 119 MB Free: 328.26 MB
|PHP|Version|7.0.25-0ubuntu0.16.04.1 (Zend Version 3.0.0)
||Modules|apache2handler : calendar v7.0.25-0ubuntu0.16.04.1 : Core v7.0.25-0ubuntu0.16.04.1 : ctype v7.0.25-0ubuntu0.16.04.1 : curl v7.0.25-0ubuntu0.16.04.1 : date v7.0.25-0ubuntu0.16.04.1 : dom v20031129 : exif v1.4 : fileinfo v1.0.5 : filter v7.0.25-0ubuntu0.16.04.1 : ftp v7.0.25-0ubuntu0.16.04.1 : gettext v7.0.25-0ubuntu0.16.04.1 : hash v1.0 : iconv v7.0.25-0ubuntu0.16.04.1 : json v1.4.0 : libxml v7.0.25-0ubuntu0.16.04.1 : mcrypt v7.0.25-0ubuntu0.16.04.1 : mysqli v7.0.25-0ubuntu0.16.04.1 : mysqlnd : openssl v7.0.25-0ubuntu0.16.04.1 : pcre v7.0.25-0ubuntu0.16.04.1 : PDO v7.0.25-0ubuntu0.16.04.1 : pdo_mysql v7.0.25-0ubuntu0.16.04.1 : Phar v2.0.2 : posix v7.0.25-0ubuntu0.16.04.1 : readline v7.0.25-0ubuntu0.16.04.1 : redis v3.1.6 : Reflection v7.0.25-0ubuntu0.16.04.1 : session v7.0.25-0ubuntu0.16.04.1 : shmop v7.0.25-0ubuntu0.16.04.1 : SimpleXML v7.0.25-0ubuntu0.16.04.1 : sockets v7.0.25-0ubuntu0.16.04.1 : SPL v7.0.25-0ubuntu0.16.04.1 : standard v7.0.25-0ubuntu0.16.04.1 : sysvmsg v7.0.25-0ubuntu0.16.04.1 : sysvsem v7.0.25-0ubuntu0.16.04.1 : sysvshm v7.0.25-0ubuntu0.16.04.1 : tokenizer v7.0.25-0ubuntu0.16.04.1 : wddx v7.0.25-0ubuntu0.16.04.1 : xml v7.0.25-0ubuntu0.16.04.1 : xmlreader v7.0.25-0ubuntu0.16.04.1 : xmlwriter v7.0.25-0ubuntu0.16.04.1 : xsl v7.0.25-0ubuntu0.16.04.1 : Zend OPcache v7.0.25-0ubuntu0.16.04.1 : zlib v7.0.25-0ubuntu0.16.04.1 : 
</pre></details>
<details><summary>Client Information</summary><pre>

| | | |
| --- | --- | --- |
|HTTP|Browser|Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:58.0) Gecko/20100101 Firefox/58.0
|Screen|Resolution|1280 x 1024
|Window|Size|1138 x 826
</pre></details>

Maybe I have found the possible problem:

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?