Frontail starts and stops instantly / syslog error messages

Hi there,

I am running openhab 2 (quite the latest release - sorry I don’t know how to find out which release exactly) on a rasperry pi 3 (os: openhabian), and after some updates via openhabian-config last november (to the latest stable release of openhab (option 3) as well as upgrading the system in general (option 2) , I could not get frontail to start properly any more (I tried to research and fix it by my own, but I am out of ideas now).

I stopped the service via sudo systemctl stop frontail.service, then I re-installed it via openhabian-config, and then syslog says:

Feb 2 14:07:56 openhabserver systemd[1]: Starting Frontail openHAB instance, reachable at http://stapahab:9001
Feb 2 14:07:56 openhabserver systemd[1]: Started Frontail openHAB instance, reachable at http://stapahab:9001.
Feb 2 14:07:58 openhabserver frontail[21429]: /usr/lib/node_modules/frontail/node_modules/ws/lib/websocket.js:347
Feb 2 14:07:58 openhabserver frontail[21429]: …options
Feb 2 14:07:58 openhabserver frontail[21429]: ^^^
Feb 2 14:07:58 openhabserver frontail[21429]: SyntaxError: Unexpected token …
Feb 2 14:07:58 openhabserver frontail[21429]: at createScript (vm.js:53:10)
Feb 2 14:07:58 openhabserver frontail[21429]: at Object.runInThisContext (vm.js:95:10)
Feb 2 14:07:58 openhabserver frontail[21429]: at Module._compile (module.js:543:28)
Feb 2 14:07:58 openhabserver frontail[21429]: at Object.Module._extensions…js (module.js:580:10)
Feb 2 14:07:58 openhabserver frontail[21429]: at Module.load (module.js:488:32)
Feb 2 14:07:58 openhabserver frontail[21429]: at tryModuleLoad (module.js:447:12)
Feb 2 14:07:58 openhabserver frontail[21429]: at Function.Module._load (module.js:439:3)
Feb 2 14:07:58 openhabserver frontail[21429]: at Module.require (module.js:498:17)
Feb 2 14:07:58 openhabserver frontail[21429]: at require (internal/module.js:20:19)
Feb 2 14:07:58 openhabserver frontail[21429]: at Object. (/usr/lib/node_modules/frontail/node_modules/ws/index.js:3:19)
Feb 2 14:07:58 openhabserver systemd[1]: frontail.service: main process exited, code=exited, status=1/FAILURE
Feb 2 14:07:58 openhabserver systemd[1]: Unit frontail.service entered failed state.
Feb 2 14:07:58 openhabserver systemd[1]: frontail.service holdoff time over, scheduling restart.
Feb 2 14:07:58 openhabserver systemd[1]: Stopping Frontail openHAB instance, reachable at http://stapahab:9001
Feb 2 14:07:58 openhabserver systemd[1]: Starting Frontail openHAB instance, reachable at http://stapahab:9001
Feb 2 14:07:58 openhabserver systemd[1]: Started Frontail openHAB instance, reachable at http://stapahab:9001.
Feb 2 14:08:00 openhabserver influxd[754]: [httpd] 127.0.0.1 - openhab [02/Feb/2020:14:08:00 +0100] “POST /write?consistency=one&db=stapa_db&p=%5BREDACTED%5D&precision=n&rp=autogen&u=openhab HTTP/1.1” 204 0 “-” “okhttp/2.4.0” 09d78152-45bd-11ea-8c48-b827eb9dba02 82511
Feb 2 14:08:00 openhabserver frontail[21463]: /usr/lib/node_modules/frontail/node_modules/ws/lib/websocket.js:347
Feb 2 14:08:00 openhabserver frontail[21463]: …options
Feb 2 14:08:00 openhabserver frontail[21463]: ^^^

(and so on and so on).

I tried commenting the line he talkes about in websocket.js, but surely this doesn’t help at all, he finds other SyntaxErrors, so I really wonder, what this could be.

My frontail.service looks like this:

[Unit] Description=Frontail openHAB instance, reachable at http://%H:9001 Documentation=https://github.com/mthenw/frontail Documentation=https://github.com/openhab/openhabian/issues/28 After=openhab2.service

[Service]
Type=simple
ExecStart=/usr/lib/node_modules/frontail/bin/frontail --ui-highlight --ui-highlight-preset /usr/lib/node_modules/frontail/preset/openhab.json -t openhab -l 2000 -n 200 /var/log/openhab2/openhab.log /var/log/openhab2/events.log
Restart=always
User=openhab
Group=openhab
Environment=PATH=/usr/bin/
Environment=NODE_ENV=production
WorkingDirectory=/usr/bin/

[Install]
WantedBy=multi-user.target

Any help would be very much appreciated! Thanks so much in advance!

I think your best bet is to look on frontail’s docs compared to your config to see if there are any difference you can find.

A hidden character might have snuck into the config file at some point, that that send unlikely.

I don’t see anything unusual but I don’t use frontail.

Hi Doris,

could you find a solution to that issues? i seam to face it too but couldn’t find a solution except that my raspberry now has a button that starts frontail…

any hint is welcome.

thank you

françois

Do you use openhabian-config ? Which release ? Which OH version do you use ?

i´m using the latest openhabian (1.6.2b) with OH 3.0.0 and installed frontail through openhabian-config
i moved my log files to /storage/log/openhab so i had to alter /etc/systemd/system/frontail.service to match the path.

i then try to enable it with “sudo systemctl enable frontail.service” and “sudo systemctl start frontail.service” lets it run until i restart the raspberry
during restart, frontail is then started during boot and stopped one second later.
If started some time after the initial boot it keeps running but wont get passed a reboot.
I now added a physical butten that does nothing else then starting frontail. it helps as i dont need frontail running permantly but would prefere not to need that workaround…

thank you for any help

cu françois

have a look to

sudo systemctl status frontail

after boot to check if the reason is being shown
if that does not help check with

sudo journalctl

you might have to do further changes to the frontail.service file to make sure that frontail.service is started afte the logs are in /storage/log/openhab resp. after the storage is mounted/ready.

hi wolfgang,

thank you for helping me with this.

the output of

sudo systemctl status frontail

is

openhabian@openhabianpi:~ $ sudo systemctl status frontail
● frontail.service - Frontail openHAB instance, reachable at http://openhabianpi:9001
   Loaded: loaded (/etc/systemd/system/frontail.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2021-01-12 10:11:26 CET; 1min 0s ago
     Docs: https://github.com/mthenw/frontail
  Process: 558 ExecStart=/usr/lib/node_modules/frontail/bin/frontail --ui-highlight --ui-highlight-preset /usr/lib/node_modules/frontail/preset/openhab.json -t openhab -l 2000 -n 200 /storage/log/openhab/openhab.log /storage/log/openhab/
 Main PID: 558 (code=killed, signal=TERM)

Jan 12 10:11:26 openhabianpi systemd[1]: Started Frontail openHAB instance, reachable at http://openhabianpi:9001.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopping Frontail openHAB instance, reachable at http://openhabianpi:9001...
Jan 12 10:11:26 openhabianpi systemd[1]: frontail.service: Main process exited, code=killed, status=15/TERM
Jan 12 10:11:26 openhabianpi systemd[1]: frontail.service: Succeeded.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopped Frontail openHAB instance, reachable at http://openhabianpi:9001.
lines 1-12/12 (END)

while the output of

sudo journalctl -xu frontail

is

[...]
-- Reboot --
Jan 12 10:11:26 openhabianpi systemd[1]: Started Frontail openHAB instance, reachable at http://openhabianpi:9001.
-- Subject: A start job for unit frontail.service has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit frontail.service has finished successfully.
--
-- The job identifier is 104.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopping Frontail openHAB instance, reachable at http://openhabianpi:9001...
-- Subject: A stop job for unit frontail.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit frontail.service has begun execution.
--
-- The job identifier is 253.
Jan 12 10:11:26 openhabianpi systemd[1]: frontail.service: Main process exited, code=killed, status=15/TERM
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit frontail.service has exited.
--
-- The process' exit code is 'killed' and its exit status is 15.
Jan 12 10:11:26 openhabianpi systemd[1]: frontail.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit frontail.service has successfully entered the 'dead' state.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopped Frontail openHAB instance, reachable at http://openhabianpi:9001.
-- Subject: A stop job for unit frontail.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit frontail.service has finished.
--
-- The job identifier is 253 and the job result is done.
lines 86-147/147 (END)

while looking into the output of

sudo journalctl

i found that openhab seams to gets terminated and so is frontail. but i can´t see why this happens or why openhab is then still running while frontail is not

Jan 12 10:11:26 openhabianpi systemd[1]: Reached target Network.
Jan 12 10:11:26 openhabianpi dphys-swapfile[444]: want /var/swap=1849MByte, checking existing: keeping it
Jan 12 10:11:26 openhabianpi systemd[1]: Mounting openhab-userdata mount...
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ -n 90 ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + sysctl vm.swappiness=90
Jan 12 10:11:26 openhabianpi zram-config[412]: + echo 'swap                /zram0                zram-config0'
Jan 12 10:11:26 openhabianpi zram-config[412]: + read -r line
Jan 12 10:11:26 openhabianpi zram-config[412]: + case "$line" in
Jan 12 10:11:26 openhabianpi zram-config[412]: + continue
Jan 12 10:11:26 openhabianpi zram-config[412]: + read -r line
Jan 12 10:11:26 openhabianpi zram-config[412]: + case "$line" in
Jan 12 10:11:26 openhabianpi zram-config[412]: + continue
Jan 12 10:11:26 openhabianpi zram-config[412]: + read -r line
Jan 12 10:11:26 openhabianpi zram-config[412]: + case "$line" in
Jan 12 10:11:26 openhabianpi zram-config[412]: + set -- dir lzo-rle 150M 500M /var/lib/openhab/persistence /persistence.bind
Jan 12 10:11:26 openhabianpi zram-config[412]: + echo 'ztab create dir lzo-rle 150M 500M /var/lib/openhab/persistence /persistence.bind   '
Jan 12 10:11:26 openhabianpi zram-config[412]: + ZTAB_EMPTY=false
Jan 12 10:11:26 openhabianpi zram-config[412]: + ZTYPE=dir
Jan 12 10:11:26 openhabianpi zram-config[412]: + ALG=lzo-rle
Jan 12 10:11:26 openhabianpi zram-config[412]: + MEM_SIZE=150M
Jan 12 10:11:26 openhabianpi zram-config[412]: + DISK_SIZE=500M
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ -f /tmp/zram-device-list ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ dir == \s\w\a\p ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: ++ grep 'dir.*/var/lib/openhab/persistence' /tmp/zram-device-list
Jan 12 10:11:26 openhabianpi zram-config[412]: + entry=
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ -n '' ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + test -f /tmp/zram-device-list.new
Jan 12 10:11:26 openhabianpi zram-config[412]: + case "$1" in
Jan 12 10:11:26 openhabianpi zram-config[412]: + TARGET_DIR=/var/lib/openhab/persistence
Jan 12 10:11:26 openhabianpi zram-config[412]: + BIND_DIR=/persistence.bind
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ false == \f\a\l\s\e ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + serviceConfiguration stop
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ stop == \s\t\o\p ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + echo 'Stopping services that interfere with zram device configuration'
Jan 12 10:11:26 openhabianpi zram-config[412]: + dpkg -s nginx
Jan 12 10:11:26 openhabianpi systemd[1]: Mounting openhab-conf mount...
Jan 12 10:11:26 openhabianpi sh[320]: wlan0=wlan0
Jan 12 10:11:26 openhabianpi systemd[1]: Condition check resulted in fast remote file copy program daemon being skipped.
Jan 12 10:11:26 openhabianpi systemd[1]: Reached target Network is Online.
Jan 12 10:11:26 openhabianpi systemd[1]: Started openHAB - empowering the smart home.
Jan 12 10:11:26 openhabianpi systemd[1]: Started Frontail openHAB instance, reachable at http://openhabianpi:9001.
Jan 12 10:11:26 openhabianpi systemd[1]: Starting Samba NMB Daemon...
Jan 12 10:11:26 openhabianpi systemd[1]: Condition check resulted in openHABian installer service being skipped.
Jan 12 10:11:26 openhabianpi systemd[1]: Mounting openhab-sys mount...
Jan 12 10:11:26 openhabianpi systemd[1]: Starting Permit User Sessions...
Jan 12 10:11:26 openhabianpi systemd[1]: Mounting openhab-addons mount...
Jan 12 10:11:26 openhabianpi systemd[1]: Starting /etc/rc.local Compatibility...
Jan 12 10:11:26 openhabianpi systemd[1]: Starting OpenBSD Secure Shell server...
Jan 12 10:11:26 openhabianpi systemd[1]: Mounted openhab-userdata mount.
Jan 12 10:11:26 openhabianpi systemd[1]: Mounted openhab-conf mount.
Jan 12 10:11:26 openhabianpi systemd[1]: Mounted openhab-sys mount.
Jan 12 10:11:26 openhabianpi systemd[1]: Started Permit User Sessions.
Jan 12 10:11:26 openhabianpi systemd[1]: Mounted openhab-addons mount.
Jan 12 10:11:26 openhabianpi systemd[1]: Started /etc/rc.local Compatibility.
Jan 12 10:11:26 openhabianpi systemd[1]: Started Getty on tty1.
Jan 12 10:11:26 openhabianpi systemd[1]: Reached target Login Prompts.
Jan 12 10:11:26 openhabianpi zram-config[412]: + dpkg -s samba
Jan 12 10:11:26 openhabianpi wpa_supplicant[398]: wlan0: Trying to associate with SSID '[********]'
Jan 12 10:11:26 openhabianpi zram-config[412]: ++ systemctl is-active smbd.service
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ inactive == \a\c\t\i\v\e ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + dpkg -s openhab
Jan 12 10:11:26 openhabianpi zram-config[412]: ++ systemctl is-active openhab.service
Jan 12 10:11:26 openhabianpi zram-config[412]: + [[ active == \a\c\t\i\v\e ]]
Jan 12 10:11:26 openhabianpi zram-config[412]: + export openhabActive=true
Jan 12 10:11:26 openhabianpi zram-config[412]: + openhabActive=true
Jan 12 10:11:26 openhabianpi zram-config[412]: + systemctl stop openhab.service
Jan 12 10:11:26 openhabianpi systemd[1]: Stopping Frontail openHAB instance, reachable at http://openhabianpi:9001...
Jan 12 10:11:26 openhabianpi systemd[1]: frontail.service: Main process exited, code=killed, status=15/TERM
Jan 12 10:11:26 openhabianpi systemd[1]: frontail.service: Succeeded.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopped Frontail openHAB instance, reachable at http://openhabianpi:9001.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopping openHAB - empowering the smart home...

For the sake of completeness i´m adding the output of

sudo journalctl -xu openhab
[...]
-- Reboot --
Jan 12 10:11:26 openhabianpi systemd[1]: Started openHAB - empowering the smart home.
-- Subject: A start job for unit openhab.service has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit openhab.service has finished successfully.
--
-- The job identifier is 92.
Jan 12 10:11:26 openhabianpi systemd[1]: Stopping openHAB - empowering the smart home...
-- Subject: A stop job for unit openhab.service has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit openhab.service has begun execution.
--
-- The job identifier is 252.
Jan 12 10:11:33 openhabianpi karaf[631]: Can't connect to the container. The container is not running.
Jan 12 10:11:33 openhabianpi systemd[1]: openhab.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStop= process belonging to unit openhab.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Jan 12 10:11:33 openhabianpi systemd[1]: openhab.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit openhab.service has entered the 'failed' state with result 'exit-code'.
Jan 12 10:11:33 openhabianpi systemd[1]: Stopped openHAB - empowering the smart home.
-- Subject: A stop job for unit openhab.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit openhab.service has finished.
--
-- The job identifier is 252 and the job result is done.

again: thank you for your help

cu françois

Hi Francois,

I am sorry - I could absolutely not solve this problem. And I spent some hours on it!

now it is working again - as I had a crash on my system in summer I had to set up a new openhab system from scratch. It costed me less time to set it up again from scratch than I invested in fixing the frontail. Should have done this right away :slight_smile:

All the best,
Doris

have a look into this thread and check if this also could be the root cause:

i´m not using tmpfs and i now tried with the log files in the original location /var/log/. unfortunately frontail still terminates after startup.
as i soldered my own workaround i wouldn´t bother for now, unless you want my help to solve this for other users.
if so please send me a pm and we´ll see how to achieve this efficiently

thank you for trying anyway

cu françois