Nach Neuinstallation aufgrund Upgrade Linux auf Bullseye light mysql Fehler

Begonnen von UweUwe, 18 November 2022, 22:43:13

Vorheriges Thema - Nächstes Thema

UweUwe

Hallo,
ich ziehe gerade eines meiner FHEM-Systeme auf Bullseye um.
FHEM, ALEXA und die einzelnen Module laufen schon.
Die Datenbank scheint noch eine grosses Problem zu haben und schreibt kontinuierlich und häufig folgende Fehlermeldung in das Logfile:

Wir gehen davon aus, dass der lokale Systemadministrator Ihnen die
Regeln erklärt hat.  Normalerweise läuft es auf drei Regeln hinaus:

    #1) Respektieren Sie die Privatsphäre anderer.
    #2) Denken Sie nach, bevor Sie tippen.
    #3) Mit großer Macht kommt große Verantwortung.

sudo: Zum Lesen des Passworts ist ein Terminal erforderlich; verwenden Sie entweder die Option -S, um aus der Standardeingabe zu lesen oder richten Sie das Askpass-Hilfsprogramm ein
sudo: Ein Passwort ist notwendig
2022.11.18 22:25:35 2: PRESENCE (BluetoothAnwesend) - error while processing check: unexpected function output (expected 0 or 1):
2022.11.18 22:25:39 3: DbLog DBLogging - Creating Push-Handle to database mysql:database=fhem;host=localhost;port=3306 with user fhemuser
2022.11.18 22:25:39 2: DbLog DBLogging - Error: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 1231) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.

2022.11.18 22:25:45 3: DbLog DBLogging - Creating Push-Handle to database mysql:database=fhem;host=localhost;port=3306 with user fhemuser
2022.11.18 22:25:45 2: DbLog DBLogging - Error: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 1232) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.

2022.11.18 22:25:50 3: DbLog DBLogging - Creating Push-Handle to database mysql:database=fhem;host=localhost;port=3306 with user fhemuser
2022.11.18 22:25:50 2: DbLog DBLogging - Error: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 1233) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.

2022.11.18 22:25:55 3: DbLog DBLogging - Creating Push-Handle to database mysql:database=fhem;host=localhost;port=3306 with user fhemuser
2022.11.18 22:25:55 2: DbLog DBLogging - Error: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 1234) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.

2022.11.18 22:26:00 3: DbLog DBLogging - Creating Push-Handle to database mysql:database=fhem;host=localhost;port=3306 with user fhemuser
2022.11.18 22:26:00 2: DbLog DBLogging - Error: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 1235) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.

2022.11.18 22:26:05 3: DbLog DBLogging - Creating Push-Handle to database mysql:database=fhem;host=localhost;port=3306 with user fhemuser
2022.11.18 22:26:05 2: DbLog DBLogging - Error: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 1236) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.


Kann mir bitte jemand weiterhelfen, wie ich hier wieder mysql zum Laufen bekomme.
Danke

MadMax-FHEM

Schon mal gesucht?
Klingt ähnlich: https://forum.fhem.de/index.php/topic,126376.msg1209901.html#msg1209901

Wobei da ja mehr ist:

du oder ein Modul nutzt sudo und fhem darf das nicht ohne Passwort...

und irgendwas mit BT-Presence scheint auch nicht zu passen...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

UweUwe

Hallo,
hab versucht die Mariadb Datenbank auf Linux Ebene zu starten und bin gescheitert.
Vorher hab ich die MariaDB nochmals installiert, ohne Probleme.

Hier die Fehlermeldung bei Start der mariasb:

pi@Vagabundi02:~ $ systemctl start mariadb
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Legitimierung ist zum Starten von »mariadb.service« notwendig.
Authenticating as: ,,, (pi)
Password:
==== AUTHENTICATION COMPLETE ===
Failed to start mariadb.service: Unit mariadb.service is masked.


Ich verstehe es doch richtig.

mariadb fragt nach Passwort::: das gebe ich ein und wird akzeptiert.
Dann start mariadb: mariadb.dervice wäre masked, was immer das heisst.

bei der Eingabe von sudo systemctl start mariadb bekomme ich

pi@Vagabundi02:~ $ sudo systemctl start mariadb
Failed to start mariadb.service: Unit mariadb.service is masked.




UweUwe

Hallo, noch ein Hinweis:

innerhalb FHEM/dblogging bekomme ich folgende Fehlermeldung

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./lib ./FHEM . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabihf/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl-base /usr/lib/arm-linux-gnueabihf/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl ./FHEM/lib) at (eval 393) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Mem, Pg, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 3287.

MadMax-FHEM

Hast du dir den Link mal durchgelesen?!

Dort steht doch zu Beginn die Lösung: installieren von Paketen...

Dann kopiere ich dir das halt hier noch mal:
apt-get install libdbd-mysql libdbd-mysql-perl

Die Fehlermeldung dort klingt zumindest wie deine...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

MadMax-FHEM

Google sagt dir was? ;)

masked heißt so viel wie deaktiviert...

Such doch mal nach z.B.: unit service masked

Nutzt du mariadb oder mysql?

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

Wernieman

und ein systemctrl start <Service> funktioniert natürlich nur als root, oder mit sudo ...
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Hab die gesamte Installation nochmals durchgeführt. Auch die Ergänzung

apt-get install libdbd-mysql libdbd-mysql-perl

auch das device DBLogging hab ich in FHEM gelöscht und nochmals installiert mit :

define DBLogging DbLog /opt/fhem/db.conf .*:.*

Das DBLogging device sieht dann so aus:

Internals:
   CFGFN     
   COLUMNS    field length used for Device: 64, Type: 64, Event: 512, Reading: 64, Value: 128, Unit: 32
   CONFIGURATION /opt/fhem/db.conf
   DEF        /opt/fhem/db.conf .*:.*
   FUUID      637a963f-f33f-813e-db94-68a232fb0ff55c65
   FVERSION   93_DbLog.pm:v4.13.2-s26672/2022-11-07
   MODE       synchronous
   MODEL      MYSQL
   NAME       DBLogging
   NR         2976
   NTFY_ORDER 50-DBLogging
   PID        2539
   REGEXP     .*:.*
   STATE      DBI connect('database=fhem;host=db;port=3306','fhemuser',...) failed: Unknown MySQL server host 'db' (-5) at ./FHEM/93_DbLog.pm line 3287.

   TYPE       DbLog
   UTF8       0
   dbconn     mysql:database=fhem;host=db;port=3306
   dbuser     fhemuser
   eventCount 3
   HELPER:
     COLSET     1
     DEVICECOL  64
     EVENTCOL   512
     OLDSTATE   DBI connect('database=fhem;host=db;port=3306','fhemuser',...) failed: Unknown MySQL server host 'db' (-5) at ./FHEM/93_DbLog.pm line 3287.

     PACKAGE    main
     READINGCOL 64
     TC         current
     TH         history
     TYPECOL    64
     UNITCOL    32
     VALUECOL   128
     VERSION    4.13.2
   READINGS:
     2022-11-20 22:03:59   CacheOverflowLastNum 0
     2022-11-20 22:03:59   CacheOverflowLastState normal
     2022-11-20 22:24:35   state           DBI connect('database=fhem;host=db;port=3306','fhemuser',...) failed: Unknown MySQL server host 'db' (-5) at ./FHEM/93_DbLog.pm line 3287.

Attributes:
   DbLogExclude .*

MadMax-FHEM

Warum hast du das db-Device gelöscht?

Hast du auch die DB-Daten, also Server, User, Login/PW usw. wieder beim neuen Device eingerichtet?

Das hier klingt nach "Verbindungseinstellungen falsch":
Zitat
DBI connect('database=fhem;host=db;port=3306','fhemuser',...) failed: Unknown MySQL server host 'db'

Heißt dein Datenbank Server "db"?
Und wenn ja: ist er vom "fhem-Rechner" aus erreichbar? Also was kommt bei "ping db" auf dem "fhem-Rechner" auf der Console?
Heißt dein Datenbank-User "fhemuser"?
Passt der Port?

Kann es sein, dass du aus "Hektik" usw. einfach irgendwelche Aktionen unternimmst...
...statt sinnvoll vorzugehen und auch mal Infos/Links usw. zu beachten, lesen, bewerten und umsetzen (falls sinnvoll erscheint).

EDIT: ich selbst nutze aber kein dblog. Evtl. wäre es (wie eigentlich immer) sinnvoll das im passenden Unterforum zu posten/verschieben?
Zitat von: help dblog
Module: 93_DbLog.pm Maintainer: DS_Starter Forum: Automatisierung

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)


MadMax-FHEM

FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

UweUwe

Hallo Joachim,
ja und dann?


Mein RPI3 habe ich 2019 installiert und ich bin bin der Funktionalität, Performance etc. zufrieden. Mehr brauche ich eigentlich nicht.
Probleme mit Alexa haben dazu geführt, dass ich einen Upgrade des Betriebssystem startete (Das Problem Alexa war letztendlich ein Thema von Amazon und nicht beeinflussbar).
Ein Upgrade war aber weiterhin aus meiner Sicht sinnvoll ==> Bullseye war der Name, der mir zugetragen wurde.

Ich sah 3 Säulen, die mir die Installation ermöglichen:

Otto und Joachim aus dem Forum,
meine Notizen aus 2019 bezüglich der meiner individuellen Installation.

Bullseye und FHEM bekam ich mit Hilfe von Ottos Anweisungen hin. Technik-Blog
Alexa klappte nach starker Unterstützung von Joachim auch.

==> aktuell fahre ich jetzt das Bullseye System schon als Produktionsystem mit einigen Einschränken.
Diese Einschränkungen möchte ich lösen, Zuerst das Datenbankproblem!

Hier mein Vorgehen aus 2019 zur installation von mariaDB, das ich eigentlich wiederholen wollte:

(1) sudo apt-get install mysql-server mysql-client
(2) sudo apt-get install libdbi-perl libclass-dbi-mysql-perl
(3) sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
(4) sudo mysql -u root -p



schon beim ersten Befehl (1)  fällt man auf die Nase:

sudo apt-get install mysql-server mysql-client
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut... Fertig
Statusinformationen werden eingelesen... Fertig
Paket mysql-client ist nicht verfügbar, wird aber von einem anderen Paket
referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
wurde oder nur aus einer anderen Quelle verfügbar ist.
Doch die folgenden Pakete ersetzen es:
  mariadb-client-10.0

Paket mysql-server ist nicht verfügbar, wird aber von einem anderen Paket
referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
wurde oder nur aus einer anderen Quelle verfügbar ist.
Doch die folgenden Pakete ersetzen es:
  mariadb-server-10.0

E: Für Paket »mysql-server« existiert kein Installationskandidat.
E: Für Paket »mysql-client« existiert kein Installationskandidat.


Ob ich jetzt weitermachen kann oder nicht, das ist mir unklar. Ich mache weiter:

Die nächste Installation verläuft problemlos (2)

Mit dem nächsten Befehl (3) kommentiere ich aus der Datei 50-server.cnf die Anweisung #bind-address = 127.0.0.1 raus

Mit (4) wird die Datenbank erstmals geöffnet. Ein Passwort wird abgefragt, das ich nicht kenne. In 2019 habe ich mir notiert, dass ich kein Passwort eingeben muss ("return").

Spätestens hier ist für mich Schluss mit der Installation. Es folgt ja jetzt die Definition der Datenbank (z.B. Passwort) und die Vergabe von Rechten.

Könnt ihr mir bitte helfen , wo ich hier falsch laufe?

Merci




Meine Datenbank streubt sich erheblich und da weiss ich keinen Weg mehr weiter.




Wernieman

Die Packet-Namen haben sich geädert und im Thread steht sogar schon, welche es jetzt sind.

Sorry aber Dir wurden einige Lösungen präsentiert, welche Du nicht gelesen/reagiert hast.
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Hallo Werniemann,

Sorry aber Dir wurden einige Lösungen präsentiert, welche Du nicht gelesen/reagiert hast.

Das ist inkorrekt und ich verstehe nicht, wie du darauf kommst.  Wie soll ich erkennen, dass sich der Paketname geändert hat?
Ich weiss, dass dies ein Linux Thema ist und kein FHEM spezifisches Thema.


Kannst du mir bitte die entsprechende Anweisung für die Installation des neuen Pakets nennen:

Muss ich
sudo apt-get install mysql-server mysql-client
ersetzen durch

sudo apt-get install  mariadb-server-10.0 mysql-client

Und den Rest nochmals in identischer Weise weiterfahren?

also:

 (2) sudo apt-get install libdbi-perl libclass-dbi-mysql-perl
(3) sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
(4) sudo mysql -u root -p







bartman121

Ich hab das jetzt nur überflogen.....

Du nutzt evtl. Auch config-db mit einem Backup der cobfigdb vom alten system?

Wenn ja, dann ist die db.conf vom alten system in der Datenbank drin, egal was du physisch ins File schreibst, er nimmt die Werte aus der Datenbank (also die alten)


Um die Werte aus der db.conf einzulesen musst du folgendes in der fhem-kommandozeile eingeben:
configdb fileimport ./db.conf

Gilt aber halt nur für config-db.

Wernieman

Mit dem 2. Befehl hast Du nur mysql-Server auf eine bestimmte Version "festgenagelt". Was Du jetzt installiert hast, kannst Du ermitteln mit:
dpkg -l | grep -i -e mysql -e mariadb
Um es jetzt mal richtig zu machen:
- Du hast einen mysql/mariadb-SQL-Server installiert?
- Der direkte Zugriff (von der Console) mit z.B. mysql funktioniert?
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Hallo bartman 121,
ne, ich möchte die alten Werte aktuell erst mal nicht übernehmen.
Danke für die Antwort und Ratschlag.

Hallo Werniemam,

danke für den Hinweis mit dfer Version.

Wenn ich es richtig verstehe, so muss der korrekte Befehl lauten:

sudo apt-get install  mariadb-server mysql-client

Zu deinen Fragen:

Um es jetzt mal richtig zu machen:
- Du hast einen mysql/mariadb-SQL-Server installiert?
- Der direkte Zugriff (von der Console) mit z.B. mysql funktioniert?


Ich bin gerade da hängengebnlieben, wie ich es beschrieben habe.
Meine Notizen funktionierten leider nicht mehr..

Für mich wäre der nächste Schritt:

sudo apt-get install  mariadb-server mysql-client


Wernieman

Wobei anstatt mysql-client müste auch mariadb-client gehen ... aber ich installiere auch immer die mysql-Client-Lösung.

Gibt es Fehler, wenn Du es ausführst? Wenn ja welche, wenn nein, kannst Du Dich mit dem mysql-Client verbinden (Noch nicht mit FHEM)
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Hallo Wernieman,

vielen Dank für die Unterstützung.

Ich habe jetzt folgende Installation gemacht:

sudo apt-get install  mariadb-server mariadb-client


==> es ist kein Fehler aufgetreten. Die

/etc/mysql/mariadb.conf.d/50-server.cnf

habe ich beibehalten. Also mit dem Eintrag:
#bind-address = 127.0.0.1

sudo mysql -u root -p lies mich ohne Passwort in die Datenbank, Modifikationen hab ich keine gemacht, sondern mit exit verlassen.

Mit Heidisql vom Windows-PC habe ich Zugriff auf die Datenbank und dort gibt es schon die FHEM Datenbank, neben den 3 standardmässig vorhandenen Datenbanken .

*****************  Ende deiner Fragen und Hinweise *************

Und wie geht es weiter?
Es gibt da noch die Konfiguration des mariaDB Servers, wie ich es 2019 gemacht hatte:

§ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxxx';
§ GRANT USAGE ON *.* TO 'root'@'%' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'%' = PASSWORD( 'xxxxxx' )


Dann folgten nach Einrichtung des Datenbank noch Folgendes auf Linux Ebene:

sudo cp /opt/fhem/contrib/dblog/db.conf /opt/fhem/db.conf
sudo nano /opt/fhem/db.conf

Zeilen ändern nach
%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "xxxxxx",
);




Und dann noch in FHEM:
define DBLogging DbLog /opt/fhem/db.conf .*:.*


Kannst du dies bestätigen?


MadMax-FHEM

Zitat von: UweUwe am 21 November 2022, 23:59:06
Und wie geht es weiter?
Es gibt da noch die Konfiguration des mariaDB Servers, wie ich es 2019 gemacht hatte:

§ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxxx';
§ GRANT USAGE ON *.* TO 'root'@'%' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'%' = PASSWORD( 'xxxxxx' )


Dann folgten nach Einrichtung des Datenbank noch Folgendes auf Linux Ebene:

sudo cp /opt/fhem/contrib/dblog/db.conf /opt/fhem/db.conf
sudo nano /opt/fhem/db.conf

Zeilen ändern nach
%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "xxxxxx",
);




Und dann noch in FHEM:
define DBLogging DbLog /opt/fhem/db.conf .*:.*

Naja, wie immer bei Notizen (so mache ich das zumindest): die sind eine gute Stütze nichts zu vergessen.
Aber (meist) ist seit Erstellung der Notizen einige Zeit ins Land gegangen und da ändert sich schon mal wss (noch dazu, wenn man sogar eine neue OS-Version drunter hebt).

Daher einfach blind die Befehle aus Notizen von vor (über) 3 Jahren reinklopfen würde ich nie machen. Bzw. würde ich NIE einfach Befehle reinklopfen ohne zu wissen was (so in etwa) die tun und wozu die wohl sind usw.

D.h. ich schaue mir meine Notizen an, meist habe ich auch nicht nur die Schritte notiert, sondern auch wo ich die her hab und warum die benötigt wurden...

Damit begebe ich mich dann auf Inet-Suche (zunächst nat. bei den Ursprungsquellen bzw. fhem Wiki) und überprüfe die Aktualität und wenn sich was geändert hat, dann halt "in anders"...

Zum Aufbau nehme ich ja (wie du auch) ein Parallel-System, dabei werden dann auch die Notizen aktualisiert, wenn dann Schritte erfolgreich waren.
Wenn nicht, dann halt bis zu den erfolgreichen Schtitten und dann anders weiter usw.

Daher: schon mal commandref/wiki zu Rate gezogen?

https://wiki.fhem.de/wiki/DbLog
https://fhem.de/commandref_DE.html#DbLog
(da stehen auch die Voraussetzungen usw. drin)


Zitat von: UweUwe am 21 November 2022, 23:59:06
Kannst du dies bestätigen?

Hier noch mal der Hinweis, das doch im passeden Unterforum zu posten (https://forum.fhem.de/index.php/topic,130382.msg1246732.html#msg1246732):
Zitat
EDIT: ich selbst nutze aber kein dblog. Evtl. wäre es (wie eigentlich immer) sinnvoll das im passenden Unterforum zu posten/verschieben?
Zitat von: help dblog

    Module: 93_DbLog.pm Maintainer: DS_Starter Forum: Automatisierung

Weil da liest der Maintainer mit und auch Anwender, die zumindest DBLog einsetzen (ich gehöre, wie geschrieben, nicht dazu).

Viel Erfolg, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

Wernieman

Du hast nach der Installation gleich Zugriff von Deinem Windows?? Ohne Änderung der Config des Servers?

Bist Du sicher, auf en Richtigen Server zuzugreifen?

Mittlerweile wird bei einer Standardinstallation von MySQL/MariaDB NICHT mehr der Netzwerkport geöffnet, um keine Sicherheitslücke aufzureißen.

Und in Deiner Notiz richtest Du den User root mit Netzwerkzugriff ein. Aber in FHEM benutzt Du den "fhemuser" ...... root ist doof, insofern ist fhemuser besser, aber dann bitte auch DB Zugriff (und Passwort) für den fhemuser einrichten. Wie Richtest Du es in? HeidiSQL kenne ich nicht, mach so etwas immer über Konsole und mysql-Client
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Hallo Wernieman und Joachim,

da komme ich jetzt wieder einmal niccht mit. Mein Basiswissen ist hier zu gering.

ZitatBist Du sicher, auf en Richtigen Server zuzugreifen?

Ja, ich gehe sehr davion aus. Ich hab in dem Netzwerk aktuell nur einen RPI am Laufen, da ich das neue System als  Produktionsystem nutze und in meinem Testsystem keine Flashkarte mehr habe.
Auch die IP Adresse , mit der ich den RPI aus HeidiSQL anspreche, ist identisch zu der IP Adresse, mit der ich auf FHEM zugreife. Oder kann ich auf dem RPI mehrere Datenbanken haben?
Ich "übe" ja schon länger an dem DBLogging Problem herum und hab die Datenbank auch versucht mehrmals einzurichten. Ein Einrichtung war ja zumindest teilweise ok, sonst hätte ich keinen Zugriff. So meine Erklärung.


ZitatUnd in Deiner Notiz richtest Du den User root mit Netzwerkzugriff ein. Aber in FHEM benutzt Du den "fhemuser" ...... root ist doof, insofern ist fhemuser besser, aber dann bitte auch DB Zugriff (und Passwort) für den fhemuser einrichten. Wie Richtest Du es in? HeidiSQL kenne ich nicht, mach so etwas immer über Konsole und mysql-Client

Hier könnte meine Problem begraben sein, meinst du diesen Abschnitt:

Zitat§ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxxx';
         § GRANT USAGE ON *.* TO 'root'@'%' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'%' = PASSWORD( 'xxxxxx' )

Dies müsste also so aussehen:

§ GRANT ALL PRIVILEGES ON *.* TO 'fhemuser'@'%' IDENTIFIED BY 'xxxxxx';
§ GRANT USAGE ON *.* TO 'fhemuser'@'%' WITH GRANT OPTION;
SET PASSWORD FOR 'fhemuser'@'%' = PASSWORD( 'xxxxxx' )


Ich nehme an, dass ich in einem meiner Versuche dem root schon die Rechte gegeben habe. Kann ich jetzt dem fhemuser trotzdem alle Rechte zusätzlich geben?

Zitat
Mittlerweile wird bei einer Standardinstallation von MySQL/MariaDB NICHT mehr der Netzwerkport geöffnet, um keine Sicherheitslücke aufzureißen.


Aus diesem Hinweis kann ich keine Aktion meinerseits entwickeln. Muss ich hier was unternehmen?




Wernieman

GRANT USAGE ON *.* TO 'fhemuser'@'%' WITH GRANT OPTION;
Willst Du wirklich dem fhemuser Zugriff auf den Kompletten DB-Server geben? Eigentlich giebt man hier nur die Entsprchende DB ein, also z.B. FhemDB.* anstatt *.*
Bitte FhemDB passend anpassen.

Oder kann ich auf dem RPI mehrere Datenbanken haben?
Ja, wenn sie alle auf einen anderen Port laufen. Was hast Du denn bisher "rumgespielt"?

bzw. was sagt:
dpkg -l | grep -i -e mysql -e mariadb
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Zitatbzw. was sagt:

pi@Vagabundi02:~ $ dpkg -l | grep -i -e mysql -e mariadb
ii  libclass-dbi-mysql-perl                              1.00-4.1                              all          extensions to Class::DBI for MySQL
ii  libdbd-mysql:armhf                                   0.9.0-9                               armhf        MySQL database server driver for libdbi
ii  libdbd-mysql-perl:armhf                              4.050-3+b1                            armhf        Perl5 database interface to the MariaDB/MySQL database
ii  libmariadb3:armhf                                    1:10.5.15-0+deb11u1                   armhf        MariaDB database client library
ii  libtime-piece-mysql-perl                             0.06-2.1                              all          module adding MySQL-specific methods to Time::Piece
ii  mariadb-client                                       1:10.5.15-0+deb11u1                   all          MariaDB database client (metapackage depending on the latest version)
rc  mariadb-client-10.0                                  10.0.28-2+b1                          armhf        MariaDB database client binaries
ii  mariadb-client-10.5                                  1:10.5.15-0+deb11u1                   armhf        MariaDB database client binaries
ii  mariadb-client-core-10.5                             1:10.5.15-0+deb11u1                   armhf        MariaDB database core client binaries
ii  mariadb-common                                       1:10.5.15-0+deb11u1                   all          MariaDB common configuration files
ii  mariadb-server                                       1:10.5.15-0+deb11u1                   all          MariaDB database server (metapackage depending on the latest version)
rc  mariadb-server-10.0                                  10.0.28-2+b1                          armhf        MariaDB database server binaries
ii  mariadb-server-10.5                                  1:10.5.15-0+deb11u1                   armhf        MariaDB database server binaries
ii  mariadb-server-core-10.5                             1:10.5.15-0+deb11u1                   armhf        MariaDB database core server files
ii  mysql-common                                         5.8+1.0.7                             all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  php-mysql                                            2:7.4+76                              all          MySQL module for PHP [default]
ii  php7.4-mysql                                         7.4.30-1+deb11u1                      armhf        MySQL module for PHP


ZitatJa, wenn sie alle auf einen anderen Port laufen. Was hast Du denn bisher "rumgespielt"?

Ich hab versucht die Datenbank gemäass meinen Notizen zu erstellen und einzurichten, so wie es weiter oben beschrieben habe.
IM DBLog commandref habe ich noch folgenden Hinweis entdeckt:

Emblem-question-yellow.svgAnmerkung: MariaDB10 nutzt nicht Port 3306 sondern 3307. Dies ist zum Beispiel bei Synology NAS der Fall.
Ich hab bisher immPort 3306 verwendet. Da hier 3307 angezogen wird, muss ich dies ändern in :

%dbconfig= (
    connection => "mysql:database=fhem;host=db;port=3307",
    user => "fhemuser",
    password => "fhempassword",
);


ZitatWillst Du wirklich dem fhemuser Zugriff auf den Kompletten DB-Server geben? Eigentlich giebt man hier nur die Entsprchende DB ein, also z.B. FhemDB.* anstatt *.*

Da ich sonst nichts auf dem Raspberry laufen haben, als FHEM, so macht es keinen Unterschied. In der Datenbank gibt es nur FHEM Daten. Die eigentliche Erklärung lautet: Ich wusste es nicht besser.

In Heidisql sehe ich in der Datenbank 4 Rubriken: FHEM des Vagabundi02 (mit den Untergruppierungen "current" und "history" , information_schema, mysql, perfomance_shema.

Wie hieße dies dann für meinem Fall:

GRANT USAGE ON "FHEM des Vagabundi02".* TO 'fhemuser'@'%' WITH GRANT OPTION

==> da hab ich mit den "" mein Thema.



UweUwe

Vorab:

Mit Heidisql hab ich Zugriff auf meine Datenbank mit Namen "fhem" und den 3 Standarddatenbanken.
Ich verwende dafür den user "fhemuser" und das Passwort "passwort"

Ich möchte versuchen mein Problem db / mysql beginnend mit dem Ende , der Definition in FHEM  darstellen;

Bei der Definition des devices in FHEM mit:

define DBLogging DbLog /opt/fhem/db.conf .*:.*
bekomme ich die Fehlermeldung:
could not read connection

Die Datenbank kann ich öffnen :

pi@Vagabundi02:~ $ sudo mysql -u fhemuser -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 116
Server version: 10.5.15-MariaDB-0+deb11u1 Raspbian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit


Die config.db sieht an der entscheidenden Stelle folgendermassen aus:

#%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3307",
    user => "fhemuser",
    password => "Passwort",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);


möglicherweise hab ich die Rechte innerhalb mariadb falsch/nicht vergeben.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Passwort';
set password for 'root'@'%' = PASSWORD( 'Passwort );


Beim 2. Kommando : "set passwort ..." komme ich in mariadb in ein Untermenue, in dem ich mich nicht auskenne.

Kann man mir hier jemand tips geben?

Vielen Dank





MadMax-FHEM

Hast du das Wiki bzw. commandref (hatte ich ja verlinkt) mal gelesen?

Gibt es die Datei /opt/fhem/db.conf?
Wie sind die Rechte?
Was steht drin?
EDIT:
Zitat von: commandref
Für die Verbindung zur Datenbank wird eine Konfigurationsdatei verwendet. Die Konfiguration ist in einer sparaten Datei abgelegt um das Datenbankpasswort nicht in Klartext in der FHEM-Haupt-Konfigurationsdatei speichern zu müssen. Ansonsten wäre es mittels des list Befehls einfach auslesbar.

Die Konfigurationsdatei wird z.B. nach /opt/fhem kopiert und hat folgenden Aufbau, den man an seine Umgebung anpassen muß (entsprechende Zeilen entkommentieren und anpassen):
usw.

Und (hatte ich auch schon mehrfach genannt) ich würde das ja ins passende Unterforum verschieben...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

Wernieman

Mit dem lokalen mysql-Kommando gehst Du auf die Datnbank nicht mit Netzwerk, sondern mit Socket-Konnektion. Mir ist immer noch nicht klar, wie Deine DB läuft.

Kannst DU mal als root (oder sudo) uns geben:
netstat -lntp
ss -tulpe


Das 2. ist, falls netstat nicht auf dem Pi installiert ist.

Ansonsten bitte den Beitrag von Joachim beachten ....
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

UweUwe

Hallo Joachim und Wernieman,
danke für eure Antworten, möchte mal versuchen, die Informationen beizubringen!


ZitatGibt es die Datei /opt/fhem/db.conf?

pi@Vagabundi02:/opt/fhem $ dir
AlarmFILE                backup       contrib  docs      fhem.cfg.demo  lescan.sh  MAINTAINER.txt   unused
alexa-fhem.cfg           CHANGED      db.conf  FHEM      fhem.pl        lib        README_DEMO.txt  www
alexa-fhem.cfg.previous  configDB.pm  demolog  fhem.cfg  GPL_V2.txt     log        restoreDir


==> es gibt die Datei db.conf

ZitatWie sind die Rechte?

pi@Vagabundi02:/opt/fhem $ ls -al db.conf
-rw-r--r-- 1 fhem dialout 2164 22. Nov 23:02 db.conf


Zitatwas steht drin:

pi@Vagabundi02:/opt/fhem $ cat db.conf
O
####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
#%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3307",
    user => "fhemuser",
    password => "Passwort",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################
pi@Vagabundi02:/opt/fhem $


ZitatHast du das Wiki bzw. commandref (hatte ich ja verlinkt) mal gelesen?

Ich, und ich habe dort auch den neuen Port 3307 gefunden ! Ich sage nicht, dass ich alles verstanden habe.

pi@Vagabundi02:/opt/fhem $ sudo netstat -lntp
Aktive Internetverbindungen (Nur Server)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      667/postgres
tcp        0      0 127.0.0.1:38219         0.0.0.0:*               LISTEN      28444/perl
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      562/sshd: /usr/sbin
tcp        0      0 127.0.0.1:40889         0.0.0.0:*               LISTEN      28449/node /usr/loc
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1375/exim4
tcp        0      0 0.0.0.0:8083            0.0.0.0:*               LISTEN      28444/perl
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      849/cupsd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1375/exim4
tcp6       0      0 ::1:631                 :::*                    LISTEN      849/cupsd
tcp6       0      0 :::3306                 :::*                    LISTEN      30582/mariadbd
tcp6       0      0 :::22                   :::*                    LISTEN      562/sshd: /usr/sbin
tcp6       0      0 :::80                   :::*                    LISTEN      875/apache2
tcp6       0      0 ::1:5432                :::*                    LISTEN      667/postgres
pi@Vagabundi02:/opt/fhem $



pi@Vagabundi02:/opt/fhem $ sudo ss -tulpe
Netid       State        Recv-Q       Send-Q             Local Address:Port                     Peer Address:Port       Process
udp         UNCONN       0            0                        0.0.0.0:mdns                          0.0.0.0:*           users:(("avahi-daemon",pid=360,fd=12))
udp         UNCONN       0            0                        0.0.0.0:35575                         0.0.0.0:*           users:(("avahi-daemon",pid=360,fd=14))
udp         UNCONN       0            0                        0.0.0.0:bootpc                        0.0.0.0:*           users:(("dhcpcd",pid=478,fd=13))
udp         UNCONN       0            0                        0.0.0.0:631                           0.0.0.0:*           users:(("cups-browsed",pid=853,fd=7))
udp         UNCONN       0            0                              *:mdns                                *:*           users:(("avahi-daemon",pid=360,fd=13))
udp         UNCONN       0            0                              *:34427                               *:*           users:(("avahi-daemon",pid=360,fd=15))
tcp         LISTEN       0            32                     127.0.0.1:38219                         0.0.0.0:*           users:(("perl",pid=28444,fd=25)) uid:999 ino:1846200 sk:1 cgroup:/system.slice/fhem.service <->
tcp         LISTEN       0            32                       0.0.0.0:8083                          0.0.0.0:*           users:(("perl",pid=28444,fd=5)) uid:999 ino:1846188 sk:2 cgroup:/system.slice/fhem.service <->
tcp         LISTEN       0            128                      0.0.0.0:ssh                           0.0.0.0:*           users:(("sshd",pid=562,fd=3)) ino:8170 sk:3 cgroup:/system.slice/ssh.service <->
tcp         LISTEN       0            128                    127.0.0.1:ipp                           0.0.0.0:*           users:(("cupsd",pid=849,fd=7)) ino:1907039 sk:4 cgroup:/system.slice/cups.service <->
tcp         LISTEN       0            244                    127.0.0.1:postgresql                    0.0.0.0:*           users:(("postgres",pid=667,fd=6)) uid:118 ino:14495 sk:5 cgroup:/system.slice/system-postgresql.slice/postgresql@13-main.service <->
tcp         LISTEN       0            511                    127.0.0.1:40889                         0.0.0.0:*           users:(("node",pid=28449,fd=18)) uid:999 ino:1848425 sk:6 cgroup:/system.slice/fhem.service <->
tcp         LISTEN       0            20                     127.0.0.1:smtp                          0.0.0.0:*           users:(("exim4",pid=1375,fd=4)) ino:14257 sk:7 cgroup:/system.slice/exim4.service <->
tcp         LISTEN       0            80                             *:mysql                               *:*           users:(("mariadbd",pid=30582,fd=17)) uid:116 ino:1872088 sk:8 cgroup:/system.slice/mariadb.service v6only:0 <->
tcp         LISTEN       0            511                            *:http                                *:*           users:(("/usr/sbin/apach",pid=1472,fd=4),("/usr/sbin/apach",pid=879,fd=4),("/usr/sbin/apach",pid=878,fd=4),("/usr/sbin/apach",pid=877,fd=4),("/usr/sbin/apach",pid=876,fd=4),("/usr/sbin/apach",pid=875,fd=4)) ino:12915 sk:9 cgroup:/system.slice/apache2.service v6only:0 <->
tcp         LISTEN       0            128                         [::]:ssh                              [::]:*           users:(("sshd",pid=562,fd=4)) ino:8180 sk:a cgroup:/system.slice/ssh.service v6only:1 <->
tcp         LISTEN       0            128                        [::1]:ipp                              [::]:*           users:(("cupsd",pid=849,fd=6)) ino:1907038 sk:b cgroup:/system.slice/cups.service v6only:1 <->
tcp         LISTEN       0            244                        [::1]:postgresql                       [::]:*           users:(("postgres",pid=667,fd=5)) uid:118 ino:14494 sk:c cgroup:/system.slice/system-postgresql.slice/postgresql@13-main.service v6only:1 <->
tcp         LISTEN       0            20                         [::1]:smtp                             [::]:*           users:(("exim4",pid=1375,fd=5)) ino:14258 sk:d cgroup:/system.slice/exim4.service v6only:1 <->



UweUwe

Hallo,

da gibt es noch eine weitere Konfigurationsdatei fpr mariaDB, die man modifizieren mus:
Hier der Inhalt:

pi@Vagabundi02:/opt/fhem $ cat /etc/mysql/mariadb.conf.d/50-server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address          = 127.0.0.1

#
# * Fine Tuning
#
key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file    = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit    = 1000
#log_slow_verbosity     = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size   = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ssl-cipher=TLSv1.2


#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.0]


==> diese Zeile muss man auskommentieren:

# bind-address          = 127.0.0.1

==> hab ich gemacht.

==> jetzt versiuche ich in das richtige Forum umzuziehen.



UweUwe

Ich habe den Moderator gebeten, das Thema nach Automatisierung zu verschieben. Ich selbst kann dies wohl nicht erledigen.


CoolTux

Deine Datenbank lauscht wohl auf 3306 wenn ich das richtig lese.

Du kannst auch verschieben. Ganz unten links müsste der Knopf dafür sein.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

UweUwe

Hallo Cooltux,

hab mal versucht den Port auf 3306 zu ändern. Hab dasselbe Thema:

could not read connection

wenn ich das device in FHEM spezifiziere mit:

define DBLogging DbLog /opt/fhem/db.conf .*:.*

Die geänderte Datei (Port 3306) lautet:
pi@Vagabundi02:~ $ pi@Vagabundi02:~ $ cat /opt/fhem/db.conf
O
####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
#%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "Passwort",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################
pi@Vagabundi02:~ $







CoolTux

Bitte schau einmal was in der /etc/mysql/my.cnf drin steht. Da sollte ja auch der Port stehen. Per default ist es immer 3306

Dann musst Du eine bind-adresse angeben

bind-address = 0.0.0.0

für remote Zugriff aus allen Netzen.

testen dann mit

mysql -u root -p -h 127.0.0.1 -P 3306

direkt auf dem FHEM Server
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

UweUwe

Hallo Cooltux,

das geht mir zu schnell, sorry.

Ich will mal darstellen, was ich verstanden habe:

Die bind adress finde ich nur in dieser Konfigurationsdatei:

pi@Vagabundi02:~ $ cat /etc/mysql/mariadb.conf.d/50-server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address          = 127.0.0.1

#
# * Fine Tuning
#
key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file    = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit    = 1000
#log_slow_verbosity     = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size   = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ssl-cipher=TLSv1.2


#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.0]
pi@Vagabundi02:~ $ cat /etc/mysql/mariadb.conf.d/50-server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address          = 127.0.0.1

#
# * Fine Tuning
#
key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file    = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit    = 1000
#log_slow_verbosity     = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size   = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ssl-cipher=TLSv1.2


#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.0]


Da bin ich angewiesen worden , die bind adress zu kommentieren.
Du sagst, ich mus hier

bind-address = 0.0.0.0

einfügen. Korrekt? Den Port auf 3306 belassen.

Was bedeutet "direkt auf dem FHEM Server?
Nicht aus FHEM, nehme ich an, sondern auf dem RPI.

wenn ich das Kommando jetzt  absetze (modifiziert auf "fhemuser" und ohne deine vorgeschlagene Änderung,  so bekomme ich :

pi@Vagabundi02:~ $ mysql -u fhemuser -p -h 127.0.0.1 -P 3306
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 695
Server version: 10.5.15-MariaDB-0+deb11u1 Raspbian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>


Wenn ich dein Kommando absetze, also mit root, so kenne ich das abgesetzte Passwort nicht.

pi@Vagabundi02:~ $ mysql -u root -p -h 127.0.0.1 -P 3306
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'



CoolTux

Ok das funktioniert also.
root war hier nur exemplarisch. Du hast also Zugriff über Netzwerk auf Deine mysql Datenbank.

nächster schritt

cat /opt/fhem/db.conf

hier hast Du ja


####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
#%dbconfig= (                          <------------------------  Schau mal da steht ein # am Anfang das muss da weg
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "Passwort",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################


Du bist Dir aber auch sicher das Du auf dem alten System mit configdb gearbeitet hast, ja?

Es scheint in der Konfig einen kleinen Fehler zu geben. Habe versucht das zu makieren
#%dbconfig= (
das # ist zu viel.

Wenn Du das richtig hast und fhem sagst das er mit configdb starten soll dann sollte er auch die config aus der configdb DB einlesen.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

betateilchen

Zitat von: CoolTux am 23 November 2022, 14:59:21
Du bist Dir aber auch sicher das Du auf dem alten System mit configdb gearbeitet hast, ja?

Es scheint in der Konfig einen kleinen Fehler zu geben. Habe versucht das zu makieren

Wenn Du das richtig hast und fhem sagst das er mit configdb starten soll dann sollte er auch die config aus der configdb DB einlesen.

Wenn vorher wirklich configDB im Einsatz war, ist es völlig wurscht, ob die genannten Zeile auskommentiert ist oder nicht.
Dann ist ausschließlich wichtig, was in /opt/fhem/configDB.conf als Verbindungsparameter steht.

Die Konfigurationsdatei für die Datenbank wird nämlich in dem Fall aus der configDB gelesen.

Das hatte bartman121 vor zwei Tagen schon hier im Thread geschrieben.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

Hallo Cooltux,
danke für deine Antwort.

Ich hab jetzt das "Kommentarzeichen" entfernt. Toll , dass du es gesehen hast.
$ cat /opt/fhem/db.conf

####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "Passwort",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################[/code]

In FHEM hab ich leider immer noch denselben Fehler

could not read connection

Ich habe deinen Hinweis mit der
bind-address = 0.0.0.0 noch nicht umgesetzt, weil ich nicht weiss, ob ich dies jetzt an der entsprechenden Stelle einsetzen soll oder nicht.
Kannst du mir bitte hier noch weitere Hinweise geben?

Vielen Dank

UweUwe

Hallo Betateilchen,

ZitatWenn vorher wirklich configDB im Einsatz war, ist es völlig wurscht, ob die genannten Zeile auskommentiert ist oder nicht.
Dann ist ausschließlich wichtig, was in /opt/fhem/configDB.conf als Verbindungsparameter steht.

Zur Erklärung: ich habe ein neues System auf Basis Bullseye hochgezogen und die neueste Version von FHEM benutzt.
Ich habe meinen Backup von FHEM verwendet.
In meinem alten System war die Definition der Datenbank so:

define DBLogging DbLog /opt/fhem/db.conf .*:.*

Ich habe noch nicht verstanden, was ich jetzt noch versuchen könnte?


betateilchen

Zitat von: UweUwe am 23 November 2022, 15:41:11
Ich habe deinen Hinweis mit der
bind-address = 0.0.0.0 noch nicht umgesetzt, weil ich nicht weiss, ob ich dies jetzt an der entsprechenden Stelle einsetzen soll oder nicht.
Kannst du mir bitte hier noch weitere Hinweise geben?

Mach doch einfach mal - schlimmer kann es ja nicht mehr werden.

Zitat von: UweUwe am 23 November 2022, 15:41:11
Ich hab jetzt das "Kommentarzeichen" entfernt. Toll , dass du es gesehen hast.
$ cat /opt/fhem/db.conf

Wenn hier wirklich auch noch configDB im Spiel ist, kannst Du die Datei auch auf Papier ausdrucken und an die Wand hängen, es wird nix nützen.

Zitat von: UweUwe am 23 November 2022, 15:41:11
In FHEM hab ich leider immer noch denselben Fehler

could not read connection

Diese Meldung wird nur ausgegeben, wenn das Konfigurationsfile für DbLog zwar gelesen werden kann, aber darin keine Verbindungsinformationen gefunden werden.
Zum Beispiel, weil Du zwar eine Datei bearbeitest, aber das gar nicht die Datei ist, die FHEM gerne lesen möchte.
Oder wenn die Verbindungsinformationen immer noch auskommentiert sind.

  return "could not read connection" if (!defined $dbconfig{connection});
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

betateilchen

Zitat von: UweUwe am 23 November 2022, 15:50:59
Ich habe noch nicht verstanden, was ich jetzt noch versuchen könnte?

Zum Beispiel endlich die Frage bezüglich configDB tatsächlich beantworten?
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

betateilchen

-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

Hallo betateilchen:

Zum Beispiel endlich die Frage bezüglich configDB tatsächlich beantworten?

Ich habe mir vor 3 Jahren Notizen gemacht und die notwenigen Modifikationen von db.conf  so in meinen Notizen gefunden.

%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "aufReisen",
);


Ich vermute, dass dies deine Frage beantwortet. Ich kann nichts anderes sagen..

Wissen wir eigentlich schon, wie Du Dein FHEM startest?

FHEM startet bei mir, sobald der RPI hochfährt. Ich habe dazu kein eigenes Kommando.  Hab gerade nochmals ein shutdown restart gemacht von FHEM.
Das ändert auch nichts .






MadMax-FHEM

Zitat von: betateilchen am 23 November 2022, 15:59:00
Wissen wir eigentlich schon, wie Du Dein FHEM startest?

Das define was immer rumschwirrt ist doch für Logging in DB?

Zitat von: UweUwe"
define DBLogging DbLog /opt/fhem/db.conf .*:.*

https://wiki.fhem.de/wiki/DbLog#Konfiguration_als_Device

ConfigDB ist doch eine andere (evtl. zusätzliche?) Baustelle:
https://fhem.de/commandref.html#configDB

Und muss doch (auch) beim Starten angegeben werden?

(oder liege ich falsch?)

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

betateilchen

Zitat von: MadMax-FHEM am 23 November 2022, 16:33:56
Das define was immer rumschwirrt ist doch für Logging in DB?

Natürlich. Und das funktioniert sogar. Die Konfigurationsdatei wird erfolgreich gelesen.

Aber WENN vorher configDB im Einsatz war und jetzt FHEM auch mit configDB startet, wird die Konfigurationsdatei für DbLog NICHT aus dem Filesystem gelesen, sondern aus der Datenbank. Deshalb ist es völlig wurscht, ob in der Datei im Filesystem irgendwas auskommentiert ist oder nicht - man könnte die Datei auch löschen.

Zitat von: UweUwe am 23 November 2022, 16:31:35
Ich vermute, dass dies deine Frage beantwortet.

Nein tut es nicht.

Zitat von: UweUwe am 23 November 2022, 16:31:35
Wissen wir eigentlich schon, wie Du Dein FHEM startest?

FHEM startet bei mir, sobald der RPI hochfährt. Ich habe dazu kein eigenes Kommando.

Mit solchen Antworten kommen wir auch in zwei Jahren nicht weiter.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

Sorry Betateilchen,

ich kann nur gemäss meiner Wissensbasis antworten. Du kannst jetzt sagen, dass ich zu unwissend für FHEM bin, dann muss ich eindach aufhören.
Ich habe wirklich keine andere Chance. Ich tue mein Möglichstes.

Deinen Vorschlag :
bind-address = 0.0.0.0

hab ich umgesetzt, da bekomme ich dieselbe Fehlermeldung bei der Definition des devices in FHEM.
Ich hoffe auf weiteren Support.

UweUwe

Hallo betateilchen

im Logfile sehe ich noch folgende Fehlermeldung:

2022.11.23 16:49:32 1: DbLog DBLogging - Error while reading /opt/fhem/db.conf: 'could not read connection'
2022.11.23 16:49:32 1: define DBLogging DbLog /opt/fhem/db.conf .*:.*: could not read connection


die db.conf sieht folgendermassen aus:

pi@Vagabundi02:~ $ cat  /opt/fhem/db.conf
O
####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "Passwort",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################

betateilchen

Du verstehst einfach die Antworten nicht, die man Dir gibt - oder Du liest sie nicht vollständig.

Ok. Wir versuchen es anders. EINE Frage = EINE Antwort.

Was liefert cat /etc/systemd/system/fhem.service ?
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

betateilchen

Zitat von: UweUwe am 23 November 2022, 16:58:26
Hallo betateilchen

im Logfile sehe ich noch folgende Fehlermeldung:

Im Moment völlig irrelevant.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

pi@Vagabundi02:~ $ cat /etc/systemd/system/fhem.service
# $Id: fhem.service 19235 2019-04-21 13:26:17Z betateilchen $

[Unit]
Description=FHEM Home Automation
Wants=network.target
After=network.target
#Requires=postgresql.service
#After=postgresql.service
#Requires=mysql.service
#After=mysql.service

[Service]
Type=forking
User=fhem
Group=dialout
WorkingDirectory=/opt/fhem
ExecStart=/usr/bin/perl fhem.pl fhem.cfg
#ExecStart=/usr/bin/perl fhem.pl configDB
Restart=always

[Install]
WantedBy=multi-user.target

betateilchen

-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

Hier die Antwort:

pi@Vagabundi02:~ $ sudo service fhem status
● fhem.service - FHEM Home Automation
     Loaded: loaded (/etc/systemd/system/fhem.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-11-23 16:26:56 CET; 44min ago
    Process: 3754 ExecStart=/usr/bin/perl fhem.pl fhem.cfg (code=exited, status=0/SUCCESS)
   Main PID: 3756 (perl)
      Tasks: 13 (limit: 1596)
        CPU: 51.251s
     CGroup: /system.slice/fhem.service
             ├─3756 /usr/bin/perl fhem.pl fhem.cfg
             ├─3762 node /usr/local/bin/alexa-fhem -c ./alexa-fhem.cfg -a xx:xx
             └─3781 /usr/bin/ssh -R 1234:127.0.0.1:46331 -oServerAliveInterval=90 -i /opt/fhem/.ssh/id_rsa -p 58824 fhe>

Nov 23 17:09:12 Vagabundi02 sudo[5477]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=999)
Nov 23 17:09:23 Vagabundi02 sudo[5477]: pam_unix(sudo:session): session closed for user root
Nov 23 17:09:53 Vagabundi02 sudo[5496]:     fhem : PWD=/opt/fhem ; USER=root ; COMMAND=/opt/fhem/lescan.sh 7C:2F:80:D1:>
Nov 23 17:09:53 Vagabundi02 sudo[5496]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=999)
Nov 23 17:10:04 Vagabundi02 sudo[5496]: pam_unix(sudo:session): session closed for user root
Nov 23 17:10:34 Vagabundi02 sudo[5525]:     fhem : PWD=/opt/fhem ; USER=root ; COMMAND=/opt/fhem/lescan.sh 7C:2F:80:D1:>
Nov 23 17:10:34 Vagabundi02 sudo[5525]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=999)
Nov 23 17:10:45 Vagabundi02 sudo[5525]: pam_unix(sudo:session): session closed for user root
Nov 23 17:11:16 Vagabundi02 sudo[5549]:     fhem : PWD=/opt/fhem ; USER=root ; COMMAND=/opt/fhem/lescan.sh 7C:2F:80:D1:>
Nov 23 17:11:16 Vagabundi02 sudo[5549]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=999)

betateilchen

-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

pi@Vagabundi02:~ $ cat /opt/fhem/fhem.cfg | grep DbLog
attr global userattr DbLogExclude DbLogInclude DbLogValueFn:textField-long alarmDevice:Actor,Sensor alarmSettings alexaName alexaProactiveEvents:1,0 alexaRoom cmdIcon devStateIcon:textField-long devStateStyle genericDeviceType:security,ignore,switch,outlet,light,blind,thermometer,thermostat,contact,garage,window,lock,scene homebridgeMapping:textField-long icon msgContactAudio msgContactLight msgContactMail msgContactPush msgContactScreen msgParams msgPriority msgRecipient msgRecipientAudio msgRecipientLight msgRecipientMail msgRecipientPush msgRecipientScreen msgRecipientText msgTitle msgTitleShrt msgType:text,push,mail,screen,light,audio,queue sortby webCmd webCmdLabel:textField-long widgetOverride
attr global DbLogExclude .*
attr WEB DbLogExclude .*
attr Logfile DbLogExclude .*
attr autocreate DbLogExclude .*
attr eventTypes DbLogExclude .*
attr initialUsbCheck DbLogExclude .*
define at_DbLoggingReduce at *03:00:00 set DBLogging reduceLogNbl 90 average
setuuid at_DbLoggingReduce 5c770347-f33f-813e-edb1-7376c410d2058fec
attr at_DbLoggingReduce room LOGGING
attr myHmUART DbLogExclude .*
attr virtualCCU DbLogExclude .*
attr Rauchmelder_Team DbLogExclude .*
attr Taster_Wohni DbLogExclude .*
attr Rauch_Wohn DbLogExclude .*
attr Rauch_Deichsel DbLogExclude .*
attr AAA_Hand_Wohni DbLogExclude .*
attr Klima_Wohni DbLogExclude .*
attr Klima_Wohni DbLogInclude temperature,humidity,state
define n_DbLogExclude notify global:DEFINED.* attr $EVTPART1 DbLogExclude .*
setuuid n_DbLogExclude 5c7e714d-f33f-813e-9226-dd518caecabc1bb0
attr n_DbLogExclude DbLogExclude .*
attr BluetoothAnwesend DbLogExclude .*
attr N.Present_Vagabundi DbLogExclude .*
attr globalMsg DbLogExclude .*
attr pushmsg DbLogExclude .*
attr W_ReisenWeblink DbLogExclude .*
attr GPS_global_upd DbLogExclude .*
attr GPSlat_global_upd DbLogExclude .*
attr Wettervorhersage_Morgen DbLogExclude .*
attr FileLog_T_Wohni DbLogExclude .*
attr c_grep DbLogExclude .*
attr Klima_Deichsel DbLogExclude .*
attr Klima_Deichsel DbLogInclude state,humidity,temperature
attr FileLog_Klima_Deichsel DbLogExclude .*
attr SVG_DBLogging_2 DbLogExclude .*
attr FileLog_T_Wohn DbLogExclude .*
attr T_Wohni DbLogExclude .*
attr FileLog_HM_690BB9 DbLogExclude .*
attr virtualCCU_Btn2 DbLogExclude .*
attr virtualCCU_Btn3 DbLogExclude .*
attr virtualCCU_Btn4 DbLogExclude .*
attr virtualCCU_Btn5 DbLogExclude .*
attr virtualCCU_Btn6 DbLogExclude .*
attr virtualCCU_Btn7 DbLogExclude .*
attr virtualCCU_Btn8 DbLogExclude .*
attr virtualCCU_Btn9 DbLogExclude .*
attr W_Reisen DbLogExclude .*
attr GPS_notify DbLogExclude .*
attr ui DbLogExclude .*
attr 4fach DbLogExclude .*
attr FileLog_4fach DbLogExclude .*
attr ChannelFussboden DbLogExclude .*
attr ChannelWasserAussen DbLogExclude .*
attr ChannelStromAussenvorne DbLogExclude .*
attr ChannelStromAussenhinten DbLogExclude .*
attr Heizung DbLogExclude .*
attr FileLog_Heizung DbLogExclude .*
attr Heizung_Weather DbLogExclude .*
attr Heizung_Climate DbLogExclude .*
attr Heizung_WindowRec DbLogExclude .*
attr Heizung_remote DbLogExclude .*
attr Heizung_SwitchTr DbLogExclude .*
attr Motion_Vagabundi DbLogExclude .*
attr FileLog_Motion_Vagabundi DbLogExclude .*
attr Import DbLogExclude .*
attr Vaga_HeizungNachtabsenkung DbLogExclude .*
attr di_Heizung_morgens DbLogExclude .*
attr AussenWasseraus_DreiMinuten DbLogExclude .*
attr alarm0.off.N DbLogExclude .*
attr alarm0.on.N DbLogExclude .*
attr alarm0.arm.N DbLogExclude .*
attr alarm0.disarm.N DbLogExclude .*
attr alarm2.off.N DbLogExclude .*
attr alarm2.on.N DbLogExclude .*
attr alarm2.arm.N DbLogExclude .*
attr alarm2.disarm.N DbLogExclude .*
attr alexa DbLogExclude .*
define DBLogging DbLog /opt/fhem/db.conf .*:.*
attr DBLogging DbLogExclude .*
pi@Vagabundi02:~ $

betateilchen

-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

pi@Vagabundi02:~ $ cat /opt/fhem/db.conf
O
####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "aufReisen",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################
pi@Vagabundi02:~ $
pi@Vagabundi02:~ $
pi@Vagabundi02:~ $ cat /opt/fhem/db.conf
O
####################################################################################
# database configuration file
#
# NOTE:
# If you don't use a value for user / password please delete the leading hash mark
# and write 'user => ""' respectively 'password => ""' instead !
#
#
## for MySQL
####################################################################################
%dbconfig= (
    connection => "mysql:database=fhem;host=localhost;port=3306",
    user => "fhemuser",
    password => "aufReisen",
    # optional enable(1) / disable(0) UTF-8 support (at least V 4.042 is necessary)
    utf8 => 1
);
####################################################################################
#
## for PostgreSQL
####################################################################################
#%dbconfig= (
#    connection => "Pg:database=fhem;host=localhost",
#    user => "fhemuser",
#    password => "fhempassword"
#);
####################################################################################
#
## for SQLite (username and password stay empty for SQLite)
####################################################################################
#%dbconfig= (
#    connection => "SQLite:dbname=/opt/fhem/fhem.db",
#    user => "",
#    password => ""
#);
####################################################################################

betateilchen

Warum machst Du das immer zweimal?

Zitat
pi@Vagabundi02:~ $ cat /opt/fhem/db.conf
O
####################################################################################


Nimm mal das O in der ersten Zeile der Konfigurationsdatei raus.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

Hab gerade festgestellt, das in der Detei:
/opt/fhem/db.conf

in der erste Zeile ein "O" sitzen könnte. Ich mach den mal raus und versuche es nochmals.

betateilchen

-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

UweUwe

Hallo betateilchen,

der O war das Problem! Jetzt konnte ich das device definieren und es ist connected


Save config ?
ui
Alarmanlage
A-Strom
A-Wasser
ALARM
Alarm
Anwesenheit
CUL_HM
Draussen
Entwicklung
F-Heizung
GERAETE
Homematic
IPAD
LOGGING
Unsorted
Wohnraum
icoEverything Everything
Logfile
Commandref
Remote doc
Edit files
Select style
Event monitor
CodeImport

Internals:
   CFGFN     
   COLUMNS    field length used for Device: 64, Type: 64, Event: 512, Reading: 64, Value: 128, Unit: 32
   CONFIGURATION /opt/fhem/db.conf
   DEF        /opt/fhem/db.conf .*:.*
   FUUID      637e4c54-f33f-813e-b9f8-d83727bb55002b0b
   FVERSION   93_DbLog.pm:v4.13.2-s26672/2022-11-07
   MODE       synchronous
   MODEL      MYSQL
   NAME       DBLogging
   NR         258
   NTFY_ORDER 50-DBLogging
   PID        3756
   REGEXP     .*:.*
   STATE      connected
   TYPE       DbLog
   UTF8       1
   dbconn     mysql:database=fhem;host=localhost;port=3306
   dbuser     fhemuser
   eventCount 3
   HELPER:
     COLSET     1
     DEVICECOL  64
     EVENTCOL   512
     OLDSTATE   connected
     PACKAGE    main
     READINGCOL 64
     TC         current
     TH         history
     TYPECOL    64
     UNITCOL    32
     VALUECOL   128
     VERSION    4.13.2
   READINGS:
     2022-11-23 17:37:40   CacheOverflowLastNum 0
     2022-11-23 17:37:40   CacheOverflowLastState normal
     2022-11-23 17:41:01   state           connected
Attributes:
   DbLogExclude .*
   room       LOGGING



Vielen Dank für die Unterstützung..

Wernieman

- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

betateilchen

Für Deinen Notizzettel, falls Dich mal wieder jemand fragt..


  • Dein FHEM wird über systemd gestartet
  • Dein FHEM benutzt fhem.cfg, nicht configDB
  • Dein FHEM benutzt DbLog mit mysql
  • Die Konfigurationsdatei für DbLog heißt /opt/fhem/db.conf
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

betateilchen

Zitat von: Wernieman am 23 November 2022, 17:44:25
Gut das wir es lösen konnten ...

gut, dass bei meiner Problemanalyse ausnahmsweise mal keiner dazwischengequatscht hat  ;)
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!


Wernieman

Und Du hast noch eine 2. DB im  System laufen .. eine PostgreSQL db ....
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html