Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service failed to start #7

Open
vworp opened this issue Nov 5, 2017 · 13 comments
Open

service failed to start #7

vworp opened this issue Nov 5, 2017 · 13 comments

Comments

@vworp
Copy link

vworp commented Nov 5, 2017

Followed the install instructions at http://addictedtopi.tumblr.com/post/101165284373/setting-up-cgateweb-c-bus-to-mqtt-on-linux

service cgateweb status
● cgateweb.service - cgateweb
Loaded: loaded (/etc/systemd/system/cgateweb.service; enabled)
Active: failed (Result: start-limit) since Sun 2017-11-05 10:55:13 UTC; 8min ago
Process: 2515 ExecStart=/usr/bin/nodejs /usr/local/bin/cgateweb/index.js (code=exited, status=203/EXEC)
Main PID: 2515 (code=exited, status=203/EXEC)

@the1laz
Copy link
Owner

the1laz commented Nov 5, 2017

Did you get any log messages? Maybe try running nodejs /usr/local/bin/cgateweb/index.js directly and see if there are any errors?

@vworp
Copy link
Author

vworp commented Nov 5, 2017

No log created at /usr/local/bin/cgateweb/log
running node index.js:-
CONNECTED TO C-GATE COMMAND PORT: 127.0.0.1:20023
CONNECTED TO C-GATE EVENT PORT: 127.0.0.1:20025
CONNECTED TO MQTT: 127.0.0.1:1883
ALL CONNECTED
^C

@vworp
Copy link
Author

vworp commented Nov 5, 2017

Running index.js directly worked for a while. I was receiving MQTT messages into node-red and was able to respond and publish to C-gate. After a while (less than an hour, I got distracted) MQTT messages stopped.
I've rebooted the pi, verified that ser2sock, mosquitto, cgate services are running. cgateweb service still has the same error as before, still has no log file
Permissions are as follows.
ls -l /usr/local/bin/cgateweb/log
total 0

ls -l /usr/local/bin/cgateweb
total 44
-rw-r--r-- 1 pi pi 355 Nov 5 09:30 cgateweb.service
-rw-r--r-- 1 pi pi 12868 Nov 5 09:30 index.js
-rw-r--r-- 1 pi pi 1081 Nov 5 09:30 LICENSE.txt
drwxr-sr-x 2 pi pi 4096 Nov 5 09:46 log
drwxr-sr-x 12 pi pi 4096 Nov 5 09:46 node_modules
-rw-r--r-- 1 pi pi 138 Nov 5 09:30 package.json
-rw-r--r-- 1 pi pi 1330 Nov 5 09:30 README.md
-rw-r--r-- 1 pi pi 598 Nov 5 09:47 settings.js

Directly starting index.js now appears to have no affect
node index.js:-
CONNECTED TO C-GATE COMMAND PORT: 127.0.0.1:20023
CONNECTED TO C-GATE EVENT PORT: 127.0.0.1:20025
CONNECTED TO MQTT: 127.0.0.1:1883
ALL CONNECTED

then hangs with no command prompt or MQTT messages sent.

@the1laz
Copy link
Owner

the1laz commented Nov 6, 2017

That's weird. Maybe try changing this line in /etc/systemd/system/cgateweb.service

ExecStart=/usr/local/bin/cgateweb/index.js

Then sudo systemctl daemon-reload

The logs won't go to that folder anymore, journalctl should manage them, they should appear when you sudo service cgateweb status

Have you turned on logging in the settings file? Might give a bit more information.

@PianSom
Copy link

PianSom commented Nov 6, 2017

In case, it helps, my cgateweb.service from my pi is below.

Note that

  • this has not been updated as per the current release
  • it was adjusted/written by me - and I am a long way from an expert on these things
  • I put in the 5s delay to ensure that my Mosquito broker had a chance to start - a kludge

`[Unit]
Description=cgateweb
Before=cgate.service
Requires=cgate.service

[Service]
ExecStartPre=/bin/sleep/ 5
ExecStart=/usr/bin/node /usr/local/bin/cgateweb/index.js
Restart=always
User=root
Group=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/cgateweb

[Install]
WantedBy=multi-user.target`

@vworp
Copy link
Author

vworp commented Nov 6, 2017

logging is set to true. Modded cgateweb.service as suggested

cgateweb.service - cgateweb
Loaded: loaded (/etc/systemd/system/cgateweb.service; enabled)
Active: failed (Result: start-limit) since Sun 2017-11-05 15:27:32 UTC; 1 day 3h ago
Main PID: 1213 (code=exited, status=203/EXEC)

Nov 05 15:27:32 raspberrypi systemd[1]: cgateweb.service holdoff time over, scheduling restart.
Nov 05 15:27:32 raspberrypi systemd[1]: Stopping cgateweb...
Nov 05 15:27:32 raspberrypi systemd[1]: Starting cgateweb...
Nov 05 15:27:32 raspberrypi systemd[1]: cgateweb.service start request repeated too quiclkly, refusing to start.
Nov 05 15:27:32 raspberrypi systemd[1]: Failed to start cgateweb.
Nov 05 15:27:32 raspberrypi systemd[1]: Unit cgateweb.service entered failed state.

@the1laz
Copy link
Owner

the1laz commented Nov 6, 2017

Sorry, forgot to add this:
sudo chmod +x /usr/local/bin/cgateweb/index.js

@the1laz
Copy link
Owner

the1laz commented Nov 6, 2017

Also, are you running raspbian?

@vworp
Copy link
Author

vworp commented Nov 7, 2017

Yes, on raspbian, installed from NOOBS a couple of weeks ago. apt-get update & upgrade after the installation, so should be up to date.

Done sudo chmod +x /usr/local/bin/cgateweb/index.js then sudo systemctl daemon-reload again, same problem.

service cgateweb status
● cgateweb.service - cgateweb
Loaded: loaded (/etc/systemd/system/cgateweb.service; enabled)
Active: failed (Result: start-limit) since Sun 2017-11-05 15:27:32 UTC; 2 days ago
Main PID: 1213 (code=exited, status=203/EXEC)

@vworp
Copy link
Author

vworp commented Nov 9, 2017

I may have missed a chmod in the initial setup. I appear to have a running service and MQTT messages being relayed. I'll test for a couple of days, fingers crossed it's all my fault :)

@the1laz
Copy link
Owner

the1laz commented Nov 10, 2017

Good to hear, I wasn't really sure where to look next. :S

@vworp
Copy link
Author

vworp commented Nov 12, 2017

I'm all fixed, everything is starting and running ok across reboots. Would you be interested in a token financial gesture for your work? This is already pretty useful to me :)

@the1laz
Copy link
Owner

the1laz commented Nov 16, 2017

I've got an Amazon wishlist on my blog, but I'm not chasing anything for helping. I'm happy that my hobby can help other people with theirs. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants