Hi guys, I got in the setup via „sudo openhabian-config“ a error in the installation.
Now I tried via the manual steps to find the issue.
It seems to be a authentification problem.
Connected to http://localhost:8086 version 1.7.9
InfluxDB shell version: 1.7.9
> CREATE DATABASE openhab_db
ERR: unable to parse authentication credentials
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> use openhab_db
ERR: unable to parse authentication credentials
DB does not exist!
> CREATE DATABASE openhab_db
ERR: unable to parse authentication credentials
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
Thanks for your help. I tried your this but get following results. Seems like the admin exists but not with the right priviliges.
[09:58:26] openhabian@openhab:~$ influx
Connected to http://localhost:8086 version 1.7.9
InfluxDB shell version: 1.7.9
> CREATE USER admin WITH PASSWORD 'XYZ5' WITH ALL PRIVILEGES
ERR: unable to parse authentication credentials
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> auth admin
username: admin
password:
> CREATE DATABASE openhab_db
ERR: authorization failed
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> CREATE USER admin WITH PASSWORD 'XYZ5' WITH ALL PRIVILEGES
ERR: authorization failed
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
>
> auth admin
username: admin
password:
> use openhab_db
WARN: authorization failed
Using database openhab_db
>
now I installed again via openhab-config, enclosed you see the error as I got it the first time on apretty clean installation. (openhabian)
$ systemctl daemon-reload
$ systemctl enable influxdb.service
$ systemctl restart influxdb.service
OK Configure InfluxDB admin account... curl: (7) Failed to connect to localhost port 8086: Verbindungsaufbau abgelehnt
FAILED Configure listen on localhost only...
$ sed -i -e /# Determines whether HTTP endpoint is enabled./ { n ; s/# enabled = true/enabled = true/ } /etc/influxdb/influxdb.conf
$ sed -i s/# bind-address = ":8086"/bind-address = "localhost:8086"/g /etc/influxdb/influxdb.conf
$ sed -i s/# auth-enabled = false/auth-enabled = true/g /etc/influxdb/influxdb.conf
$ sed -i s/# store-enabled = true/store-enabled = false/g /etc/influxdb/influxdb.conf
$ systemctl restart influxdb.service
FAILED
Setup of inital influxdb database and InfluxDB users... curl: (7) Failed to connect to localhost port 8086: Verbindungsaufbau abgelehnt
curl: (7) Failed to connect to localhost port 8086: Verbindungsaufbau abgelehnt
curl: (7) Failed to connect to localhost port 8086: Verbindungsaufbau abgelehnt
curl: (7) Failed to connect to localhost port 8086: Verbindungsaufbau abgelehnt
curl: (7) Failed to connect to localhost port 8086: Verbindungsaufbau abgelehnt
FAILED Installing Grafana...--2020-02-06 22:37:40-- https://packages.grafana.com/gpg.key
Auflösen des Hostnamens packages.grafana.com (packages.grafana.com)… 2a04:4e42:1b::729, 151.101.114.217
Verbindungsaufbau zu packages.grafana.com (packages.grafana.com)|2a04:4e42:1b::729|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 1694 (1,7K) [application/x-iwork-keynote-sffkey]
Wird in »STDOUT« gespeichert.
---- Output on OPENHAB-CONFIG ----------------------------------------------
┌──────────────────┤ Operation Failed! ├───────────────────┐
│ │
│ Sadly there was a problem setting up the selected │
│ option. Please report this problem in the openHAB │
│ community forum or as a openHABian GitHub issue. │
│ │
│ │
│ <Ok>
I’m not an expert on openhabian, but I can see that it is trying to run the code below. For some reason the curl command can’t connect in order to create the admin user. I can think of 2 possible reasons:
The sleep wasn’t long enough
The InfluxDB service didn’t start for some reason
What do you get from this?
systemctl status influxdb
and from?
ps -ef | grep -i influx
Here’s a snippet from what openhabian is trying to do:
cond_redirect systemctl restart influxdb.service
sleep 30
if [ $FAILED -eq 1 ]; then echo -n "FAILED "; else echo -n "OK "; fi
echo -n "Configure InfluxDB admin account... "; echo -n ""
curl --insecure $influxdb_address/query --data-urlencode "q=CREATE USER admin WITH PASSWORD '$1' WITH ALL PRIVILEGES" || FAILED=1
if [ $FAILED -eq 1 ]; then echo -n "FAILED "; else echo -n "OK "; fi
echo -n "Configure listen on localhost only... "; echo -n ""
@noppes123 above in post 3 does show how you can create the admin user manually if needed from the InfluxDB cli. Not sure that is the problem when using openhabian, though.
You can also try the curl command manually to see what it does (fill in the password). You don’t happen to have anything else trying to run on port 8086 do you?
curl --insecure http://localhost:8086/query --data-urlencode "q=CREATE USER admin WITH PASSWORD XXXX WITH ALL PRIVILEGES"
From the openhabian-config output it is obvious that the InfluxDB daemon fails to start. The most common reasons are port already in use (as @jswim788 already mentioned), and access rights. Since the setup is done with openHABian, the 2nd option is unlikely. The first option can easily be checked with:
sudo lsof -i -P -n | grep LISTEN
Also, try to start the InfluxDB daemon manually to see what happens:
sudo systemctl start influxdb
and check the status and syslog with
sudo systemctl status influxdb
sudo journalctl -u influxdb
[00:11:51] root@openhab:/home/openhabian# sudo systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series databa
Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset:
Active: active (running) since Thu 2020-02-06 22:37:10 CET; 1 day 1h ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 1714 (influxd)
Tasks: 14 (limit: 2319)
Memory: 11.8M
CGroup: /system.slice/influxdb.service
└─1714 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Feb 08 00:05:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:06:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:07:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:07:54 openhab influxd[1714]: ts=2020-02-07T23:07:54.469608Z lvl=info m
Feb 08 00:07:54 openhab influxd[1714]: ts=2020-02-07T23:07:54.469920Z lvl=info m
Feb 08 00:08:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:09:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:10:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:11:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
Feb 08 00:12:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:
lines 1-20/20 (END)
● influxdb.service - InfluxDB is an open-source, distributed, time series database
Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-02-06 22:37:10 CET; 1 day 1h ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 1714 (influxd)
Tasks: 14 (limit: 2319)
Memory: 11.8M
CGroup: /system.slice/influxdb.service
└─1714 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Feb 08 00:05:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:05:00 +0100] "POST /
Feb 08 00:06:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:06:00 +0100] "POST /
Feb 08 00:07:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:07:00 +0100] "POST /
Feb 08 00:07:54 openhab influxd[1714]: ts=2020-02-07T23:07:54.469608Z lvl=info msg="Retention policy de
Feb 08 00:07:54 openhab influxd[1714]: ts=2020-02-07T23:07:54.469920Z lvl=info msg="Retention policy de
Feb 08 00:08:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:08:00 +0100] "POST /
Feb 08 00:09:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:09:00 +0100] "POST /
Feb 08 00:10:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:10:00 +0100] "POST /
Feb 08 00:11:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:11:00 +0100] "POST /
Feb 08 00:12:00 openhab influxd[1714]: [httpd] 127.0.0.1 - openhab [08/Feb/2020:00:12:00 +0100] "POST /
~
~
~
[00:22:06] root@openhab:/home/openhabian# sudo journalctl -u influxdb
-- Logs begin at Sun 2020-02-02 21:48:39 CET, end at Sat 2020-02-08 00:22:10 CET. --
Feb 02 22:17:37 openhab systemd[1]: Started InfluxDB is an open-source, distributed, time series databa
Feb 02 22:18:07 openhab systemd[1]: Stopping InfluxDB is an open-source, distributed, time series datab
Feb 02 22:18:07 openhab systemd[1]: influxdb.service: Main process exited, code=killed, status=15/TERM
Feb 02 22:18:07 openhab systemd[1]: influxdb.service: Succeeded.
Feb 02 22:18:07 openhab systemd[1]: Stopped InfluxDB is an open-source, distributed, time series databa
Feb 02 22:18:07 openhab systemd[1]: Started InfluxDB is an open-source, distributed, time series databa
Feb 02 22:18:51 openhab influxd[3636]: ts=2020-02-02T21:18:51.980671Z lvl=info msg="InfluxDB starting"
Feb 02 22:18:51 openhab influxd[3636]: ts=2020-02-02T21:18:51.981512Z lvl=info msg="Go runtime" log_id=
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.096938Z lvl=info msg="Using data dir" log
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.097703Z lvl=info msg="Compaction settings
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.097887Z lvl=info msg="Open store (start)"
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.098266Z lvl=info msg="Open store (end)" l
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.098634Z lvl=info msg="Opened service" log
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.098748Z lvl=info msg="Starting monitor se
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.099030Z lvl=info msg="Registered diagnost
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.099183Z lvl=info msg="Registered diagnost
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.099248Z lvl=info msg="Registered diagnost
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.099331Z lvl=info msg="Registered diagnost
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.099439Z lvl=info msg="Starting precreatio
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.099618Z lvl=info msg="Starting snapshot s
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.100083Z lvl=info msg="Starting continuous
Feb 02 22:18:52 openhab influxd[3636]: ts=2020-02-02T21:18:52.100499Z lvl=info msg="Starting HTTP servi
lines 1-23
So InfluxDB appears to be running. Can you try this as it is what the openhabian script is trying to do and seems to have failed when it ran?
curl --insecure http://localhost:8086/query --data-urlencode "q=CREATE USER admin WITH PASSWORD XXXX WITH ALL PRIVILEGES"
Change the password to something reasonable.
@noppes123 in the 3rd post from the top shows how to do this manually if you run the command line with influx, but openhabian shouldn’t have failed with the above curl command. Let’s see what that does.
looks the result is always my authentification problem which also failed in the official install script
curl --insecure http://localhost:8086/query --data-urlencode "q=CREATE USER admin WITH PASSWORD @HQ1975&home WITH ALL PRIVILEGES"
{"error":"unable to parse authentication credentials"}
Can you try it with the single quotes around the password?
curl --insecure http://localhost:8086/query --data-urlencode "q=CREATE USER admin WITH PASSWORD '@HQ1975&home' WITH ALL PRIVILEGES"
At least we know that the problem is not connecting with the InfluxDB - it’s running, but for some reason it’s not happy with this particular command. So we need to get it to work. It seems like this is a different error than when it ran in the script, but it’s hard to be sure.
Also, just as a test, try a simpler password. Just regular letters and numbers. I doubt that is an issue, but it is one more thing to try to make the debug easier.
[20:30:45] root@openhab:/home/openhabian# curl --insecure http://localhost:8086/ query --data-urlencode "q=CREATE USER admin WITH PASSWORD 'hallo123' WITH AL L PRIVILEGES"
404 page not found
curl: (6) Could not resolve host: query
again with the right format:
[20:38:42] root@openhab:/home/openhabian# curl --insecure http://localhost:8086/query --data-urlencode "q=CREATE USER admin WITH 'hallo' [REDACTED] WITH ALL PRIVILEGES"
{"error":"unable to parse authentication credentials"}
Is that exactly how you typed it? It seems that the PASSWORD is missing. But maybe the log in this forum changed it? Try adding the -v. I’m beginning to run out of ideas, but maybe that will tell us. Try this:
curl -v --insecure http://localhost:8086/query --data-urlencode "q=CREATE USER admin WITH PASSWORD '123' WITH ALL PRIVILEGES"
Also, make sure that these are the standard quote marks, not the slanted single and double quotes. That can cause trouble - although the script should be correct, so it doesn’t seem to be the root cause.