[SOLVED] Logview on ubuntu


(Martin) #3

hi,

thanks for help. i did the steps linke you describe.
There are some problem:
I don´t know to:

  1. Change the User and Group value to your ubuntu user running OH
    and
  2. /usr/lib/node_modules/frontail/preset/ directory not exist

(Vincent Regaud) #4

What does is your linux username?
Replace pi in the service file with your linux username

Where did npm install frontail for you?
The preset directory is in there


(Martin) #5

Hi,

first, i want to fix error to start frontail service. I have changed the user and group to openhab.
And fixed the path in frontail.service to /usr/local/bin.
But the service did not start with code 127.

I can start it with “/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log”
and the service is running.

Can you help to debug.


(Vincent Regaud) #6

When you log in your ubuntu device, what is your username
Can you show me the service status?


(Martin) #7

My username is “user”.
Here is the the output:

user@ubuntu-18-openhab2:~$ systemctl status frontail
● frontail.service - Frontail
Loaded: loaded (/etc/systemd/system/frontail.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-09-26 06:28:47 UTC; 1min 47s ago
Process: 13075 ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /
Main PID: 13075 (code=exited, status=127)

Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling r
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter i
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Start request repeated too quickly.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: Failed to start Frontail.


(Vincent Regaud) #8

Can you post your .service file, please?


(Martin) #9

frontail.service file contains:

[Unit]
Description=Frontail

[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/open$
Restart=always
User=openhab
Group=openhab
Environment=PATH=/usr/local/bin/
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/

[Install]
WantedBy=multi-user.target
Alias=frontail.service


(Vincent Regaud) #10

change openhab to user

then

sudo chmod 644 /lib/systemd/system/frontail.service
sudo systemctl daemon-reload
sudo systemctl stop fronttail.service
sudo systemctl enable frontail.service
sudo systemctl start frontail.service

(Martin) #11

i changed from openhab to user, here the output:

root@ubuntu-18-openhab2:/lib/systemd/system# nano frontail.service root@ubuntu-18-openhab2:/lib/systemd/system# sudo chmod 644 /lib/systemd/system/ frontail.service
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl daemon-reload
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl stop fronttail.servi ce
Failed to stop fronttail.service: Unit fronttail.service not loaded.
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl enable frontail.serv ice
Failed to enable unit: File /etc/systemd/system/frontail.service already exists.
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl start frontail.servi ce
root@ubuntu-18-openhab2:/lib/systemd/system#


(Vincent Regaud) #12

Look good
Does it work?


(Vincent Regaud) #13

Why are you working in root?
Try to avoid that, it is quite dangerous


(Martin) #14

I switched back to user :slightly_smiling_face:
but the service did not start:

● frontail.service - Frontail
Loaded: loaded (/etc/systemd/system/frontail.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-09-26 09:26:34 CEST; 8s ago
Process: 1786 ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openha
Main PID: 1786 (code=exited, status=127)

Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status=127/n/a
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling restart.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter is at 5.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Start request repeated too quickly.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: Failed to start Frontail.


(Vincent Regaud) #15

Ok, try to use the code fences, please

Change the frontail.service file:
I have changes the last lines in the [Service] section

[Unit]
Description=Frontail

[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/open$
Restart=always
User=openhab
Group=openhab
Environment=PATH=/usr/local/bin/frontail
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/frontail

[Install]
WantedBy=multi-user.target
Alias=frontail.service

(Martin) #16

i changed the file, and do reboot, but same problem.
here the service

[Unit]
Description=Frontail

[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openhab2/events.log
Restart=always
User=user
Group=user
Environment=PATH=/usr/local/bin/frontail
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/frontail

[Install]
WantedBy=multi-user.target
Alias=frontail.service

i use the newest ubuntu server 18.04.01 lts


(Vincent Regaud) #17

Sorry. But I don’t know anymore
My set-up is exactly as your Ubuntu Server 18.04.01 lts
And apart from the directory it is the same as yours


(Ben Clark) #18

I’ve not used fronttail, but you may get more information about the error using the command:

sudo journalctl -u fronttail.service -b

The latest attempt at startup would be at the bottom.


(Martin) #19

thanks, for the command, i find that the

Environment=PATH=/usr/local/bin/frontail
and
WorkingDirectory=/usr/local/bin/frontail

did not exist, i changed it back to:

Environment=PATH=/usr/local/bin/frontail

WorkingDirectory=/usr/local/bin/frontail

After that, the log shows a problem with the env/ node:

Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Started Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status=127/n/a
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result 'exit-code'.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling restart.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter is at 4.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Started Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 frontail[848]: /usr/bin/env: ‘node’: No such file or directory
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status=127/n/a
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result 'exit-code'.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling restart.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter is at 5.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Start request repeated too quickly.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result 'exit-code'.


(Vincent Regaud) #20

did you install nodejs?


(Martin) #21

yep, it is installed via “apt-get install nodejs”


(Martin) #22

I found the sulution, the directorys are failed,
here is the working fontail.service:

[Unit]
Description=Frontail

[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openhab2/events.log
Restart=always
User=user
Group=user
Environment=PATH=/usr/local/bin/frontail
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/frontail

[Install]
WantedBy=multi-user.target
Alias=frontail.service

Thanks very much to the community to find the Solution!!!