Error in update emoncms

Couple of things to check

systemctl status redis.service
sudo apt-get install -y redis-server

I executed both commands and presented this information below:

emoncms@emoncms:/var/www/emoncms$ sudo nano settings.php
emoncms@emoncms:/var/www/emoncms$ systemctl status redis.service
● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-09-13 16:10:17 -03; 12min ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
 Main PID: 26344 (redis-server)
    Tasks: 4 (limit: 2305)
   CGroup: /system.slice/redis-server.service
           └─26344 /usr/bin/redis-server 127.0.0.1:6379

Sep 13 16:10:17 emoncms systemd[1]: Stopped Advanced key-value store.
Sep 13 16:10:17 emoncms systemd[1]: Starting Advanced key-value store...
Sep 13 16:10:17 emoncms systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
Sep 13 16:10:17 emoncms systemd[1]: Started Advanced key-value store.
emoncms@emoncms:/var/www/emoncms$ sudo apt-get install -y redis-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
redis-server is already the newest version (5:4.0.9-1ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
emoncms@emoncms:/var/www/emoncms$

Ok good so redis-server is running.

Check this file…

cat /etc/php/7.2/mods-available/redis.ini

and

sudo pip install redis

Here is the output:

extension=redis.so
Requirement already satisfied: redis in /usr/local/lib/python2.7/dist-packages (3.3.8)

Have you rebooted?

Yes, apresenta o mesmo erro.

Some things to try;

Check the php-info

 php -i | grep -i redis

From Installing emoncms - redis problem on openSUSE system - #27 by pb66 - the small script below will prove if PHP is able to connect to Redis on a basic level.

<?php
    $redis = new Redis();
    $redis->connect('127.0.0.1', 6379);
    if ($redis->ping() === "+PONG") {
        echo "Successfully connected to Redis!".PHP_EOL;
    } else {
        echo "Failed to get response from Redis!".PHP_EOL;
    }
?>

Save the above code to a file called test_redis.php and run from the command line

pb66@test2:~$ php test_redis.php
Successfully connected to Redis!

Final thing to check (if the above were unsuccessful) - from Installing emoncms - redis problem on openSUSE system - #4 by Greebo - test redis from the command line… Try this:

$ redis-cli
127.0.0.1:6379> lpush test "hello"
(integer) 1
127.0.0.1:6379> lpop test
"hello"
127.0.0.1:6379> exit
$

If that all works, we can confirm that redis is actually working and rule that out.

This is an odd one as it just worked for me.

Can you both post your latest “server info” for comparison?

Server Information

Server Information

Services

  • emoncms_mqtt :- Active Running
  • feedwriter :- Active Running - sleep 60s 0 feed points pending write
  • service-runner :- Active Running
  • redis-server :- Active Running
  • mosquitto :- Active Running

Emoncms

Server

  • OS :- Linux 4.15.0-62-generic
  • Host :- ubunt-emon | ubunt-emon | (192.168.7.77)
  • Date :- 2019-09-14 12:47:03 UTC
  • Uptime :- 12:47:03 up 1 day, 16:39, 2 users, load average: 0.07, 0.02, 0.00

Memory

  • RAM :- Used: 39.63%
    • Total :- 986.08 MB
    • Used :- 390.82 MB
    • Free :- 595.26 MB
  • Swap :- Used: 0.88%
    • Total :- 1.92 GB
    • Used :- 17.34 MB
    • Free :- 1.91 GB

Disk

  • / :- Used: 28.85%
    • Total :- 15.68 GB
    • Used :- 4.52 GB
    • Free :- 10.34 GB

HTTP

  • Server :- Apache/2.4.29 (Ubuntu) HTTP/1.1 CGI/1.1 80

MySQL

  • Version :- 5.5.5-10.1.41-MariaDB-0ubuntu0.18.04.1
  • Host :- localhost:6379 (127.0.0.1)
  • Date :- 2019-09-14 12:47:03 (UTC 00:00‌​)
  • Stats :- Uptime: 99863 Threads: 2 Questions: 403679 Slow queries: 0 Opens: 178 Flush tables: 1 Open tables: 41 Queries per second avg: 4.042

Redis

  • Version :- 4.0.9
  • Host :- localhost:6379
  • Size :- 168 keys (966.30K)
  • Uptime :- 0 days

MQTT Server

  • Version :- Mosquitto 1.4.15
  • Host :- 192.168.7.50:1883 (192.168.7.50)

PHP

  • Version :- 7.2.19-0ubuntu0.18.04.2 (Zend Version 3.2.0)
  • Modules :- apache2handler | calendar v7.2.19-0ubuntu0.18.04.2 | Core v7.2.19-0ubuntu0.18.04.2 | ctype v7.2.19-0ubuntu0.18.04.2 | curl v7.2.19-0ubuntu0.18.04.2 | date v7.2.19-0ubuntu0.18.04.2 | dom v20031129 | exif v7.2.19-0ubuntu0.18.04.2 | fileinfo v1.0.5 | filter v7.2.19-0ubuntu0.18.04.2 | ftp v7.2.19-0ubuntu0.18.04.2 | gd v7.2.19-0ubuntu0.18.04.2 | gettext v7.2.19-0ubuntu0.18.04.2 | hash v1.0 | iconv v7.2.19-0ubuntu0.18.04.2 | json v1.6.0 | libxml v7.2.19-0ubuntu0.18.04.2 | mbstring v7.2.19-0ubuntu0.18.04.2 | mosquitto v0.4.0 | mysqli v7.2.19-0ubuntu0.18.04.2 | mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $ | openssl v7.2.19-0ubuntu0.18.04.2 | pcre v7.2.19-0ubuntu0.18.04.2 | PDO v7.2.19-0ubuntu0.18.04.2 | pdo_mysql v7.2.19-0ubuntu0.18.04.2 | Phar v2.0.2 | posix v7.2.19-0ubuntu0.18.04.2 | readline v7.2.19-0ubuntu0.18.04.2 | redis v5.0.2 | Reflection v7.2.19-0ubuntu0.18.04.2 | session v7.2.19-0ubuntu0.18.04.2 | shmop v7.2.19-0ubuntu0.18.04.2 | SimpleXML v7.2.19-0ubuntu0.18.04.2 | sockets v7.2.19-0ubuntu0.18.04.2 | sodium v7.2.19-0ubuntu0.18.04.2 | SPL v7.2.19-0ubuntu0.18.04.2 | standard v7.2.19-0ubuntu0.18.04.2 | sysvmsg v7.2.19-0ubuntu0.18.04.2 | sysvsem v7.2.19-0ubuntu0.18.04.2 | sysvshm v7.2.19-0ubuntu0.18.04.2 | tokenizer v7.2.19-0ubuntu0.18.04.2 | wddx v7.2.19-0ubuntu0.18.04.2 | xml v7.2.19-0ubuntu0.18.04.2 | xmlreader v7.2.19-0ubuntu0.18.04.2 | xmlwriter v7.2.19-0ubuntu0.18.04.2 | xsl v7.2.19-0ubuntu0.18.04.2 | Zend OPcache v7.2.19-0ubuntu0.18.04.2 | zlib v7.2.19-0ubuntu0.18.04.2
Client Information

Client Information

HTTP

  • Browser :- Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
  • Language :- en-GB,en-US;q=0.9,en;q=0.8

Window

  • Size :- 1605 x 840

Screen

  • Resolution :- 1920 x 1080
brian@ubunt-emon:/var/www/emoncms$ sudo pip show redis | grep Version
Version: 3.3.8

which file path?

You can save it to where you wish - you created the file (see post no.56).

Here’s the output code

sudo php test_redis.php
PHP Warning: PHP Startup: Unable to load dynamic library ‘mosquitto.so’ (tried: /usr/lib/php/20170718/mosquitto.so (/usr/lib/php/20170718/mosquitto.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mosqu itto.so.so (/usr/lib/php/20170718/mosquitto.so.so: cannot open shared object fil e: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘redis.so’ (tried: /us r/lib/php/20170718/redis.so (/usr/lib/php/20170718/redis.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/redis.so.so (/usr /lib/php/20170718/redis.so.so: cannot open shared object file: No such file or d irectory)) in Unknown on line 0
PHP Fatal error: Uncaught Error: Class ‘Redis’ not found in /var/www/emoncms/te st_redis.php:2
Stack trace:
#0 {main}
thrown in /var/www/emoncms/test_redis.php on line 2

Can you post the output from this please?

Is this a clean & fresh Ubuntu installation or have you just upgraded?

Try without the sudo.

I’ve renitialized the system and will install the script emoncms again, maybe the error is in ubuntu and not in emoncms.

error when running ./main.sh

ln: failed to create symbolic link ‘/var/www/emoncms/Modules/sync’: No such file or directory
ln: failed to create symbolic link ‘/var/www/emoncms/Modules/setup’: No such fil e or directory
Update Emoncms database
PHP Warning: chdir(): No such file or directory (errno 2) in /opt/openenergymon itor/EmonScripts/common/emoncmsdbupdate.php on line 8
PHP Warning: require(process_settings.php): failed to open stream: No such file or directory in /opt/openenergymonitor/EmonScripts/common/emoncmsdbupdate.php o n line 9
PHP Fatal error: require(): Failed opening required ‘process_settings.php’ (inc lude_path=’.:/usr/share/php’) in /opt/openenergymonitor/EmonScripts/common/emonc msdbupdate.php on line 9
emoncms@emoncms:/opt/openenergymonitor/EmonScripts/install$

I’m sorry, I really do not know what else to suggest.

I have now run the script multiple times on a fresh install of Ubuntu 18LTS (I reset the VM each time) and it just works apart from the few additional modifications I have outlined.

This looks like there are fundamental bits that have not installed correctly.

Do you have another version of emoncms that is stable?

It is not the software itself that is not stable, it is the mechanism to install it on systems other than Raspbian.

@TrystanLea is currently working on the scripts so they will be unstable at the moment. We are working on getting these right rather than trying to fix the documentation right now. Not ideal, but it is what it is.

Okay, thanks!