Emoncms on personal server, missing device TX4, and Can't update

Hello,
I have emoncms version 11.3.0, but I’m missing the devices EmonTX4, how can I uograde correctly my own server so I can have the same as on a EmonPI latest SD card.

When I click on system update I got this message:

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh: line 26: [: : integer expression expected
Starting update via service-runner-update.sh (v3.0) >
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           394M  1.2M  393M   1% /run
/dev/sda1        48G  9.9G   36G  22% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/loop5      115M  115M     0 100% /snap/core/13886
/dev/loop0      115M  115M     0 100% /snap/core/13741
/dev/loop4       45M   45M     0 100% /snap/certbot/2414
/dev/loop3       45M   45M     0 100% /snap/certbot/2344
tmpfs           394M   72K  394M   1% /run/user/116
/dev/loop6       64M   64M     0 100% /snap/core20/1634
/dev/loop2       64M   64M     0 100% /snap/core20/1695
tmpfs           394M   60K  394M   1% /run/user/1000
- Could not find emonSD version file
git pull /opt/openenergymonitor/EmonScripts
  master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.

nothing to commit, working tree clean
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Tue 08 Nov 2022 06:49:06 PM CET
EUID: 0
openenergymonitor_dir: /opt/openenergymonitor
type: emoncms
serial_port: ttyS0
firmware: none
update running as root, switch to user

Any help welcome

You need to provide more information. What OS, how was it installed, how is the TX4 communicating with your instance.

My emonTX4 send the data to an emonBase via 433mhz, that work fine.
Then the emonBase send it’s data to an emoncms server via network (wired).
The server is on Debian 5.10 (11.5), and the installation of this part was made via a git clone of the emoncms repository.
But I always add a lot of trouble with the upgrade, and now I was able to upgrade the base to 11.3, but I can’t make it work with the other component.

I’d would love to fix the setup (without whipping out everything)

That isn’t really likely to work. How did you setup the databases etc? If following any manual steps you found, that is quite old info.

Has emoncms ever worked?

Yes you would do as the upgrade assumes lots of things about where stuff is, I’m afraid.

I’d suggest creating a new instance of emoncms with the scripts, which will put everything where it expects to find it. However, Debian is a rarely used base OS and last time I tried, I did run into some issues. As a warning, Ubuntu 22.04 didn’t install last time I tried.

Yes my server is working, just not update.
Ok So I guess I will do a backup of my stuff ( at least I mostly need the Dashboard I create) the feed are easy to re-create.
So what OS I should get, and where can I find some good documentation for my own install ?

But is it receiving data - has it ever received data?

You must have done more than simply clone the repository.

Yes it receive either way the data from the emonPi I have, or from a home made device that send data to emoncms.

Yes Maybe I did more than just git clone, but can’t remember, and can’t find the right documentation to try to understand what’s wrong with my install.

Looking again, it doesn’t seem you have an issue with the update feature.

I suspect you have simply not configured the emonbase correctly to speak to the TX4.

How do you know?

Can you post relevant parts of the emonhub log and all the emonhub configuration (from the emonbase).

My design is the following:
TX4 → 433Mhz signal → emonPi - emonHub → wired Ethernet → emonBase (my own install)
The traffic from the TX4 is received on the emonPi, and send correctly to the emonBase

I know since I have the emonTx4_17 input on my own emonBase, same of what I have on the emonPi

Following this documentation:

I think my problem is related to those username:

[emonsd.config.ini]

username=pi
hostname=emoncms
emonSD_pi_env=0

# MQTT - change settings.ini after install if server is not local
mqtt_user=emonpi
mqtt_password=emonpimqtt2016

And frankly I have no clue which one I have to create before I download the script, and I think my script where just run as root.

Since there is nothing about a user that has to be create for the instal or so, just an instruction to run before the script so the user dosen’t need a password during the sudo

I know I sound simple but I think that’s my issue, and that’s why the update on the GUI is telling me that the script run as root, instead of user.

[Edited for formatting;
For future reference, when posting code or output, please put 3 ‘backticks’ (normally found at the top left of the keyboard) on a line of their own before the code, and 3 more backticks also on a line of their own after the code:

```
code
```

If it is something like php you can add a language identifier after the first 3 backticks: ```php or even ```text if you don’t want any language markup applied.

Moderator (RW)]

If you had (as asked)

I might be able to help.

Correct docs are here (follow link at top of page) although it is the same EmonCMS Install Scripts — OpenEnergyMonitor 0.0.1 documentation

Note, we give info for installing on Ubuntu but not Debian - if you are using that, you are expected to know what you are doing :wink:.

I’ll refer you to my answer above.

I did try on Debian once but it was a bit of a PITA.

So I decide to start over with a fresh install using Ubuntu.
Everything where going fine until I reach the end whit this error:

Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'emoncms'@'localhost' (using password: YES) in /var/www/emoncms/index.php:79 Stack trace: #0 /var/www/emoncms/index.php(79): mysqli->__construct() #1 {main} thrown in /var/www/emoncms/index.php on line 79

Even after a reboot

Which version. I tried with 22.04 and I am pretty sure it failed. use 20.04.

Damn I used 22.04

As commented in you comment, everything where smoothly installed.
But I’m wondering if the change of the password inside the config file has something to do with my problem.
Because even in command line I can’t access the emoncms DB, only with root, and I didn’t find the right script who tel me what right I suppose to grant to emoncms user.

Instead of a service-runner not starting up.

Did you create a user pi? Generally I find this the simplest route - path of least resistance.

I need to find the right code into the different script to be sure how I can creat a user pi into the DB and what GRANT I have to setup.

Any hint on that ?

No, I meant did you create a User Pi in Ubuntu before installing?

sorry
no I used emoncms (this one was create before the script, and it was the one I used to do the install) as username and change it on config.ini before running the script

That doesn’t always work.

The scripts are designed to be used on RaspberryOS and not robust for other installs.

Create a user Pi, then login as that user and do the install.

adduser pi sudo

Okay I will do that tomorrow, but I think I will have to start from scratch, because many process are registred with my user emoncms, including the install script the database also.

not a to big deal since I dind’t have anything setup yet.
I will let you know.

1 Like

Hello,
It’s working!

That mean the line

# user - Change user to reflect your OS user

On the config.ini is not right, you have to keep ‘pi’ as username, because somewhere something is still using taht account to access the DB!

And I can’t find it.

Anyway problème is solve my own emoncms server is wokring fine, and up to date.

thanks for your time
No I can go for the next problem :wink:
See you soon