[GELÖST] FHEM startet ständig neu nach Neuinstallation auf RPi4

Begonnen von FFHEM, 06 November 2022, 09:55:28

Vorheriges Thema - Nächstes Thema

FFHEM

Guten Morgen zusammen,
nachdem ich nun 5 Stunden suche, wende ich mich an Euch mit der Bitte um Hilfe.
Bei der Neuinstallation von FHEM auf einem RPi4 (nach Anleitung hier im Wiki) startet FHEM nach ein paar (Milli-)Sekunden immer wieder neu.
Ich habe bereits hier nachgelesen:
https://forum.fhem.de/index.php/topic,90042.30.html
...und in /etc/systemd/system/fhem.service den Type von Type=forking auf simple gestellt, ohne Besserung.

Ich glaube nun, den Verursacher eingegrenzt zu haben, komme aber nicht weiter.
Die fhem.cfg habe ich auf folgenden Inhalt reduziert, wobei es auf das Logfile ankommt. Ist die entsprechende Zeile aktiviert, kommt es zum Fehlerfall. Ist logfile deaktiviert, funktioniert FHEM.
attr global alias global
attr global autoload_undefined_devices 1
attr global autosave 0
attr global backup_before_update 1
attr global dnsServer 192.168.178.1
attr global language DE
attr global latitude 51.17
### attr global logfile ./log/fhem-%Y-%m.log
attr global longitude 6.21
attr global modpath .
attr global motd none
attr global sendStatistics never
attr global statefile ./log/fhem.save
attr global verbose 3


define telnetPort telnet 7072 global
setuuid telnetPort 5c444fed-f33f-26cd-09df-ba40d5cd7371e3c6
attr telnetPort alias telnetPort

define WEB FHEMWEB 8083 global
setuuid WEB 5c444fed-f33f-26cd-38d8-a57ffad49d3c6278


Ein journalctl -u fhem ergibt wiederholend:
Nov 06 09:39:44 raspi4 systemd[1]: Started FHEM Home Automation.
Nov 06 09:39:49 raspi4 systemd[1]: fhem.service: Succeeded.
Nov 06 09:39:49 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 3.
Nov 06 09:39:49 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 09:39:49 raspi4 systemd[1]: Started FHEM Home Automation.
Nov 06 09:39:54 raspi4 systemd[1]: fhem.service: Succeeded.
Nov 06 09:39:54 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 4.
Nov 06 09:39:54 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 09:39:54 raspi4 systemd[1]: Started FHEM Home Automation.
Nov 06 09:39:59 raspi4 systemd[1]: fhem.service: Succeeded.
Nov 06 09:39:59 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 5.
Nov 06 09:39:59 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 09:39:59 raspi4 systemd[1]: Started FHEM Home Automation.
Nov 06 09:40:04 raspi4 systemd[1]: fhem.service: Succeeded.
Nov 06 09:40:04 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 6.
Nov 06 09:40:04 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 09:40:04 raspi4 systemd[1]: Started FHEM Home Automation.
Nov 06 09:40:09 raspi4 systemd[1]: fhem.service: Succeeded.
Nov 06 09:40:09 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 7.
Nov 06 09:40:09 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 09:40:09 raspi4 systemd[1]: Started FHEM Home Automation.
Nov 06 09:40:09 raspi4 systemd[1]: Stopping FHEM Home Automation...
Nov 06 09:40:09 raspi4 systemd[1]: fhem.service: Succeeded.
Nov 06 09:40:09 raspi4 systemd[1]: Stopped FHEM Home Automation.


Wenn das Loggen aktiviert ist, steht im Logfile so etwas:
2022.11.06 09:39:49 1: Including fhem.cfg
2022.11.06 09:39:49 3: telnetPort: port 7072 opened
2022.11.06 09:39:50 3: WEB: port 8083 opened
2022.11.06 09:39:50 1: Including ./log/fhem.save
2022.11.06 09:39:50 0: Featurelevel: 6.1
2022.11.06 09:39:50 0: Server started with 3 defined entities (fhem.pl:26635/2022-11-01 perl:5.032001 os:linux user:fhem pid:2098)
2022.11.06 09:39:54 0: Server shutdown
2022.11.06 09:39:55 1: Including fhem.cfg
2022.11.06 09:39:55 3: telnetPort: port 7072 opened
2022.11.06 09:39:55 3: WEB: port 8083 opened
2022.11.06 09:39:55 1: Including ./log/fhem.save
2022.11.06 09:39:55 0: Featurelevel: 6.1
2022.11.06 09:39:55 0: Server started with 3 defined entities (fhem.pl:26635/2022-11-01 perl:5.032001 os:linux user:fhem pid:2102)
2022.11.06 09:39:59 0: Server shutdown
2022.11.06 09:40:00 1: Including fhem.cfg
2022.11.06 09:40:00 3: telnetPort: port 7072 opened
2022.11.06 09:40:00 3: WEB: port 8083 opened
2022.11.06 09:40:00 1: Including ./log/fhem.save
2022.11.06 09:40:00 0: Featurelevel: 6.1
2022.11.06 09:40:00 0: Server started with 3 defined entities (fhem.pl:26635/2022-11-01 perl:5.032001 os:linux user:fhem pid:2107)
2022.11.06 09:40:04 0: Server shutdown
2022.11.06 09:40:05 1: Including fhem.cfg
2022.11.06 09:40:05 3: telnetPort: port 7072 opened
2022.11.06 09:40:05 3: WEB: port 8083 opened
2022.11.06 09:40:05 1: Including ./log/fhem.save
2022.11.06 09:40:05 0: Featurelevel: 6.1
2022.11.06 09:40:05 0: Server started with 3 defined entities (fhem.pl:26635/2022-11-01 perl:5.032001 os:linux user:fhem pid:2115)
2022.11.06 09:40:09 0: Server shutdown

Das System ist auf 32 Bit, ich hatte bereits auch 64 bit, keine Änderung.
Wo kann ich noch suchen?
Gruß,
Friedhelm


Raspberry Pi 4B, Homematic, Sonoff, Shelly, Worx, Arduino, ESP8266

rudolfkoenig

Ohne logfile forkt FHEM nicht, anders gesagt, schickt sich selber nicht ins Hintergrund.
Ich empfehle den Wiki Artikel durchzuarbeiten: https://wiki.fhem.de/wiki/FHEM_startet_nicht_-_Tipps_zur_Fehlersuche

Wernieman

Ich würde auf Rechteprobleme Tippen, FHEM kann das Logfile nicht schreiben.

Fürs Debuggen bittte mal die Ausgabe (Shell):
ls -lha /opt/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

Sailor

Oder pauschal mal ein


cd /opt
sudo chown -R fhem:dialout /opt/fhem/
sudo chmod -R a+w /opt/fhem
sudo chmod 755 /opt/fhem
sudo chmod 600 /opt/fhem/.ssh/id_rsa
sudo chmod 755 /opt/fhem/.libnet-openssh-perl/
sudo usermod -a -G tty pi
sudo usermod -a -G tty fhem


versuchen
******************************
Man wird immer besser...

FFHEM

Vielen Dank erst einmal, Rudolf, Wernieman und Sailor!
Zitat von: Sailor am 06 November 2022, 13:14:58
Oder pauschal mal ein


cd /opt
sudo chown -R fhem:dialout /opt/fhem/
sudo chmod -R a+w /opt/fhem
sudo chmod 755 /opt/fhem
sudo chmod 600 /opt/fhem/.ssh/id_rsa
sudo chmod 755 /opt/fhem/.libnet-openssh-perl/
sudo usermod -a -G tty pi
sudo usermod -a -G tty fhem


versuchen
Habe ich gemacht, wobei bei den 2 Dateien folgende Fehlermeldung kam, sie sind beide nicht vorhanden - in meiner alten Installation aber auch nicht, also ignorieren!?
sudo chmod 600 /opt/fhem/.ssh/id_rsa
chmod: Zugriff auf '/opt/fhem/.ssh/id_rsa' nicht möglich: Datei oder Verzeichnis nicht gefunden
pi@raspi4:/opt $  sudo chmod 755 /opt/fhem/.libnet-openssh-perl/
chmod: Zugriff auf '/opt/fhem/.libnet-openssh-perl/' nicht möglich: Datei oder Verzeichnis nicht gefunden


Danach habe ich FHEM noch einmal neu installiert, diesmal aus dem Wiki mit der "manuellen" Methode.
(https://debian.fhem.de/ mit "Manual installation")
Damit komme ich zwar etwas weiter, und FHEM mit der Demo-Konfiguration läuft, aber nur ca. 2 - 3 Minuten, dann startet FHEM neu und es kommt diese Timeoutmeldung "fhem.service: Failed with result 'timeout'.", sichtbar mit
journalctl -u fhem:
Nov 06 13:38:12 raspi4 systemd[1]: Starting FHEM Home Automation...
Nov 06 13:38:12 raspi4 perl[2814]: 2022.11.06 13:38:12.677 1: Including fhem.cfg
Nov 06 13:38:12 raspi4 perl[2814]: 2022.11.06 13:38:12.697 3: telnet: port 7072 opened
Nov 06 13:38:12 raspi4 perl[2814]: 2022.11.06 13:38:12.888 3: WEB: port 8083 opened
Nov 06 13:38:12 raspi4 perl[2814]: 2022.11.06 13:38:12.973 2: eventTypes: loaded 1598 lines from demol>
Nov 06 13:38:12 raspi4 perl[2814]: 2022.11.06 13:38:12.990 1: CUL_0 device is none, commands will be e>
Nov 06 13:38:14 raspi4 perl[2814]: 2022.11.06 13:38:14.020 1: Including ./demolog/fhem.save
Nov 06 13:38:14 raspi4 perl[2814]: 2022.11.06 13:38:14.171 1: Messages collected while initializing FH>
Nov 06 13:38:14 raspi4 perl[2814]:   WEB is not password protected
Nov 06 13:38:14 raspi4 perl[2814]:   telnet is not password protected
Nov 06 13:38:14 raspi4 perl[2814]: Protect this FHEM installation by defining an allowed device with d>
Nov 06 13:38:14 raspi4 perl[2814]: You can disable this message with attr global motd none
Nov 06 13:38:14 raspi4 perl[2814]: 2022.11.06 13:38:14.331 0: Featurelevel: 6.1
Nov 06 13:38:14 raspi4 perl[2814]: 2022.11.06 13:38:14.331 0: Server started with 57 defined entities >
Nov 06 13:38:17 raspi4 perl[2814]: 2022.11.06 13:38:17.289 2: AttrTemplates: got 252 entries
Nov 06 13:39:42 raspi4 systemd[1]: fhem.service: start operation timed out. Terminating.
Nov 06 13:39:42 raspi4 perl[2814]: 2022.11.06 13:39:42.606 0: Server shutdown
Nov 06 13:39:42 raspi4 systemd[1]: fhem.service: Failed with result 'timeout'.
Nov 06 13:39:42 raspi4 systemd[1]: Failed to start FHEM Home Automation.
Nov 06 13:39:42 raspi4 systemd[1]: fhem.service: Consumed 2.484s CPU time.
Nov 06 13:39:42 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 62.
Nov 06 13:39:42 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 13:39:42 raspi4 systemd[1]: fhem.service: Consumed 2.484s CPU time.
Nov 06 13:39:42 raspi4 systemd[1]: Starting FHEM Home Automation...
Nov 06 13:39:43 raspi4 perl[2866]: 2022.11.06 13:39:43.172 1: Including fhem.cfg
Nov 06 13:39:43 raspi4 perl[2866]: 2022.11.06 13:39:43.192 3: telnet: port 7072 opened
Nov 06 13:39:43 raspi4 perl[2866]: 2022.11.06 13:39:43.385 3: WEB: port 8083 opened
Nov 06 13:39:43 raspi4 perl[2866]: 2022.11.06 13:39:43.467 2: eventTypes: loaded 1598 lines from demol>
Nov 06 13:39:43 raspi4 perl[2866]: 2022.11.06 13:39:43.484 1: CUL_0 device is none, commands will be e>
Nov 06 13:39:44 raspi4 perl[2866]: 2022.11.06 13:39:44.569 1: Including ./demolog/fhem.save
Nov 06 13:39:44 raspi4 perl[2866]: 2022.11.06 13:39:44.719 1: Messages collected while initializing FH>
Nov 06 13:39:44 raspi4 perl[2866]:   telnet is not password protected
Nov 06 13:39:44 raspi4 perl[2866]:   WEB is not password protected
Nov 06 13:39:44 raspi4 perl[2866]: Protect this FHEM installation by defining an allowed device with d>
Nov 06 13:39:44 raspi4 perl[2866]: You can disable this message with attr global motd none
Nov 06 13:39:44 raspi4 perl[2866]: 2022.11.06 13:39:44.880 0: Featurelevel: 6.1
Nov 06 13:39:44 raspi4 perl[2866]: 2022.11.06 13:39:44.881 0: Server started with 57 defined entities >
Nov 06 13:39:47 raspi4 perl[2866]: 2022.11.06 13:39:47.886 2: AttrTemplates: got 252 entries
Nov 06 13:41:13 raspi4 systemd[1]: fhem.service: start operation timed out. Terminating.
Nov 06 13:41:13 raspi4 perl[2866]: 2022.11.06 13:41:13.105 0: Server shutdown
Nov 06 13:41:13 raspi4 systemd[1]: fhem.service: Failed with result 'timeout'.
Nov 06 13:41:13 raspi4 systemd[1]: Failed to start FHEM Home Automation.
Nov 06 13:41:13 raspi4 systemd[1]: fhem.service: Consumed 2.517s CPU time.
Nov 06 13:41:13 raspi4 systemd[1]: fhem.service: Scheduled restart job, restart counter is at 63.
Nov 06 13:41:13 raspi4 systemd[1]: Stopped FHEM Home Automation.
Nov 06 13:41:13 raspi4 systemd[1]: fhem.service: Consumed 2.517s CPU time.
Nov 06 13:41:13 raspi4 systemd[1]: Starting FHEM Home Automation...
Nov 06 13:41:13 raspi4 perl[2873]: 2022.11.06 13:41:13.614 1: Including fhem.cfg
Nov 06 13:41:13 raspi4 perl[2873]: 2022.11.06 13:41:13.635 3: telnet: port 7072 opened
Nov 06 13:41:13 raspi4 perl[2873]: 2022.11.06 13:41:13.826 3: WEB: port 8083 opened


Also ist der Stand z. Zt.: FHEM läuft 2 Minuten lang, ich komme auch auf die Web-UI bei der fhem.config.demo, dann kommt aber ein Timeout und FHEM wird wieder gestartet.

Wenn ich FHEM manuell starte, also z. B. mit
perl fhem.pl fhem.cfg.demo
bekomme ich auch die richtige Prozessausgabe:
ps ax | grep perl
3139 pts/0    S+     0:02 perl fhem.pl fhem.cfg.demo
3144 pts/1    S+     0:00 grep --color=auto perl


Wenn ich dabei ein "sudo" voranstelle, bekomme ich 2 Prozesse mit perl und FHEM.

Meine Beobachtung: wenn ich FHEM manuell starte, scheint es konstant zu laufen (zumindest die Demo).
Starte ich es über systemd, kommt alle 2 Minuten ein Timeout.




Raspberry Pi 4B, Homematic, Sonoff, Shelly, Worx, Arduino, ESP8266

Wernieman

bei ps ausgaben, bitte mit aux. So kommt auch raus, unter welchem User der Prozess läuft.
- 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

FFHEM

Danke, hier zur Abwechslung einmal versuchsweise mit
sudo systemctl start fhem
gestartet, also nicht nur "manuell" und das läuft jetzt auch länger als 4 Minuten, ich teste es noch und verstehe es nicht:
fhem      7850 65.0  1.0  48964 41888 ?        Ss   15:48   0:01 /usr/bin/perl fhem.pl fhem.cfg
pi        7853  0.0  0.0   7472   584 pts/0    S+   15:48   0:00 grep --color=auto perl


Letztlich muss ich doch irgendwie bei der Installation etwas vergessen haben zu installieren.
Obwohl ich mir extra eine Anleitung geschrieben hatte, die bei der letzten Installation (da aber noch RPi3, kein 4er) auf Anhieb geklappt hatte.
Raspberry Pi 4B, Homematic, Sonoff, Shelly, Worx, Arduino, ESP8266

FFHEM

Ich habe es zum Laufen gebracht!
Linux neu installiert, neue SD-Karte. Andere Anleitung aus dem Netz probiert, einfach aus Frust heraus...
https://www.electronic-research.de/fhem-auf-raspberry-pi.html
Hat auf Anhieb geklappt!
Was da jetzt schief gelaufen ist, weiß ich nicht, leider.

Aber dennoch danke an Euch!
Gruß,
Friedhelm
Raspberry Pi 4B, Homematic, Sonoff, Shelly, Worx, Arduino, ESP8266

MadMax-FHEM

Bzgl. neuestem RaspiOS Bullseye dürfte die Anleitung allerdings nicht (mehr) korrekt bzw. ausreichend sein.

Nur leere ssh-Datei, hmmm.
User: da war/ist doch mittlerweile auch mehr?

Hoffentlich hast du nicht "blind" einfach alle dort genannten Pakete installiert?

Obwohl nat. eins davon ein Treffer sein kann ;)

Evtl. war es auch das: attr initialUsbCheck disable 1

Aber, wenn du ein Backup einspielst, bringt das ja auch wenig, weil wenn das im Backup nicht drin ist/war, dann isses ja auch wieder weg...

Naja, wenn es läuft...

Allerdings würde ich Backup und v.a. Restore mal üben...

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)

FFHEM

Zitat
Hoffentlich hast du nicht "blind" einfach alle dort genannten Pakete installiert?

Obwohl nat. eins davon ein Treffer sein kann ;)

Natürlich nicht, FHEM begleitet mich schon seit 9 Jahren, da bin ich schon einiges gewohnt.
Ich habe nur "meine eigenen" Pakete installiert, also das hier:
sudo su
wget -qO - http://debian.fhem.de/archive.key | apt-key add -
echo "deb http://debian.fhem.de/nightly/ /" >> /etc/apt/sources.list
apt-get update && upgrade
apt-get install fhem
Zusatzmodule installieren:
##  für SendEMail notwendig, sonst gibt es Fehlermeldungen dort
sudo apt-get install libcrypt-rijndael-perl

## Es wird zwar sendEmail (großes E) verwendet, aber das Paket
## wird mit kleinem e geschrieben:
sudo apt-get install sendemail

### Damit in InfoPanel auch Grafiken angezeigt werden:
sudo apt-get install libmime-base64-perl libimage-info-perl

                                                       
Für weekprofile wird JSON benötigt:

sudo apt-get install libjson-pp-perl

Für HMCCU:
sudo apt-get update && sudo apt-get install -y librpc-xml-perl


Zitat
Aber, wenn du ein Backup einspielst, bringt das ja auch wenig, weil wenn das im Backup nicht drin ist/war, dann isses ja auch wieder weg...

Naja, wenn es läuft...

Allerdings würde ich Backup und v.a. Restore mal üben...

Backup und Restore war hier ja nicht das Problem, es ging um ein Neuaufsetzen auf neuer Hardware (Pi4). Der Raspberry Pi 3 läuft natürlich noch schön vor sich hin, Gott sei Dank!
Meine Installationen sind alle gesichert und Backup/Restore mache ich regelmäßig, danke für den Hinweis!
Raspberry Pi 4B, Homematic, Sonoff, Shelly, Worx, Arduino, ESP8266

MadMax-FHEM

#10
Wenn Backup/Restore vorhanden ist, dann die Frage: warum soll es dann ein Problem gegeben haben?

Ich tippe ja auf "falsches" Backup-/Restore-Konzept...

Bei mir macht es überhaupt keinen Unterschied wohin ich Restore.
Weder welches OS noch welche HW...

D.h. ein Umstieg von PI3 auf PI4 inkl. neuem OS/neuer OS-Version ist für mich nichts anderes als ein normaler Restore...

EDIT: aber wenn's nun wieder tut...  8)

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)