Feeds not loading after emoncms backup and restore

Hi guys,

I am trying to migrate my instance of emoncms from a virtual instance to another. I used the backup script to successfully backup the older instance (database, config and all) to the new instance without issue and I updated the database on the new instance.

I set the emonhub from my raspberry pi to point to the new instance of emoncms and I could see inputs come in.

Unfortunately the feeds page is not loading and I get this error

[Thu Sep 30 09:16:07.479650 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_144.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:07.479657 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:07.481250 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_152.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:07.481290 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_152.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:07.481314 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.443894 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_55.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.443956 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_55.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.443970 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.450655 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_72.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.450703 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_72.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.450715 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.464498 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_88.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.464553 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_88.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.464565 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.469975 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_96.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.470018 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_96.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.470026 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.476950 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_141.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.477013 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_141.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.477177 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.477699 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_144.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.477717 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  filesize(): stat failed for /var/lib/phptimeseriesfeed_144.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.477724 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 78, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1
[Thu Sep 30 09:16:12.479223 2021] [php7:warn] [pid 9417] [client 102.223.1.131:35100] PHP Warning:  fopen(/var/lib/phptimeseriesfeed_152.MYD): failed to open stream: No such file or directory in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 70, referer: http://energy.openculture.org.ng:8080/dashboard/edit?id=1

The new instance of emoncms

10.8.5
Emoncms Core v10.8.5 | App v2.3.4 | Backup v2.3.2 | Dashboard v2.1.5 | Device v2.1.3 | Graph v2.1.1 | EmonScripts v1.3.9

PHP Modules: apache2handlercalendar Core ctype curl date dom v20031129exif fileinfo filter ftp gettext hash iconv json v1.7.0libxml mbstring mysqli mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $openssl pcre PDO pdo_mysql Phar posix readline redis v5.3.4Reflection session shmop SimpleXML sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl Zend OPcache zlib

The old instance of emoncms
10.1.13
Modules
Administration | App v2.0.9 | App v1.1.1 | Backup v2.3.2 | Dashboard v2.0.5 | Dashboard v1.3.0 | EventProcesses | Feed | Graph v2.0.6 | Graph v1.2.0 | Input | CoreProcess | Schedule | Time | User | Visualisation

PHP Modules
Modules: apache2handler | apcu v5.1.9 | bcmath v7.2.24-0ubuntu0.18.04.9 | calendar v7.2.24-0ubuntu0.18.04.9 | Core v7.2.24-0ubuntu0.18.04.9 | ctype v7.2.24-0ubuntu0.18.04.9 | curl v7.2.24-0ubuntu0.18.04.9 | date v7.2.24-0ubuntu0.18.04.9 | dom v20031129 | exif v7.2.24-0ubuntu0.18.04.9 | fileinfo v1.0.5 | filter v7.2.24-0ubuntu0.18.04.9 | ftp v7.2.24-0ubuntu0.18.04.9 | gd v7.2.24-0ubuntu0.18.04.9 | gettext v7.2.24-0ubuntu0.18.04.9 | hash v1.0 | iconv v7.2.24-0ubuntu0.18.04.9 | igbinary v2.0.5 | imagick v3.4.3RC2 | intl v1.1.0 | json v1.6.0 | libxml v7.2.24-0ubuntu0.18.04.9 | mbstring v7.2.24-0ubuntu0.18.04.9 | mysqli v7.2.24-0ubuntu0.18.04.9 | mysqlnd vmysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $ | openssl v7.2.24-0ubuntu0.18.04.9 | pcre v7.2.24-0ubuntu0.18.04.9 | PDO v7.2.24-0ubuntu0.18.04.9 | pdo_mysql v7.2.24-0ubuntu0.18.04.9 | Phar v2.0.2 | posix v7.2.24-0ubuntu0.18.04.9 | readline v7.2.24-0ubuntu0.18.04.9 | redis v3.1.6 | Reflection v7.2.24-0ubuntu0.18.04.9 | session v7.2.24-0ubuntu0.18.04.9 | shmop v7.2.24-0ubuntu0.18.04.9 | SimpleXML v7.2.24-0ubuntu0.18.04.9 | soap v7.2.24-0ubuntu0.18.04.9 | sockets v7.2.24-0ubuntu0.18.04.9 | sodium v7.2.24-0ubuntu0.18.04.9 | SPL v7.2.24-0ubuntu0.18.04.9 | standard v7.2.24-0ubuntu0.18.04.9 | sysvmsg v7.2.24-0ubuntu0.18.04.9 | sysvsem v7.2.24-0ubuntu0.18.04.9 | sysvshm v7.2.24-0ubuntu0.18.04.9 | tidy v7.2.24-0ubuntu0.18.04.9 | tokenizer v7.2.24-0ubuntu0.18.04.9 | wddx v7.2.24-0ubuntu0.18.04.9 | xml v7.2.24-0ubuntu0.18.04.9 | xmlreader v7.2.24-0ubuntu0.18.04.9 | xmlrpc v7.2.24-0ubuntu0.18.04.9 | xmlwriter v7.2.24-0ubuntu0.18.04.9 | xsl v7.2.24-0ubuntu0.18.04.9 | Zend OPcache v7.2.24-0ubuntu0.18.04.9 | zip v1.15.4 | zlib v7.2.24-0ubuntu0.18.04.9

I bit more digging and it seems the problem is the timeseries directory not being properly referenced as can be seen here
filesize(): stat failed for /var/lib/phptimeseriesfeed_88.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71

/var/lib/phptimeseriesfeed_88.MYD
should be /var/lib/phptimeseries/feed_88.MYD

I checked the php file where this is being referenced and all is as it should be

<?php
// engine_methods interface in shared_helper.php
include_once dirname(__FILE__) . '/shared_helper.php';

class PHPTimeSeries implements engine_methods
{
    private $dir = "/var/lib/phptimeseries/";
    private $log;
    
    private $writebuffer = array();

    /**
     * Constructor.
     *
     * @api
    */
    public function __construct($settings)
    {
        if (isset($settings['datadir'])) $this->dir = $settings['datadir'];
        $this->log = new EmonLogger(__FILE__);
    }

At this stage I am compeltely lost. I don’t know where else I can correct this issue.

I intentionality made changes to the /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php removing the timeseries directory referenced there altogether and still from the logs it still get exact same error. It seems to be referencing timeseries directory from else where. could it be from the database?

I just dropped the database and did a new restore. Please if anyone is reading this and can help me with pointers. The server my current emoncms instance is hosted at is about to be deleted this is a desperate plea. I don’t mind paying.

I am still getting this error
filesize(): stat failed for **/var/lib/phptimeseriesfeed**_88.MYD in /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php on line 71

which tells me the timeseries directory is not being referenced properly. I am just lost on what to do. Please I desperately need help.

If there is any more information I need to include, please point me to it.

was able to solve the problem. It was caused by not adding the tailing “/” to the phptimeseries[datadir] in settings.ini
the particular line looked like this phptimeseries[datadir] = ‘/var/lib/phptimeseries’
when it should be like this phptimeseries[datadir] = ‘/var/lib/phptimeseries/’

what threw me off was the error was pointing to the /var/www/html/emoncms/Modules/feed/engine/PHPTimeSeries.php as its reference point and /var/lib/phptimeseries/ was well defined on there so it was difficult tracking the problem. Anyway glad to solve this.
Putting this out there so no one has to go through what I went through.