Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Systemd Service for homebridge (http://github.com/nfarina/homebridge)
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
# Adapt this to your specific setup (could be /usr/bin/homebridge)
# See comments below for more information
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
@johannrichard

This comment has been minimized.

Show comment
Hide comment
@johannrichard

johannrichard Jan 7, 2016

On newer Raspberry Pi and Debian systems (i.e. jessie based), managing of services with init.d/sysvinit is (transparently) replaced with systemd. If you wish to use systemd for running Homebridge on boot, you can follow these instructions. Familiarity with Linux concepts, user and rights management etc. are assumed.

As you can see, the service definition is much shorter than a comparable init.d script.

Download the two files and place homebridge under /etc/default and homebridge.service under /etc/systemd/system on your Raspberry Pi.

ATTENTION: Depending on how you installed nodejs (as package or tarball) and homebridge, you might have to change the line ExecStart in the file homebridge.service from /usr/local/bin/homebridge to /usr/bin/homebridge. The easiest way to find out which one to use is to issue the command which homebridge after you have installed homebridge on your system.

pi@pi:~ $ which homebridge
/usr/local/bin/homebridge

Configuration

In order to use the systemd service as is, the following folders and user have to exists:

  • A system user named homebridge. You can easily create this user with sudo useradd -M --system homebridge or choose a different name
  • A directory called /var/lib/homebridge, writable by the user created above, and a corresponding config.json file in that directory. Homebridge by default looks for its configuration in /home/<username>/.homebridge. This is unsuitable for services and the -U /var/lib/homebridge flag ensures the config is read from a different place.

Then Enable and run the service (first time) with the following commands:

systemctl daemon-reload
systemctl enable homebridge
systemctl start homebridge

You can check the status of the service by calling

systemctl status homebridge

On subsequent reboots, it should start automatically, if not, use the journalctl -u homebridge to check the error cause.

Notes

  • The service will restart after 10 seconds if it fails for any reason (or if you kill it for example with kill -s SIGSEGV <pid>)
Owner

johannrichard commented Jan 7, 2016

On newer Raspberry Pi and Debian systems (i.e. jessie based), managing of services with init.d/sysvinit is (transparently) replaced with systemd. If you wish to use systemd for running Homebridge on boot, you can follow these instructions. Familiarity with Linux concepts, user and rights management etc. are assumed.

As you can see, the service definition is much shorter than a comparable init.d script.

Download the two files and place homebridge under /etc/default and homebridge.service under /etc/systemd/system on your Raspberry Pi.

ATTENTION: Depending on how you installed nodejs (as package or tarball) and homebridge, you might have to change the line ExecStart in the file homebridge.service from /usr/local/bin/homebridge to /usr/bin/homebridge. The easiest way to find out which one to use is to issue the command which homebridge after you have installed homebridge on your system.

pi@pi:~ $ which homebridge
/usr/local/bin/homebridge

Configuration

In order to use the systemd service as is, the following folders and user have to exists:

  • A system user named homebridge. You can easily create this user with sudo useradd -M --system homebridge or choose a different name
  • A directory called /var/lib/homebridge, writable by the user created above, and a corresponding config.json file in that directory. Homebridge by default looks for its configuration in /home/<username>/.homebridge. This is unsuitable for services and the -U /var/lib/homebridge flag ensures the config is read from a different place.

Then Enable and run the service (first time) with the following commands:

systemctl daemon-reload
systemctl enable homebridge
systemctl start homebridge

You can check the status of the service by calling

systemctl status homebridge

On subsequent reboots, it should start automatically, if not, use the journalctl -u homebridge to check the error cause.

Notes

  • The service will restart after 10 seconds if it fails for any reason (or if you kill it for example with kill -s SIGSEGV <pid>)
@jrdennis95

This comment has been minimized.

Show comment
Hide comment
@jrdennis95

jrdennis95 Jan 14, 2016

Hi there, I was just wondering, what should be checked if I receive active (exited) instead of active (running)? I can't see what I've messed up ;_;

Hi there, I was just wondering, what should be checked if I receive active (exited) instead of active (running)? I can't see what I've messed up ;_;

@m0rph13

This comment has been minimized.

Show comment
Hide comment
@m0rph13

m0rph13 Jan 15, 2016

Although I did install homebridge globally, I found that on my PI it was installed on /usr/local/bin
Changing that got it up and running.
Thank you!

m0rph13 commented Jan 15, 2016

Although I did install homebridge globally, I found that on my PI it was installed on /usr/local/bin
Changing that got it up and running.
Thank you!

@simonrb2000

This comment has been minimized.

Show comment
Hide comment
@simonrb2000

simonrb2000 Jan 17, 2016

m0rph13 How did you do that?

I have managed to install systemd pn my raspberry pi however when I run the command "systemctl enable home bridge" I get "Failed to issue method call: Invalid argument"

Any ideas?

Thank you

m0rph13 How did you do that?

I have managed to install systemd pn my raspberry pi however when I run the command "systemctl enable home bridge" I get "Failed to issue method call: Invalid argument"

Any ideas?

Thank you

@alexrobbins

This comment has been minimized.

Show comment
Hide comment
@alexrobbins

alexrobbins Jan 22, 2016

@simonrb2000 If you called it with a space in there, that could have been the issue.

@simonrb2000 If you called it with a space in there, that could have been the issue.

@gretel

This comment has been minimized.

Show comment
Hide comment
@gretel

gretel Jan 28, 2016

great, thanks.

gretel commented Jan 28, 2016

great, thanks.

@desvdp

This comment has been minimized.

Show comment
Hide comment
@desvdp

desvdp Jan 31, 2016

Great work, already switched to using systemd (I like the automatic restart feature !)
one thing: I'd suggest also waiting for the network to come up (otherwise platforms depending on an ip address might crash during boot)

After=syslog.target network-online.target

desvdp commented Jan 31, 2016

Great work, already switched to using systemd (I like the automatic restart feature !)
one thing: I'd suggest also waiting for the network to come up (otherwise platforms depending on an ip address might crash during boot)

After=syslog.target network-online.target

@Basecontrol

This comment has been minimized.

Show comment
Hide comment
@Basecontrol

Basecontrol Feb 3, 2016

To me, everything seems to be working fine. If i manually start Homebridge, everything is fine and i can control my Nest perfectly.
$ homebridge

However, using the above mentioned method, i cannot seem to connect to Homebridge, nor the Nest. Calling
systemctl status homebridge

homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (running) since Wed 2016-02-03 20:34:30 UTC; 15min ago
Main PID: 320 (homebridge)
CGroup: /system.slice/homebridge.service
└─320 homebridge

Gives no specific errors. There are also no errors in the log file:

Feb 03 20:34:55 raspberrypi homebridge[320]: ---
Feb 03 20:34:55 raspberrypi homebridge[320]: Loaded config.json with 0 accessories and 1 platforms.
Feb 03 20:34:55 raspberrypi homebridge[320]: ---
Feb 03 20:34:55 raspberrypi homebridge[320]: Loading 1 platforms...
Feb 03 20:34:55 raspberrypi homebridge[320]: Initializing Nest platform...
Feb 03 20:34:55 raspberrypi homebridge[320]: Fetching Nest devices.
Feb 03 20:35:12 raspberrypi homebridge[320]: Current temperature for Family Room (Huiskamer) is: 21.5 C
Feb 03 20:35:12 raspberrypi homebridge[320]: Current humidity for Family Room (Huiskamer) is: 50%
Feb 03 20:35:12 raspberrypi homebridge[320]: Target temperature for Family Room (Huiskamer) is: 20.5 C
Feb 03 20:35:12 raspberrypi homebridge[320]: Target heating for Family Room (Huiskamer) is: Heating
Feb 03 20:35:12 raspberrypi homebridge[320]: Initializing platform accessory 'Family Room (Huiskamer)'...
Feb 03 20:35:12 raspberrypi homebridge[320]: Scan this code with your HomeKit App on your iOS device to pair with Ho
Feb 03 20:35:12 raspberrypi homebridge[320]:
Feb 03 20:35:12 raspberrypi homebridge[320]: ┌────────────┐
Feb 03 20:35:12 raspberrypi homebridge[320]: │ xx-xx-xx │
Feb 03 20:35:12 raspberrypi homebridge[320]: └────────────┘
Feb 03 20:35:12 raspberrypi homebridge[320]:
Feb 03 20:35:12 raspberrypi homebridge[320]: Homebridge is running on port 51826.
Feb 03 20:36:33 raspberrypi homebridge[320]: Current temperature for Family Room (Huiskamer) is: 21 C

Any ideas on how to find out what is going on?

-Edit
I think that i fixed the problem by changing the username for the homebridge, and re-adding it to Homekit (and deleting the previous). Everything seems to work fine now.

To me, everything seems to be working fine. If i manually start Homebridge, everything is fine and i can control my Nest perfectly.
$ homebridge

However, using the above mentioned method, i cannot seem to connect to Homebridge, nor the Nest. Calling
systemctl status homebridge

homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (running) since Wed 2016-02-03 20:34:30 UTC; 15min ago
Main PID: 320 (homebridge)
CGroup: /system.slice/homebridge.service
└─320 homebridge

Gives no specific errors. There are also no errors in the log file:

Feb 03 20:34:55 raspberrypi homebridge[320]: ---
Feb 03 20:34:55 raspberrypi homebridge[320]: Loaded config.json with 0 accessories and 1 platforms.
Feb 03 20:34:55 raspberrypi homebridge[320]: ---
Feb 03 20:34:55 raspberrypi homebridge[320]: Loading 1 platforms...
Feb 03 20:34:55 raspberrypi homebridge[320]: Initializing Nest platform...
Feb 03 20:34:55 raspberrypi homebridge[320]: Fetching Nest devices.
Feb 03 20:35:12 raspberrypi homebridge[320]: Current temperature for Family Room (Huiskamer) is: 21.5 C
Feb 03 20:35:12 raspberrypi homebridge[320]: Current humidity for Family Room (Huiskamer) is: 50%
Feb 03 20:35:12 raspberrypi homebridge[320]: Target temperature for Family Room (Huiskamer) is: 20.5 C
Feb 03 20:35:12 raspberrypi homebridge[320]: Target heating for Family Room (Huiskamer) is: Heating
Feb 03 20:35:12 raspberrypi homebridge[320]: Initializing platform accessory 'Family Room (Huiskamer)'...
Feb 03 20:35:12 raspberrypi homebridge[320]: Scan this code with your HomeKit App on your iOS device to pair with Ho
Feb 03 20:35:12 raspberrypi homebridge[320]:
Feb 03 20:35:12 raspberrypi homebridge[320]: ┌────────────┐
Feb 03 20:35:12 raspberrypi homebridge[320]: │ xx-xx-xx │
Feb 03 20:35:12 raspberrypi homebridge[320]: └────────────┘
Feb 03 20:35:12 raspberrypi homebridge[320]:
Feb 03 20:35:12 raspberrypi homebridge[320]: Homebridge is running on port 51826.
Feb 03 20:36:33 raspberrypi homebridge[320]: Current temperature for Family Room (Huiskamer) is: 21 C

Any ideas on how to find out what is going on?

-Edit
I think that i fixed the problem by changing the username for the homebridge, and re-adding it to Homekit (and deleting the previous). Everything seems to work fine now.

@kevince52

This comment has been minimized.

Show comment
Hide comment
@kevince52

kevince52 Feb 5, 2016

I can launch homebridge manually just fine and believe I followed these instructions but I keep getting this when I check the status:

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2016-02-04 20:46:13 AST; 2s ago
Process: 974 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
Main PID: 974 (code=exited, status=203/EXEC)

Any insight would be much appreciated. Thanks.

I can launch homebridge manually just fine and believe I followed these instructions but I keep getting this when I check the status:

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2016-02-04 20:46:13 AST; 2s ago
Process: 974 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
Main PID: 974 (code=exited, status=203/EXEC)

Any insight would be much appreciated. Thanks.

@mishakim

This comment has been minimized.

Show comment
Hide comment
@mishakim

mishakim Feb 13, 2016

This all worked for me, but where are the log and err file with this configuration? /var/log/homebridge.* are not updating and journalctl says no journal files found (I didn't enable debug, just looking for the standard logs)

This all worked for me, but where are the log and err file with this configuration? /var/log/homebridge.* are not updating and journalctl says no journal files found (I didn't enable debug, just looking for the standard logs)

@codenko

This comment has been minimized.

Show comment
Hide comment
@codenko

codenko Feb 14, 2016

I can launch homebridge manually just fine and believe I followed these instructions but I keep getting this when I check the status:

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2016-02-04 20:46:13 AST; 2s ago
Process: 974 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
Main PID: 974 (code=exited, status=203/EXEC)

Any insight would be much appreciated. Thanks.

Also having this issue.

codenko commented Feb 14, 2016

I can launch homebridge manually just fine and believe I followed these instructions but I keep getting this when I check the status:

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2016-02-04 20:46:13 AST; 2s ago
Process: 974 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
Main PID: 974 (code=exited, status=203/EXEC)

Any insight would be much appreciated. Thanks.

Also having this issue.

@Neblite

This comment has been minimized.

Show comment
Hide comment
@Neblite

Neblite Feb 15, 2016

@codenko & @kevince52

Verify that the path is accurate -- I had to add word "local" to the path in homebridge.service file.
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS

Neblite commented Feb 15, 2016

@codenko & @kevince52

Verify that the path is accurate -- I had to add word "local" to the path in homebridge.service file.
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS

@codenko

This comment has been minimized.

Show comment
Hide comment
@codenko

codenko Feb 15, 2016

pi@codenkopi:~ $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: active (running) since Mon 2016-02-15 14:20:19 PST; 8s ago
 Main PID: 1336 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─1336 homebridge

Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Current humidity for Wrangler is: 41
Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Target heating for Wrangler is: 0
Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Target temperature for Wrangler is: 29.326
Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Initializing platform accessory 'Wrangler'...
Feb 15 14:20:27 codenkopi homebridge[1336]: Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
Feb 15 14:20:27 codenkopi homebridge[1336]:
Feb 15 14:20:27 codenkopi homebridge[1336]:     ┌────────────┐
Feb 15 14:20:27 codenkopi homebridge[1336]:     │ ***-**-*** │
Feb 15 14:20:27 codenkopi homebridge[1336]:     └────────────┘
Feb 15 14:20:27 codenkopi homebridge[1336]:

pi@codenkopi:~ $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2016-02-15 14:20:28 PST; 2s ago
  Process: 1336 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 1336 (code=exited, status=1/FAILURE)

Feb 15 14:20:28 codenkopi systemd[1]: Unit homebridge.service entered failed state.
pi@codenkopi:~ $

@Neblite. You were correct, the path was wrong. But even with the corrected path, it launches, only to fail a couple seconds later.

codenko commented Feb 15, 2016

pi@codenkopi:~ $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: active (running) since Mon 2016-02-15 14:20:19 PST; 8s ago
 Main PID: 1336 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─1336 homebridge

Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Current humidity for Wrangler is: 41
Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Target heating for Wrangler is: 0
Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Target temperature for Wrangler is: 29.326
Feb 15 14:20:27 codenkopi homebridge[1336]: [Nest] Initializing platform accessory 'Wrangler'...
Feb 15 14:20:27 codenkopi homebridge[1336]: Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
Feb 15 14:20:27 codenkopi homebridge[1336]:
Feb 15 14:20:27 codenkopi homebridge[1336]:     ┌────────────┐
Feb 15 14:20:27 codenkopi homebridge[1336]:     │ ***-**-*** │
Feb 15 14:20:27 codenkopi homebridge[1336]:     └────────────┘
Feb 15 14:20:27 codenkopi homebridge[1336]:

pi@codenkopi:~ $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2016-02-15 14:20:28 PST; 2s ago
  Process: 1336 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 1336 (code=exited, status=1/FAILURE)

Feb 15 14:20:28 codenkopi systemd[1]: Unit homebridge.service entered failed state.
pi@codenkopi:~ $

@Neblite. You were correct, the path was wrong. But even with the corrected path, it launches, only to fail a couple seconds later.

@Smorfelt

This comment has been minimized.

Show comment
Hide comment
@Smorfelt

Smorfelt Feb 17, 2016

Hello guys,

I can also manually start Homebridge on my Pi 2, but I can't make it run on boot with this method.
I've put all the files at the right places and permissions are OK, but...

When typing: sudo systemctl enable homebridge

I get this:
Synchronizing state for homebridge.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d homebridge defaults
insserv: script homebridge is not an executable regular file, skipped!
Executing /usr/sbin/update-rc.d homebridge enable
update-rc.d: error: no runlevel symlinks to modify, aborting!

I'm guessing the error has to be here, but I can't understand it.

When checking the status I get this:
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since mer. 2016-02-17 23:37:27 CET; 1s ago
Process: 1363 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
Main PID: 1363 (code=exited, status=1/FAILURE)

I've changed the path in homebridge.service file as explained by Neblite, but it doesn't help.

Thanx a lot in advance for your help !
Jerome

Hello guys,

I can also manually start Homebridge on my Pi 2, but I can't make it run on boot with this method.
I've put all the files at the right places and permissions are OK, but...

When typing: sudo systemctl enable homebridge

I get this:
Synchronizing state for homebridge.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d homebridge defaults
insserv: script homebridge is not an executable regular file, skipped!
Executing /usr/sbin/update-rc.d homebridge enable
update-rc.d: error: no runlevel symlinks to modify, aborting!

I'm guessing the error has to be here, but I can't understand it.

When checking the status I get this:
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since mer. 2016-02-17 23:37:27 CET; 1s ago
Process: 1363 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
Main PID: 1363 (code=exited, status=1/FAILURE)

I've changed the path in homebridge.service file as explained by Neblite, but it doesn't help.

Thanx a lot in advance for your help !
Jerome

@emmotive

This comment has been minimized.

Show comment
Hide comment
@emmotive

emmotive Feb 18, 2016

I had difficulty with same errors as listed above until taking two actions:

  1. Inserting 'local' into the file location as neblite stated;
  2. Making sure that /var/homebridge really was writable by the user 'homebridge' (set to 777).

Then repeating the steps:

systemctl daemon-reload
systemctl enable homebridge
systemctl start homebridge

I had difficulty with same errors as listed above until taking two actions:

  1. Inserting 'local' into the file location as neblite stated;
  2. Making sure that /var/homebridge really was writable by the user 'homebridge' (set to 777).

Then repeating the steps:

systemctl daemon-reload
systemctl enable homebridge
systemctl start homebridge

@codenko

This comment has been minimized.

Show comment
Hide comment
@codenko

codenko Feb 19, 2016

Ah, so getting more into this, when I try enabling homebridge, I get a whole bunch of errors.

sudo systemctl enable homebridge
Synchronizing state for homebridge.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d homebridge defaults
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for `Provides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for `Provides:' please add.

codenko commented Feb 19, 2016

Ah, so getting more into this, when I try enabling homebridge, I get a whole bunch of errors.

sudo systemctl enable homebridge
Synchronizing state for homebridge.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d homebridge defaults
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for `Provides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for `Provides:' please add.

@Neblite

This comment has been minimized.

Show comment
Hide comment
@Neblite

Neblite Feb 20, 2016

@codenko its likely that homebridge is already running in the background.
Verify whether or not this is true by running with the following command "systemctl status homebridge" or "journalctl -u homebridge"

You can also see if the process has already started with "ps aux | grep -i homebridge"

Neblite commented Feb 20, 2016

@codenko its likely that homebridge is already running in the background.
Verify whether or not this is true by running with the following command "systemctl status homebridge" or "journalctl -u homebridge"

You can also see if the process has already started with "ps aux | grep -i homebridge"

@CBK482

This comment has been minimized.

Show comment
Hide comment
@CBK482

CBK482 Feb 22, 2016

For me, it started up, but everything seemed offling in Homekit app. Could not see the homebridge and accesories anymore.
I needed to remove and add again from the homekit db. I think it has something todo with the persistence directory not being copied from the original .homebridge folder. (only copied config.json to /var/homebridge)

sudo systemctl -l status homebridge adds also the tail of the log to the output

CBK482 commented Feb 22, 2016

For me, it started up, but everything seemed offling in Homekit app. Could not see the homebridge and accesories anymore.
I needed to remove and add again from the homekit db. I think it has something todo with the persistence directory not being copied from the original .homebridge folder. (only copied config.json to /var/homebridge)

sudo systemctl -l status homebridge adds also the tail of the log to the output

@thezepter

This comment has been minimized.

Show comment
Hide comment
@thezepter

thezepter Feb 26, 2016

Same Problem here.

I´ve found a solution !!!

I copied the "persist" directory to the new directory /var/homebridge

sudo cp -r ~/.homebridge/persist /var/homebridge

geht

Works fine !
finally I can sometimes contribute ;-)

Same Problem here.

I´ve found a solution !!!

I copied the "persist" directory to the new directory /var/homebridge

sudo cp -r ~/.homebridge/persist /var/homebridge

geht

Works fine !
finally I can sometimes contribute ;-)

@lessphiling

This comment has been minimized.

Show comment
Hide comment
@lessphiling

lessphiling Mar 31, 2016

Sorry for the newbie question, but how do I make the user homebridge have write access to /var/homebridge

Sorry for the newbie question, but how do I make the user homebridge have write access to /var/homebridge

@Melkor82

This comment has been minimized.

Show comment
Hide comment
@Melkor82

Melkor82 Apr 13, 2016

sudo chown -R homebridge:homebridge /var/homebridge
sudo chmod 777 -R /var/homebridge

sudo chown -R homebridge:homebridge /var/homebridge
sudo chmod 777 -R /var/homebridge

@snizzleorg

This comment has been minimized.

Show comment
Hide comment
@snizzleorg

snizzleorg May 21, 2016

I get this:

May 21 09:47:28 automator homebridge[30832]: [5/21/2016, 9:47:28 AM] Loading 1 platforms...
May 21 09:47:28 automator homebridge[30832]: [5/21/2016, 9:47:28 AM] [Vera] Initializing Vera platform...
May 21 09:47:28 automator homebridge[30832]: /usr/local/lib/node_modules/homebridge-vera/index.js:104
May 21 09:47:28 automator homebridge[30832]: if ( e.code != 'EEXIST' ) throw e;
May 21 09:47:28 automator homebridge[30832]: ^
May 21 09:47:28 automator homebridge[30832]: Error: ENOENT: no such file or directory, mkdir '/home/homebridge/.veralink'
May 21 09:47:28 automator homebridge[30832]: at Error (native)
May 21 09:47:28 automator homebridge[30832]: at Object.fs.mkdirSync (fs.js:794:18)
May 21 09:47:28 automator homebridge[30832]: at loadconfig (/usr/local/lib/node_modules/homebridge-vera/index.js:101:16)
May 21 09:47:28 automator homebridge[30832]: at Object.VeraLinkPlatform (/usr/local/lib/node_modules/homebridge-vera/index.js:23:23)
May 21 09:47:28 automator homebridge[30832]: at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:273:32)
May 21 09:47:28 automator homebridge[30832]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:71:36)
May 21 09:47:28 automator homebridge[30832]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
May 21 09:47:28 automator homebridge[30832]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
May 21 09:47:28 automator homebridge[30832]: at Module._compile (module.js:409:26)
May 21 09:47:28 automator homebridge[30832]: at Object.Module._extensions..js (module.js:416:10)
May 21 09:47:28 automator systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
May 21 09:47:28 automator systemd[1]: Unit homebridge.service entered failed state.

so somehow home bridge still wants to write to the users home directory. Any clues on how to tell it to use /var/homebridge instead?

I get this:

May 21 09:47:28 automator homebridge[30832]: [5/21/2016, 9:47:28 AM] Loading 1 platforms...
May 21 09:47:28 automator homebridge[30832]: [5/21/2016, 9:47:28 AM] [Vera] Initializing Vera platform...
May 21 09:47:28 automator homebridge[30832]: /usr/local/lib/node_modules/homebridge-vera/index.js:104
May 21 09:47:28 automator homebridge[30832]: if ( e.code != 'EEXIST' ) throw e;
May 21 09:47:28 automator homebridge[30832]: ^
May 21 09:47:28 automator homebridge[30832]: Error: ENOENT: no such file or directory, mkdir '/home/homebridge/.veralink'
May 21 09:47:28 automator homebridge[30832]: at Error (native)
May 21 09:47:28 automator homebridge[30832]: at Object.fs.mkdirSync (fs.js:794:18)
May 21 09:47:28 automator homebridge[30832]: at loadconfig (/usr/local/lib/node_modules/homebridge-vera/index.js:101:16)
May 21 09:47:28 automator homebridge[30832]: at Object.VeraLinkPlatform (/usr/local/lib/node_modules/homebridge-vera/index.js:23:23)
May 21 09:47:28 automator homebridge[30832]: at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:273:32)
May 21 09:47:28 automator homebridge[30832]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:71:36)
May 21 09:47:28 automator homebridge[30832]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
May 21 09:47:28 automator homebridge[30832]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
May 21 09:47:28 automator homebridge[30832]: at Module._compile (module.js:409:26)
May 21 09:47:28 automator homebridge[30832]: at Object.Module._extensions..js (module.js:416:10)
May 21 09:47:28 automator systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
May 21 09:47:28 automator systemd[1]: Unit homebridge.service entered failed state.

so somehow home bridge still wants to write to the users home directory. Any clues on how to tell it to use /var/homebridge instead?

@snizzleorg

This comment has been minimized.

Show comment
Hide comment
@snizzleorg

snizzleorg May 21, 2016

not sure if it is the right thing to do but I changed the home bridge home directory like this:

sudo usermod -m -d /var/homebridge homebridge

now its working

not sure if it is the right thing to do but I changed the home bridge home directory like this:

sudo usermod -m -d /var/homebridge homebridge

now its working

@marl0n

This comment has been minimized.

Show comment
Hide comment
@marl0n

marl0n May 23, 2016

Hi all, I'm a complete newbie in LINUX/RPi, but I once managed to get the Homebridge service working. I'm now reconfiguring my RPi and try to recreate this, but without luck. I've started out with a OS img with Domoticz and Homebridge pre-installed. After that I followed the steps as described here. I've also tried all the troubleshooting mentioned in the comments above, reinstalling, messing with privileges, moving files around.. barely knowing what I'm doing though ;)

What I'm getting when doing a systemctl status homebridge is sometimes a green light:

💚

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: active (running) since Mon 2016-05-23 14:16:42 UTC; 1s ago
 Main PID: 896 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─896 homebridge

But that only lasts for a second or so. Mostly I get:

🔴

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2016-05-23 14:16:44 UTC; 79ms ago
  Process: 896 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 896 (code=exited, status=1/FAILURE)

When starting Homebridge manually it did work. What am I doing wrong? I'm sometimes not sure in what user I have to do the commands: pi? homebridge? root?

Maybe someone knows the answer? :) Would be great!

SOLVED see next comment

marl0n commented May 23, 2016

Hi all, I'm a complete newbie in LINUX/RPi, but I once managed to get the Homebridge service working. I'm now reconfiguring my RPi and try to recreate this, but without luck. I've started out with a OS img with Domoticz and Homebridge pre-installed. After that I followed the steps as described here. I've also tried all the troubleshooting mentioned in the comments above, reinstalling, messing with privileges, moving files around.. barely knowing what I'm doing though ;)

What I'm getting when doing a systemctl status homebridge is sometimes a green light:

💚

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: active (running) since Mon 2016-05-23 14:16:42 UTC; 1s ago
 Main PID: 896 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─896 homebridge

But that only lasts for a second or so. Mostly I get:

🔴

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2016-05-23 14:16:44 UTC; 79ms ago
  Process: 896 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 896 (code=exited, status=1/FAILURE)

When starting Homebridge manually it did work. What am I doing wrong? I'm sometimes not sure in what user I have to do the commands: pi? homebridge? root?

Maybe someone knows the answer? :) Would be great!

SOLVED see next comment

@marl0n

This comment has been minimized.

Show comment
Hide comment
@marl0n

marl0n May 23, 2016

I think I found the problem. It was in the config.json file. Fixed an it now works sort of. Seems like Homebridge get stuck on something when starting after a reboot:

[eDomoticz] There was a problem connecting to Domoticz.

If I restart it by hand, it runs flawless:

sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge

So my 5 cents are that Homebridge is starting up while Domoticz is also busy startingup.. Homebridge is there faster and gets stuck. Is there a way to delay the startup of Homebridge?

SOLVED:
I used the great suggestion of desvdp:

I'd suggest also waiting for the network to come up (otherwise platforms depending on an ip address might crash during boot)
After=syslog.target network-online.target

Thx man! :)

marl0n commented May 23, 2016

I think I found the problem. It was in the config.json file. Fixed an it now works sort of. Seems like Homebridge get stuck on something when starting after a reboot:

[eDomoticz] There was a problem connecting to Domoticz.

If I restart it by hand, it runs flawless:

sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge

So my 5 cents are that Homebridge is starting up while Domoticz is also busy startingup.. Homebridge is there faster and gets stuck. Is there a way to delay the startup of Homebridge?

SOLVED:
I used the great suggestion of desvdp:

I'd suggest also waiting for the network to come up (otherwise platforms depending on an ip address might crash during boot)
After=syslog.target network-online.target

Thx man! :)

@jcbriones

This comment has been minimized.

Show comment
Hide comment
@jcbriones

jcbriones May 31, 2016

Hey guys I need help. I am getting this error.

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2016-05-31 11:19:27 PHT; 8s ago
  Process: 2660 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 2660 (code=exited, status=1/FAILURE)

May 31 11:19:27 sanchezhomekit systemd[1]: Unit homebridge.service entered failed state.

jcbriones commented May 31, 2016

Hey guys I need help. I am getting this error.

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2016-05-31 11:19:27 PHT; 8s ago
  Process: 2660 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 2660 (code=exited, status=1/FAILURE)

May 31 11:19:27 sanchezhomekit systemd[1]: Unit homebridge.service entered failed state.
@impressiver

This comment has been minimized.

Show comment
Hide comment
@impressiver

impressiver Jun 3, 2016

I compiled the steps I used in this quickstart. It's not nearly as detailed as the discussion here, but might help those having issues to see it all distilled down to a minimum configuration.

I compiled the steps I used in this quickstart. It's not nearly as detailed as the discussion here, but might help those having issues to see it all distilled down to a minimum configuration.

@jcbriones

This comment has been minimized.

Show comment
Hide comment
@jcbriones

jcbriones Jun 11, 2016

I see this in my error log

-- Logs begin at Sat 2016-06-11 20:53:42 PHT, end at Sat 2016-06-11 20:55:41 PHT. --
Jun 11 20:53:53 homekit systemd[1]: Starting Node.js HomeKit Server...
Jun 11 20:53:53 homekit systemd[1]: Started Node.js HomeKit Server.
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Jun 11 20:53:55 homekit node[619]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Jun 11 20:53:55 homekit node[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit node[619]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
Jun 11 20:53:55 homekit node[619]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partia
Jun 11 20:53:55 homekit node[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit node[619]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRe
Jun 11 20:53:56 homekit homebridge[619]: [Sat Jun 11 2016 20:53:56 GMT+0800 (PHT)] Loaded plugin: homebridge-people
Jun 11 20:53:56 homekit homebridge[619]: [Sat Jun 11 2016 20:53:56 GMT+0800 (PHT)] Registering accessory 'homebridge-people.people'
Jun 11 20:53:56 homekit homebridge[619]: [Sat Jun 11 2016 20:53:56 GMT+0800 (PHT)] ---
Jun 11 20:53:56 homekit homebridge[619]: wiringPiSetup: Unable to open /dev/gpiomem: Permission denied
Jun 11 20:53:56 homekit systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
Jun 11 20:53:56 homekit systemd[1]: Unit homebridge.service entered failed state.
Jun 11 20:54:15 homekit systemd[1]: homebridge.service holdoff time over, scheduling restart.
Jun 11 20:54:15 homekit systemd[1]: Stopping Node.js HomeKit Server...

I see this in my error log

-- Logs begin at Sat 2016-06-11 20:53:42 PHT, end at Sat 2016-06-11 20:55:41 PHT. --
Jun 11 20:53:53 homekit systemd[1]: Starting Node.js HomeKit Server...
Jun 11 20:53:53 homekit systemd[1]: Started Node.js HomeKit Server.
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Jun 11 20:53:55 homekit node[619]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Jun 11 20:53:55 homekit node[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit node[619]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
Jun 11 20:53:55 homekit node[619]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partia
Jun 11 20:53:55 homekit node[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit node[619]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jun 11 20:53:55 homekit homebridge[619]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRe
Jun 11 20:53:56 homekit homebridge[619]: [Sat Jun 11 2016 20:53:56 GMT+0800 (PHT)] Loaded plugin: homebridge-people
Jun 11 20:53:56 homekit homebridge[619]: [Sat Jun 11 2016 20:53:56 GMT+0800 (PHT)] Registering accessory 'homebridge-people.people'
Jun 11 20:53:56 homekit homebridge[619]: [Sat Jun 11 2016 20:53:56 GMT+0800 (PHT)] ---
Jun 11 20:53:56 homekit homebridge[619]: wiringPiSetup: Unable to open /dev/gpiomem: Permission denied
Jun 11 20:53:56 homekit systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
Jun 11 20:53:56 homekit systemd[1]: Unit homebridge.service entered failed state.
Jun 11 20:54:15 homekit systemd[1]: homebridge.service holdoff time over, scheduling restart.
Jun 11 20:54:15 homekit systemd[1]: Stopping Node.js HomeKit Server...

@dreameruk

This comment has been minimized.

Show comment
Hide comment
@dreameruk

dreameruk Jun 12, 2016

Thanks for this, completed all the steps however when try to start the service I get the following errors:

pi@raspberrypi ~ $ systemctl daemon-reload
bash: systemctl: command not found
pi@raspberrypi ~ $ systemctl enable homebridge
bash: systemctl: command not found
pi@raspberrypi ~ $ systemctl start homebridge
bash: systemctl: command not found
pi@raspberrypi ~ $

Thanks

Thanks for this, completed all the steps however when try to start the service I get the following errors:

pi@raspberrypi ~ $ systemctl daemon-reload
bash: systemctl: command not found
pi@raspberrypi ~ $ systemctl enable homebridge
bash: systemctl: command not found
pi@raspberrypi ~ $ systemctl start homebridge
bash: systemctl: command not found
pi@raspberrypi ~ $

Thanks

@gregoiredore

This comment has been minimized.

Show comment
Hide comment
@gregoiredore

gregoiredore Jun 19, 2016

Hi there
Still having the same issue : green / red light with systemctl status homebridge command...
When I lunch homebridge manually everything is fine... Can't figure out what I am doing wrong
Thanks for your help

Hi there
Still having the same issue : green / red light with systemctl status homebridge command...
When I lunch homebridge manually everything is fine... Can't figure out what I am doing wrong
Thanks for your help

@Dracoy

This comment has been minimized.

Show comment
Hide comment
@Dracoy

Dracoy Jun 30, 2016

Same issue as @dreameruk - command not found, anyone know why?

Dracoy commented Jun 30, 2016

Same issue as @dreameruk - command not found, anyone know why?

@kaaspad

This comment has been minimized.

Show comment
Hide comment
@kaaspad

kaaspad Jul 14, 2016

Hi I was wondering why the need for another user (homebridge) and the creation of config under var? Since the setup is done mostly using a default user like "pi" why not just use the defaults? As well as the default location for the config?
I set up mine as follows and it works great - is there an issue with doing it like this?

pi@YYYY:~ $ more /etc/default/homebridge
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /home/pi/.homebridge

# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u home bridge
# DEBUG=*

and then the service looks like this:

[Unit]
Description=homebridge_service
After=basic.target
[Service]
Type=simple
User=pi
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-abort
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target

I'm not even sure that the above flag "Type"

kaaspad commented Jul 14, 2016

Hi I was wondering why the need for another user (homebridge) and the creation of config under var? Since the setup is done mostly using a default user like "pi" why not just use the defaults? As well as the default location for the config?
I set up mine as follows and it works great - is there an issue with doing it like this?

pi@YYYY:~ $ more /etc/default/homebridge
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /home/pi/.homebridge

# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u home bridge
# DEBUG=*

and then the service looks like this:

[Unit]
Description=homebridge_service
After=basic.target
[Service]
Type=simple
User=pi
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-abort
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target

I'm not even sure that the above flag "Type"

@espresso1736

This comment has been minimized.

Show comment
Hide comment
@espresso1736

espresso1736 Jul 22, 2016

@kaaspad I too would like to know why the separate homebridge user is necessary, however from my experience it really is. I'd initially set up homebridge with the config.json in /home/pi/.homebridge. After some initial success, homebridge failed to run at boot time. I could still run it directly (just typing "homebridge"), but it failed to start when using systemctl. Looking at the errors, it appeared to be related to not being able to access the persist directory.

Changing to a separate homebridge user and putting the config.json in /var/homebridge (and having that directory owned by and writable by the homebridge user) fixed things.

@kaaspad I too would like to know why the separate homebridge user is necessary, however from my experience it really is. I'd initially set up homebridge with the config.json in /home/pi/.homebridge. After some initial success, homebridge failed to run at boot time. I could still run it directly (just typing "homebridge"), but it failed to start when using systemctl. Looking at the errors, it appeared to be related to not being able to access the persist directory.

Changing to a separate homebridge user and putting the config.json in /var/homebridge (and having that directory owned by and writable by the homebridge user) fixed things.

@jilsx

This comment has been minimized.

Show comment
Hide comment
@jilsx

jilsx Jul 29, 2016

I just solved my problem with the Homebridge service not starting... I changed the password to Home Assistant, but failed to update the config.json for Homebridge. Newbie error :(

jilsx commented Jul 29, 2016

I just solved my problem with the Homebridge service not starting... I changed the password to Home Assistant, but failed to update the config.json for Homebridge. Newbie error :(

@johannrichard

This comment has been minimized.

Show comment
Hide comment
@johannrichard

johannrichard Aug 9, 2016

@espresso1736 @kaaspad, technically, using the default user pi and keeping the configuration under /home/pi/.homebridge is fine and works, as you found out. However, it is considered best practice to run a service (any service) on a Linux system under its dedicated, own user account. Benefits are better security (credentials and other security elements like tokens are only accessible to this user and root), a clearer separation from things run by a user vs. things running when the system starts etc.

If you look at other service definitions on your Raspberry Pi, you will find that most if not all of them operate this way. The downside is that running homebridge for debugging purposes with your user account is getting more difficult.

I hope that helps.

Owner

johannrichard commented Aug 9, 2016

@espresso1736 @kaaspad, technically, using the default user pi and keeping the configuration under /home/pi/.homebridge is fine and works, as you found out. However, it is considered best practice to run a service (any service) on a Linux system under its dedicated, own user account. Benefits are better security (credentials and other security elements like tokens are only accessible to this user and root), a clearer separation from things run by a user vs. things running when the system starts etc.

If you look at other service definitions on your Raspberry Pi, you will find that most if not all of them operate this way. The downside is that running homebridge for debugging purposes with your user account is getting more difficult.

I hope that helps.

@johannrichard

This comment has been minimized.

Show comment
Hide comment
@johannrichard

johannrichard Aug 9, 2016

@Dracoy @dreameruk essentially, this means that your Raspberry Pi is running services with sysvinit, the older and arguably more complicated way to create and run services, and that systemd is missing.

It could be that the version of your operating system is an older one. If I recall correctly (and as stated in the first comment), it's only newer Raspbian/Debian versions (I.e. jessie based) that use systemd for running services, whereas wheezy based Raspbian still use sysvinit.

Try

cat /etc/*-release

or

cat /proc/version

or

lsb_release -a

to find out which version of Debian/Raspbian you're running.

Owner

johannrichard commented Aug 9, 2016

@Dracoy @dreameruk essentially, this means that your Raspberry Pi is running services with sysvinit, the older and arguably more complicated way to create and run services, and that systemd is missing.

It could be that the version of your operating system is an older one. If I recall correctly (and as stated in the first comment), it's only newer Raspbian/Debian versions (I.e. jessie based) that use systemd for running services, whereas wheezy based Raspbian still use sysvinit.

Try

cat /etc/*-release

or

cat /proc/version

or

lsb_release -a

to find out which version of Debian/Raspbian you're running.

@johannrichard

This comment has been minimized.

Show comment
Hide comment
@johannrichard

johannrichard Aug 9, 2016

@jcbriones I guess the culprit is one of your plugins and/or missing rights. In your log, you find a line where wiringPi is complaining about missing access to /dev/gpiomem.

You would have to find out whether this particular device exists (assuming you run this on a Raspberry Pi or compatible board, it should) and if so, whether there are some user rights need to be set.

Since I'm not familiar with wiringPi and don't know what board and setup you have, I'm afraid you have to figure this out yourself.

Maybe this article from the author of wiringPi is a good starting point, assuming that you are somewhat familiar with Linux commands and concepts.

http://wiringpi.com/wiringpi-update-to-2-29/

Owner

johannrichard commented Aug 9, 2016

@jcbriones I guess the culprit is one of your plugins and/or missing rights. In your log, you find a line where wiringPi is complaining about missing access to /dev/gpiomem.

You would have to find out whether this particular device exists (assuming you run this on a Raspberry Pi or compatible board, it should) and if so, whether there are some user rights need to be set.

Since I'm not familiar with wiringPi and don't know what board and setup you have, I'm afraid you have to figure this out yourself.

Maybe this article from the author of wiringPi is a good starting point, assuming that you are somewhat familiar with Linux commands and concepts.

http://wiringpi.com/wiringpi-update-to-2-29/

@johannrichard

This comment has been minimized.

Show comment
Hide comment
@johannrichard

johannrichard Aug 9, 2016

Thanks for all the many comments, I have added some modifications to the script, namely using /usr/local/bin as path and adding a dependency for network-online.target to the service definition.

Owner

johannrichard commented Aug 9, 2016

Thanks for all the many comments, I have added some modifications to the script, namely using /usr/local/bin as path and adding a dependency for network-online.target to the service definition.

@setje

This comment has been minimized.

Show comment
Hide comment
@setje

setje Aug 12, 2016

Hello,
I am running homebridge on a Raspberry Pi 2 with Debian jessie. Everything works fine, I can control my Homematic devices per iOS 10 Home app.
Then I decided to start homebridge automatically on boot. The homebridge is starting, but I don't see my devices (e.g. thermostats). When I type sudo systemctl stop homebridge followed by sudo systemctl start homebridge the devices are visible.

When is look for active processes by typing ps aux | grep -i homebridge I get the following results:

homebri+ 1519 3.2 4.2 137688 41992 ? Ssl 06:11 0:06 homebridge
pi 1561 0.0 0.1 4276 1896 pts/2 S+ 06:14 0:00 grep --color=auto -i homebridge

What am I doing wrong? Thank you!

setje commented Aug 12, 2016

Hello,
I am running homebridge on a Raspberry Pi 2 with Debian jessie. Everything works fine, I can control my Homematic devices per iOS 10 Home app.
Then I decided to start homebridge automatically on boot. The homebridge is starting, but I don't see my devices (e.g. thermostats). When I type sudo systemctl stop homebridge followed by sudo systemctl start homebridge the devices are visible.

When is look for active processes by typing ps aux | grep -i homebridge I get the following results:

homebri+ 1519 3.2 4.2 137688 41992 ? Ssl 06:11 0:06 homebridge
pi 1561 0.0 0.1 4276 1896 pts/2 S+ 06:14 0:00 grep --color=auto -i homebridge

What am I doing wrong? Thank you!

@apache-123

This comment has been minimized.

Show comment
Hide comment
@apache-123

apache-123 Aug 19, 2016

@setje. I have a similar issue with openhab and homebridge. I also have a harmony which loads fine. Looking at the logs it seemed like the homebridge is coming online before openhab is online so the devices are not visible. When i do the stop and start the openhab is online by then and so it works. need help figuring out where to make the change and what exactly to type.

@setje. I have a similar issue with openhab and homebridge. I also have a harmony which loads fine. Looking at the logs it seemed like the homebridge is coming online before openhab is online so the devices are not visible. When i do the stop and start the openhab is online by then and so it works. need help figuring out where to make the change and what exactly to type.

@apache-123

This comment has been minimized.

Show comment
Hide comment
@apache-123

apache-123 Aug 20, 2016

I did another image and installed homebridge using the systemd method. Homebridge service is running but it seems it started before openhab service could start

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (running) since Sat 2016-08-20 00:10:06 UTC; 7min ago
Main PID: 564 (homebridge)
CGroup: /system.slice/homebridge.service
└─564 homebridge

Aug 20 00:10:33 raspberrypi homebridge[564]: [8/20/2016, 12:10:33 AM] [openHAB] Platform - Connecting to http://192.168.100.18:8080/rest/sitemaps/MyHomebridge?type=json
Aug 20 00:10:33 raspberrypi homebridge[564]: [8/20/2016, 12:10:33 AM] [openHAB] Platform - There was a problem connecting to OpenHAB.
Aug 20 00:10:35 raspberrypi homebridge[564]: [8/20/2016, 12:10:35 AM] [Living Room Harmony Hub] Fetching Logitech Harmony activities...
Aug 20 00:10:36 raspberrypi homebridge[564]: [8/20/2016, 12:10:36 AM] [Living Room Harmony Hub] Found activities:
Aug 20 00:10:36 raspberrypi homebridge[564]: Night Night
Aug 20 00:10:36 raspberrypi homebridge[564]: All off
Aug 20 00:10:36 raspberrypi homebridge[564]: CableTV
Aug 20 00:10:36 raspberrypi homebridge[564]: Apple TV
Aug 20 00:10:36 raspberrypi homebridge[564]: PowerOff
Aug 20 00:10:36 raspberrypi homebridge[564]: Friday Night

pi@raspberrypi:~ $ journalctl -u homebridge
No journal files were found.

pi@raspberrypi:~ $ ls -l /var/homebridge
total 12
drwxr-xr-x 2 homebridge homebridge 4096 Aug 19 23:41 accessories
-rwxrwxrwx 1 homebridge homebridge 444 Aug 19 23:16 config.json
drwxr-xr-x 2 homebridge homebridge 4096 Aug 19 23:41 persist

any help would be very much appreciated. it works if i restart using systemctl restart homebridge after a few mins of booting

pi@raspberrypi:~ $ sudo systemctl restart homebridge
pi@raspberrypi:~ $ sudo systemctl status homebridge -l
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (running) since Sat 2016-08-20 00:23:49 UTC; 27s ago
Main PID: 1665 (homebridge)
CGroup: /system.slice/homebridge.service
└─1665 homebridge

Aug 20 00:23:58 raspberrypi homebridge[1665]: [8/20/2016, 12:23:58 AM] [openHAB] OpenHAB WS - new connection for Living Room Sofa
Aug 20 00:23:58 raspberrypi homebridge[1665]: [8/20/2016, 12:23:58 AM] [openHAB] OpenHAB WS - new connection for Toilet
Aug 20 00:23:58 raspberrypi homebridge[1665]: [8/20/2016, 12:23:58 AM] [Living Room Harmony Hub] Fetching Logitech Harmony activities...
Aug 20 00:24:00 raspberrypi homebridge[1665]: [8/20/2016, 12:24:00 AM] [Living Room Harmony Hub] Found activities:
Aug 20 00:24:00 raspberrypi homebridge[1665]: Night Night
Aug 20 00:24:00 raspberrypi homebridge[1665]: All off
Aug 20 00:24:00 raspberrypi homebridge[1665]: CableTV
Aug 20 00:24:00 raspberrypi homebridge[1665]: Apple TV
Aug 20 00:24:00 raspberrypi homebridge[1665]: PowerOff
Aug 20 00:24:00 raspberrypi homebridge[1665]: Friday Night

I did another image and installed homebridge using the systemd method. Homebridge service is running but it seems it started before openhab service could start

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (running) since Sat 2016-08-20 00:10:06 UTC; 7min ago
Main PID: 564 (homebridge)
CGroup: /system.slice/homebridge.service
└─564 homebridge

Aug 20 00:10:33 raspberrypi homebridge[564]: [8/20/2016, 12:10:33 AM] [openHAB] Platform - Connecting to http://192.168.100.18:8080/rest/sitemaps/MyHomebridge?type=json
Aug 20 00:10:33 raspberrypi homebridge[564]: [8/20/2016, 12:10:33 AM] [openHAB] Platform - There was a problem connecting to OpenHAB.
Aug 20 00:10:35 raspberrypi homebridge[564]: [8/20/2016, 12:10:35 AM] [Living Room Harmony Hub] Fetching Logitech Harmony activities...
Aug 20 00:10:36 raspberrypi homebridge[564]: [8/20/2016, 12:10:36 AM] [Living Room Harmony Hub] Found activities:
Aug 20 00:10:36 raspberrypi homebridge[564]: Night Night
Aug 20 00:10:36 raspberrypi homebridge[564]: All off
Aug 20 00:10:36 raspberrypi homebridge[564]: CableTV
Aug 20 00:10:36 raspberrypi homebridge[564]: Apple TV
Aug 20 00:10:36 raspberrypi homebridge[564]: PowerOff
Aug 20 00:10:36 raspberrypi homebridge[564]: Friday Night

pi@raspberrypi:~ $ journalctl -u homebridge
No journal files were found.

pi@raspberrypi:~ $ ls -l /var/homebridge
total 12
drwxr-xr-x 2 homebridge homebridge 4096 Aug 19 23:41 accessories
-rwxrwxrwx 1 homebridge homebridge 444 Aug 19 23:16 config.json
drwxr-xr-x 2 homebridge homebridge 4096 Aug 19 23:41 persist

any help would be very much appreciated. it works if i restart using systemctl restart homebridge after a few mins of booting

pi@raspberrypi:~ $ sudo systemctl restart homebridge
pi@raspberrypi:~ $ sudo systemctl status homebridge -l
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (running) since Sat 2016-08-20 00:23:49 UTC; 27s ago
Main PID: 1665 (homebridge)
CGroup: /system.slice/homebridge.service
└─1665 homebridge

Aug 20 00:23:58 raspberrypi homebridge[1665]: [8/20/2016, 12:23:58 AM] [openHAB] OpenHAB WS - new connection for Living Room Sofa
Aug 20 00:23:58 raspberrypi homebridge[1665]: [8/20/2016, 12:23:58 AM] [openHAB] OpenHAB WS - new connection for Toilet
Aug 20 00:23:58 raspberrypi homebridge[1665]: [8/20/2016, 12:23:58 AM] [Living Room Harmony Hub] Fetching Logitech Harmony activities...
Aug 20 00:24:00 raspberrypi homebridge[1665]: [8/20/2016, 12:24:00 AM] [Living Room Harmony Hub] Found activities:
Aug 20 00:24:00 raspberrypi homebridge[1665]: Night Night
Aug 20 00:24:00 raspberrypi homebridge[1665]: All off
Aug 20 00:24:00 raspberrypi homebridge[1665]: CableTV
Aug 20 00:24:00 raspberrypi homebridge[1665]: Apple TV
Aug 20 00:24:00 raspberrypi homebridge[1665]: PowerOff
Aug 20 00:24:00 raspberrypi homebridge[1665]: Friday Night

@neoracer

This comment has been minimized.

Show comment
Hide comment
@neoracer

neoracer Sep 11, 2016

Same problem.

Only works if i restart after a few minutes.

Any solution??

Same problem.

Only works if i restart after a few minutes.

Any solution??

@stevenguh

This comment has been minimized.

Show comment
Hide comment
@stevenguh

stevenguh Sep 19, 2016

If your homebridge contains a accessory that uses gpio, your homebridge will likely not work with a user different than root or pi because the homebridge user doesn't have permission to access gpio.

I found two solutions that worked for me, and I only tested with Raspbian Jessie. You can either add homebridge user to gpio group

usermod -a -G gpio homebridge

Or you can remove User=homebridge in homebridge.service

If your homebridge contains a accessory that uses gpio, your homebridge will likely not work with a user different than root or pi because the homebridge user doesn't have permission to access gpio.

I found two solutions that worked for me, and I only tested with Raspbian Jessie. You can either add homebridge user to gpio group

usermod -a -G gpio homebridge

Or you can remove User=homebridge in homebridge.service

@Dave-Casey

This comment has been minimized.

Show comment
Hide comment
@Dave-Casey

Dave-Casey Sep 21, 2016

I feel like i'm really close. When running manually it picks up my config.json file but when running as a service it does not. I see it run but not find any of my devices as it does manually. I've created the user, checked permissions, etc. I just can't figure out how to tell it to find config.json

homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: active (running) since Tue 2016-09-20 20:24:29 PDT; 16min ago
 Main PID: 7749 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─7749 homebridge

Sep 20 20:24:32 raspberrypi homebridge[7749]: [9/20/2016, 8:24:32 PM] Registering platform 'homebridge-smartthings.SmartThings'
Sep 20 20:24:32 raspberrypi homebridge[7749]: [9/20/2016, 8:24:32 PM] ---
Sep 20 20:24:32 raspberrypi homebridge[7749]: Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
Sep 20 20:24:32 raspberrypi homebridge[7749]:
Sep 20 20:24:32 raspberrypi homebridge[7749]:     ┌────────────┐
Sep 20 20:24:32 raspberrypi homebridge[7749]:     │ ***-**-*** │
Sep 20 20:24:32 raspberrypi homebridge[7749]:     └────────────┘
Sep 20 20:24:32 raspberrypi homebridge[7749]:
Sep 20 20:24:32 raspberrypi homebridge[7749]: [9/20/2016, 8:24:32 PM] Homebridge is running on port 51826.
Sep 20 20:40:42 raspberrypi systemd[1]: Started Node.js HomeKit Server.

Any help would be appreciated

Dave-Casey commented Sep 21, 2016

I feel like i'm really close. When running manually it picks up my config.json file but when running as a service it does not. I see it run but not find any of my devices as it does manually. I've created the user, checked permissions, etc. I just can't figure out how to tell it to find config.json

homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: active (running) since Tue 2016-09-20 20:24:29 PDT; 16min ago
 Main PID: 7749 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─7749 homebridge

Sep 20 20:24:32 raspberrypi homebridge[7749]: [9/20/2016, 8:24:32 PM] Registering platform 'homebridge-smartthings.SmartThings'
Sep 20 20:24:32 raspberrypi homebridge[7749]: [9/20/2016, 8:24:32 PM] ---
Sep 20 20:24:32 raspberrypi homebridge[7749]: Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
Sep 20 20:24:32 raspberrypi homebridge[7749]:
Sep 20 20:24:32 raspberrypi homebridge[7749]:     ┌────────────┐
Sep 20 20:24:32 raspberrypi homebridge[7749]:     │ ***-**-*** │
Sep 20 20:24:32 raspberrypi homebridge[7749]:     └────────────┘
Sep 20 20:24:32 raspberrypi homebridge[7749]:
Sep 20 20:24:32 raspberrypi homebridge[7749]: [9/20/2016, 8:24:32 PM] Homebridge is running on port 51826.
Sep 20 20:40:42 raspberrypi systemd[1]: Started Node.js HomeKit Server.

Any help would be appreciated

@SonicRevolutions

This comment has been minimized.

Show comment
Hide comment
@SonicRevolutions

SonicRevolutions Sep 24, 2016

I get this error when using systemd:

Sep 24 23:35:28 raspi systemd[1]: Starting Node.js HomeKit Server...
Sep 24 23:35:28 raspi systemd[1]: Started Node.js HomeKit Server.
Sep 24 23:35:29 raspi homebridge[2206]: module.js:457
Sep 24 23:35:29 raspi homebridge[2206]: throw err;
Sep 24 23:35:29 raspi homebridge[2206]: ^
Sep 24 23:35:29 raspi homebridge[2206]: Error: Cannot find module 'hap-nodejs'
Sep 24 23:35:29 raspi homebridge[2206]: at Function.Module._resolveFilename (module.js:455:15)
Sep 24 23:35:29 raspi homebridge[2206]: at Function.Module._load (module.js:403:25)
Sep 24 23:35:29 raspi homebridge[2206]: at Module.require (module.js:483:17)
Sep 24 23:35:29 raspi homebridge[2206]: at require (internal/module.js:20:19)
Sep 24 23:35:29 raspi homebridge[2206]: at Object. (/usr/local/lib/node_modules/homebridge/lib/cli.js:2:11)
Sep 24 23:35:29 raspi homebridge[2206]: at Module._compile (module.js:556:32)
Sep 24 23:35:29 raspi homebridge[2206]: at Object.Module._extensions..js (module.js:565:10)
Sep 24 23:35:29 raspi homebridge[2206]: at Module.load (module.js:473:32)
Sep 24 23:35:29 raspi homebridge[2206]: at tryModuleLoad (module.js:432:12)
Sep 24 23:35:29 raspi homebridge[2206]: at Function.Module._load (module.js:424:3)
Sep 24 23:35:29 raspi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
Sep 24 23:35:29 raspi systemd[1]: Unit homebridge.service entered failed state.
Sep 24 23:35:35 raspi systemd[1]: Stopping Node.js HomeKit Server...
Sep 24 23:35:35 raspi systemd[1]: Stopped Node.js HomeKit Server.

Starting it from the command line works perfectly:

homebridge@raspi:~$ homebridge -U /var/homebridge
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister
[9/24/2016, 11:18:12 PM] Loaded plugin: homebridge-homewizard
[9/24/2016, 11:18:12 PM] Registering platform 'homebridge-homewizard.HomeWizard'
[9/24/2016, 11:18:12 PM] ---
[9/24/2016, 11:18:13 PM] Loaded plugin: homebridge-sonos
[9/24/2016, 11:18:13 PM] Registering accessory 'homebridge-sonos.Sonos'
[9/24/2016, 11:18:13 PM] ---
[9/24/2016, 11:18:15 PM] Loaded plugin: homebridge-toon
[9/24/2016, 11:18:15 PM] Registering accessory 'homebridge-toon.Toon'
[9/24/2016, 11:18:15 PM] ---
[9/24/2016, 11:18:15 PM] Loaded config.json with 3 accessories and 1 platforms.
[9/24/2016, 11:18:15 PM] ---
[9/24/2016, 11:18:15 PM] Loading 1 platforms...
[9/24/2016, 11:18:15 PM] Initializing HomeWizard platform...
[9/24/2016, 11:18:15 PM] Loading 3 accessories...

Any ideas?

SonicRevolutions commented Sep 24, 2016

I get this error when using systemd:

Sep 24 23:35:28 raspi systemd[1]: Starting Node.js HomeKit Server...
Sep 24 23:35:28 raspi systemd[1]: Started Node.js HomeKit Server.
Sep 24 23:35:29 raspi homebridge[2206]: module.js:457
Sep 24 23:35:29 raspi homebridge[2206]: throw err;
Sep 24 23:35:29 raspi homebridge[2206]: ^
Sep 24 23:35:29 raspi homebridge[2206]: Error: Cannot find module 'hap-nodejs'
Sep 24 23:35:29 raspi homebridge[2206]: at Function.Module._resolveFilename (module.js:455:15)
Sep 24 23:35:29 raspi homebridge[2206]: at Function.Module._load (module.js:403:25)
Sep 24 23:35:29 raspi homebridge[2206]: at Module.require (module.js:483:17)
Sep 24 23:35:29 raspi homebridge[2206]: at require (internal/module.js:20:19)
Sep 24 23:35:29 raspi homebridge[2206]: at Object. (/usr/local/lib/node_modules/homebridge/lib/cli.js:2:11)
Sep 24 23:35:29 raspi homebridge[2206]: at Module._compile (module.js:556:32)
Sep 24 23:35:29 raspi homebridge[2206]: at Object.Module._extensions..js (module.js:565:10)
Sep 24 23:35:29 raspi homebridge[2206]: at Module.load (module.js:473:32)
Sep 24 23:35:29 raspi homebridge[2206]: at tryModuleLoad (module.js:432:12)
Sep 24 23:35:29 raspi homebridge[2206]: at Function.Module._load (module.js:424:3)
Sep 24 23:35:29 raspi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
Sep 24 23:35:29 raspi systemd[1]: Unit homebridge.service entered failed state.
Sep 24 23:35:35 raspi systemd[1]: Stopping Node.js HomeKit Server...
Sep 24 23:35:35 raspi systemd[1]: Stopped Node.js HomeKit Server.

Starting it from the command line works perfectly:

homebridge@raspi:~$ homebridge -U /var/homebridge
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister
[9/24/2016, 11:18:12 PM] Loaded plugin: homebridge-homewizard
[9/24/2016, 11:18:12 PM] Registering platform 'homebridge-homewizard.HomeWizard'
[9/24/2016, 11:18:12 PM] ---
[9/24/2016, 11:18:13 PM] Loaded plugin: homebridge-sonos
[9/24/2016, 11:18:13 PM] Registering accessory 'homebridge-sonos.Sonos'
[9/24/2016, 11:18:13 PM] ---
[9/24/2016, 11:18:15 PM] Loaded plugin: homebridge-toon
[9/24/2016, 11:18:15 PM] Registering accessory 'homebridge-toon.Toon'
[9/24/2016, 11:18:15 PM] ---
[9/24/2016, 11:18:15 PM] Loaded config.json with 3 accessories and 1 platforms.
[9/24/2016, 11:18:15 PM] ---
[9/24/2016, 11:18:15 PM] Loading 1 platforms...
[9/24/2016, 11:18:15 PM] Initializing HomeWizard platform...
[9/24/2016, 11:18:15 PM] Loading 3 accessories...

Any ideas?

@rasputnik

This comment has been minimized.

Show comment
Hide comment
@rasputnik

rasputnik Sep 25, 2016

@SonicRevolutions it looks like the service isn't finding the hap-nodejs module.

Maybe the service runs as a different user, and the module isn't installed globally? If not check environment variables that might be set in your shell but may not be seen by the service.

@SonicRevolutions it looks like the service isn't finding the hap-nodejs module.

Maybe the service runs as a different user, and the module isn't installed globally? If not check environment variables that might be set in your shell but may not be seen by the service.

@SonicRevolutions

This comment has been minimized.

Show comment
Hide comment
@SonicRevolutions

SonicRevolutions Sep 25, 2016

Did some more debugging and found out it tries to create this folder /usr/lib/node_modules/homebridge/node_modules/node-persist/storage and got a permission denied. Could be a permission goof on my part so created the folder and did a chown homebridge. Now it's working properly.

Did some more debugging and found out it tries to create this folder /usr/lib/node_modules/homebridge/node_modules/node-persist/storage and got a permission denied. Could be a permission goof on my part so created the folder and did a chown homebridge. Now it's working properly.

@jorgibravo

This comment has been minimized.

Show comment
Hide comment
@jorgibravo

jorgibravo Sep 26, 2016

Hi!
I followed all the steps, but I kept getting the following error when checking sudo systemctl status homebridge:
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
I coped the persist folder to /var/homebridge

then I went to /usr/local/bin/ and I realized that I cant see anything related to homebridge there..
so I changed the ExecStart to ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS

and then the service started!

Next step was to check the journaltl for any clues about the error and from the logs I found that homebridge complained about:
Error: EACCES: permission denied, open '/var/homebridge/persist/AccessoryInfo.CC223DE3XXXX.jsonI did a chmod 777 on all the files in the persist folder and the service now works!!

Please tell me if this is only a coincidence... or if I did something in the meantime that made the app work!
I am running Raspbian on a Pi2

Hi!
I followed all the steps, but I kept getting the following error when checking sudo systemctl status homebridge:
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
I coped the persist folder to /var/homebridge

then I went to /usr/local/bin/ and I realized that I cant see anything related to homebridge there..
so I changed the ExecStart to ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS

and then the service started!

Next step was to check the journaltl for any clues about the error and from the logs I found that homebridge complained about:
Error: EACCES: permission denied, open '/var/homebridge/persist/AccessoryInfo.CC223DE3XXXX.jsonI did a chmod 777 on all the files in the persist folder and the service now works!!

Please tell me if this is only a coincidence... or if I did something in the meantime that made the app work!
I am running Raspbian on a Pi2

@sebask

This comment has been minimized.

Show comment
Hide comment
@sebask

sebask Sep 28, 2016

@jorgibravo Changing the ExecStart to ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS worked here too. Thanks!

sebask commented Sep 28, 2016

@jorgibravo Changing the ExecStart to ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS worked here too. Thanks!

@nzbadge

This comment has been minimized.

Show comment
Hide comment
@nzbadge

nzbadge Oct 4, 2016

@jorgibravo - your steps fixed my issue also. Thanks heaps

nzbadge commented Oct 4, 2016

@jorgibravo - your steps fixed my issue also. Thanks heaps

@frodeaux

This comment has been minimized.

Show comment
Hide comment
@frodeaux

frodeaux Oct 7, 2016

When enabling this it worked fine. I had no issues. Then I installed an accessory on the pi that requires use of wiring pi that needs root access. The server fails to start. I quit the service and ran it manually, the error I got a "did you run this a sudo" before home bridge exited. So I ran # sudo homebridge -U /var/homebridge. and it started just fine. It will not start via this method however. Is there any way to fix that ?

frodeaux commented Oct 7, 2016

When enabling this it worked fine. I had no issues. Then I installed an accessory on the pi that requires use of wiring pi that needs root access. The server fails to start. I quit the service and ran it manually, the error I got a "did you run this a sudo" before home bridge exited. So I ran # sudo homebridge -U /var/homebridge. and it started just fine. It will not start via this method however. Is there any way to fix that ?

@timleland

This comment has been minimized.

Show comment
Hide comment
@timleland

timleland Oct 13, 2016

This gist and comments help me to get Homebridge to start on boot on my Raspberry Pi. I did run into some issues and detailed my instructions in a blog post: https://timleland.com/setup-homebridge-to-start-on-bootup/ Hope this helps others.

timleland commented Oct 13, 2016

This gist and comments help me to get Homebridge to start on boot on my Raspberry Pi. I did run into some issues and detailed my instructions in a blog post: https://timleland.com/setup-homebridge-to-start-on-bootup/ Hope this helps others.

@Cloudore

This comment has been minimized.

Show comment
Hide comment
@Cloudore

Cloudore Oct 14, 2016

Complete unix and command line first timer here, while following all these steps, I get home bridge to start at boot, however I have no idea how to do the following step:

Homebridge by default looks for its configuration in /home//.homebridge. This is unsuitable for services and the -U /var/homebridge flag ensures the config is read from a different place.

I tried /home/pi/.homebridge -U /var/homebridge but it kept telling me it was a directory, could anyone help me on the proper syntax for this step?

Also, If I let homebridge boot this way, then ssh into the pi and type homebridge in terminal, it will start up and show me the code just fine but below it will be an error message: dns conflict, but if I sudo kill the process and start homebridge again it runs just fine.

Any help would be much appreciated!

Cloudore commented Oct 14, 2016

Complete unix and command line first timer here, while following all these steps, I get home bridge to start at boot, however I have no idea how to do the following step:

Homebridge by default looks for its configuration in /home//.homebridge. This is unsuitable for services and the -U /var/homebridge flag ensures the config is read from a different place.

I tried /home/pi/.homebridge -U /var/homebridge but it kept telling me it was a directory, could anyone help me on the proper syntax for this step?

Also, If I let homebridge boot this way, then ssh into the pi and type homebridge in terminal, it will start up and show me the code just fine but below it will be an error message: dns conflict, but if I sudo kill the process and start homebridge again it runs just fine.

Any help would be much appreciated!

@Kerat5

This comment has been minimized.

Show comment
Hide comment
@Kerat5

Kerat5 Oct 20, 2016

Thank you Cloudore, the help with the permissions was exactly one of the problems I had. I was able to resolve creating the system account and changing the permissions on the associated directories and files on my own. otherwise johannrichard's guide is perfect.

Kerat5 commented Oct 20, 2016

Thank you Cloudore, the help with the permissions was exactly one of the problems I had. I was able to resolve creating the system account and changing the permissions on the associated directories and files on my own. otherwise johannrichard's guide is perfect.

@jcleek

This comment has been minimized.

Show comment
Hide comment
@jcleek

jcleek Dec 6, 2016

If you were sent here from https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi and you followed those instructions, you probably removed "local" from the path in the "Install Homebridge and dependencies" section and are having issues getting the service to run automatically, BUT when you run homebridge manually it works perfectly:

The issue is in the file homebridge.service above. Notice line 9:

ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS

That is incorrect because when you followed the instructions to install node.js using the apt-get method. If you did that, simply remove the local from the path to look like:

ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS

Save it and re-do these commands to set up the service again:

sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge

jcleek commented Dec 6, 2016

If you were sent here from https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi and you followed those instructions, you probably removed "local" from the path in the "Install Homebridge and dependencies" section and are having issues getting the service to run automatically, BUT when you run homebridge manually it works perfectly:

The issue is in the file homebridge.service above. Notice line 9:

ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS

That is incorrect because when you followed the instructions to install node.js using the apt-get method. If you did that, simply remove the local from the path to look like:

ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS

Save it and re-do these commands to set up the service again:

sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge

@sonicspeedway

This comment has been minimized.

Show comment
Hide comment
@sonicspeedway

sonicspeedway Dec 15, 2016

im getting this
homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2016-12-14 19:00:59 CST; 5s ago
Process: 1328 ExecStart=/usr/local/node/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS
Main PID: 1328 (code=exited, status=126)

Dec 14 19:00:59 ubuntu systemd[1]: homebridge.service: Unit entered failed state.
Dec 14 19:00:59 ubuntu systemd[1]: homebridge.service: Failed with result 'exit-code'.

im getting this
homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2016-12-14 19:00:59 CST; 5s ago
Process: 1328 ExecStart=/usr/local/node/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS
Main PID: 1328 (code=exited, status=126)

Dec 14 19:00:59 ubuntu systemd[1]: homebridge.service: Unit entered failed state.
Dec 14 19:00:59 ubuntu systemd[1]: homebridge.service: Failed with result 'exit-code'.

@quicksilverusu

This comment has been minimized.

Show comment
Hide comment
@quicksilverusu

quicksilverusu Jan 2, 2017

This is what I'm currently getting:

pi@raspberrypi:~ $ systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2017-01-01 18:03:53 MST; 7s ago Process: 3349 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC) Main PID: 3349 (code=exited, status=203/EXEC)

Any ideas?

This is what I'm currently getting:

pi@raspberrypi:~ $ systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2017-01-01 18:03:53 MST; 7s ago Process: 3349 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC) Main PID: 3349 (code=exited, status=203/EXEC)

Any ideas?

@quicksilverusu

This comment has been minimized.

Show comment
Hide comment
@quicksilverusu

quicksilverusu Jan 2, 2017

I tried what @jorgibravo recommended and changed the ExecStart to ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS

and actually had it successfully start. (nothing actually activated in the homekit app, but the status showed success at least)

pi@raspberrypi:/etc/systemd/system $ systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: active (running) since Sun 2017-01-01 18:28:24 MST; 6s ago Main PID: 9719 (homebridge) CGroup: /system.slice/homebridge.service └─9719 homebridge

but then after a while I checked the status again and got:
pi@raspberrypi:/etc/systemd/system $ systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2017-01-01 18:29:24 MST; 3s ago Process: 10016 ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE) Main PID: 10016 (code=exited, status=1/FAILURE)

I tried what @jorgibravo recommended and changed the ExecStart to ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS

and actually had it successfully start. (nothing actually activated in the homekit app, but the status showed success at least)

pi@raspberrypi:/etc/systemd/system $ systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: active (running) since Sun 2017-01-01 18:28:24 MST; 6s ago Main PID: 9719 (homebridge) CGroup: /system.slice/homebridge.service └─9719 homebridge

but then after a while I checked the status again and got:
pi@raspberrypi:/etc/systemd/system $ systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2017-01-01 18:29:24 MST; 3s ago Process: 10016 ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE) Main PID: 10016 (code=exited, status=1/FAILURE)

@quicksilverusu

This comment has been minimized.

Show comment
Hide comment
@jsmith79

This comment has been minimized.

Show comment
Hide comment
@jsmith79

jsmith79 Jan 2, 2017

@quicksilverusu did you end up getting yours working?

jsmith79 commented Jan 2, 2017

@quicksilverusu did you end up getting yours working?

@quicksilverusu

This comment has been minimized.

Show comment
Hide comment
@quicksilverusu

quicksilverusu Jan 2, 2017

@jsmith79 nope. still stuck. :(

@jsmith79 nope. still stuck. :(

@quicksilverusu

This comment has been minimized.

Show comment
Hide comment
@quicksilverusu

quicksilverusu Jan 2, 2017

actually yes it started working. for some reason it didn't take my chmod commands to give write access to 'homebridge'.

actually yes it started working. for some reason it didn't take my chmod commands to give write access to 'homebridge'.

@dony71

This comment has been minimized.

Show comment
Hide comment
@dony71

dony71 Jan 4, 2017

Where is log file?
Can't find any /var/log/homebridge.log
Also, is it possible to have pid file?

dony71 commented Jan 4, 2017

Where is log file?
Can't find any /var/log/homebridge.log
Also, is it possible to have pid file?

@shawnlowrey

This comment has been minimized.

Show comment
Hide comment
@shawnlowrey

shawnlowrey Jan 6, 2017

Newbie that can't figure out permissions. When I try to transfer the above files from downloads to the directories outlined it tells me I do not have permission. I googled how to change permissions, yet it's not working. Can someone please walk me through this task. Thank you.

Newbie that can't figure out permissions. When I try to transfer the above files from downloads to the directories outlined it tells me I do not have permission. I googled how to change permissions, yet it's not working. Can someone please walk me through this task. Thank you.

@johannrichard

This comment has been minimized.

Show comment
Hide comment
@johannrichard

johannrichard Jan 6, 2017

@shawnlowrey You have to sudo to get the necessary permissions. For example, if you want to copy the file from your user home (i.e. ~/homebridge.service), you can issue the following command:

sudo cp ~/homebridge.service /etc/systemd/system

Then you should find the file in the /etc/systemd/system and can move on from there.

Owner

johannrichard commented Jan 6, 2017

@shawnlowrey You have to sudo to get the necessary permissions. For example, if you want to copy the file from your user home (i.e. ~/homebridge.service), you can issue the following command:

sudo cp ~/homebridge.service /etc/systemd/system

Then you should find the file in the /etc/systemd/system and can move on from there.

@Dorusvandenoord

This comment has been minimized.

Show comment
Hide comment
@Dorusvandenoord

Dorusvandenoord Jan 7, 2017

@quicksilverusu @jsmith79 I had the same issue. Turned out I had the config.json and persist folder placed into /var/homebridge because I copied some commands from the comments, and not var/lib/homebridge where they should be. So I copied both things to the new folder, did the chmod 777 on all the files in the folder and now it works.

And for ExecStart is used the result of the command which homebridge, which gave me /usr/bin/homebridge. Even though my homebridge files are also located at /usr/lib/node_modules/homebridge/bin/homebridge.

@quicksilverusu @jsmith79 I had the same issue. Turned out I had the config.json and persist folder placed into /var/homebridge because I copied some commands from the comments, and not var/lib/homebridge where they should be. So I copied both things to the new folder, did the chmod 777 on all the files in the folder and now it works.

And for ExecStart is used the result of the command which homebridge, which gave me /usr/bin/homebridge. Even though my homebridge files are also located at /usr/lib/node_modules/homebridge/bin/homebridge.

@neonightmare

This comment has been minimized.

Show comment
Hide comment
@neonightmare

neonightmare Jan 7, 2017

hi, got this working, thx so far
just a question:

A directory called /var/lib/homebridge, writable by the user created above, and a corresponding config.json file in that directory. Homebridge by default looks for its configuration in /home//.homebridge. This is unsuitable for services and the -U /var/lib/homebridge flag ensures the config is read from a different place.

do I have to adapt the config.json in /home//.homebridge (was my standard) or
must I adapt the file in /var/lib/homebridge for the future?

thx neo

hi, got this working, thx so far
just a question:

A directory called /var/lib/homebridge, writable by the user created above, and a corresponding config.json file in that directory. Homebridge by default looks for its configuration in /home//.homebridge. This is unsuitable for services and the -U /var/lib/homebridge flag ensures the config is read from a different place.

do I have to adapt the config.json in /home//.homebridge (was my standard) or
must I adapt the file in /var/lib/homebridge for the future?

thx neo

@hogendoorn

This comment has been minimized.

Show comment
Hide comment
@hogendoorn

hogendoorn Jan 9, 2017

Hi People,

I am gettings this error any clue?

pi@raspberrypi:~ $ sudo systemctl enable homebridge
Synchronizing state for homebridge.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d homebridge defaults
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: script homebridge is not an executable regular file, skipped! Executing /usr/sbin/update-rc.d homebridge enable insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: script homebridge is not an executable regular file, skipped!

Hi People,

I am gettings this error any clue?

pi@raspberrypi:~ $ sudo systemctl enable homebridge
Synchronizing state for homebridge.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d homebridge defaults
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: script homebridge is not an executable regular file, skipped! Executing /usr/sbin/update-rc.d homebridge enable insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: Script homebridge is broken: incomplete LSB comment.
insserv: missing valid name for Provides:' please add. insserv: Script homebridge is broken: incomplete LSB comment. insserv: missing valid name forProvides:' please add.
insserv: script homebridge is not an executable regular file, skipped!

@mrobertson1992

This comment has been minimized.

Show comment
Hide comment
@mrobertson1992

mrobertson1992 Jan 11, 2017

Got mine working, but the only issue I have is I can't get it to work when I am away from home the home apps says connection failed. I have reset my Apple TV and stuff but no luck. Any ideas?

Got mine working, but the only issue I have is I can't get it to work when I am away from home the home apps says connection failed. I have reset my Apple TV and stuff but no luck. Any ideas?

@MatsA

This comment has been minimized.

Show comment
Hide comment
@MatsA

MatsA Jan 16, 2017

A stripped down version is posted here
http://pysselilivet.blogspot.com/2017/01/homebridge-autostart-with-systemd.html
and yes I know, it is not best practice…..
But if You just run Homebridge on the RPI maybe You could be forgiven ?

MatsA commented Jan 16, 2017

A stripped down version is posted here
http://pysselilivet.blogspot.com/2017/01/homebridge-autostart-with-systemd.html
and yes I know, it is not best practice…..
But if You just run Homebridge on the RPI maybe You could be forgiven ?

@HA-Enthusiast

This comment has been minimized.

Show comment
Hide comment
@HA-Enthusiast

HA-Enthusiast Jan 27, 2017

Here's a weird one for you...

I can't even get the documents moved into etc/default and etc/systemd/system. I'm getting an error that says "homebridge.service: Error moving file: Permssion denied"

What do I do? I tried changing the permissions of the folder to allow all users to add files, but it wouldn't let me do that either. Any help here would be appreciated.

Here's a weird one for you...

I can't even get the documents moved into etc/default and etc/systemd/system. I'm getting an error that says "homebridge.service: Error moving file: Permssion denied"

What do I do? I tried changing the permissions of the folder to allow all users to add files, but it wouldn't let me do that either. Any help here would be appreciated.

@bachoo786

This comment has been minimized.

Show comment
Hide comment
@bachoo786

bachoo786 Feb 10, 2017

Hi

I wanted to find out regarding the config.json file. If I wanted to make any changes to my config.json file which one shall I use inorder for homebridge to working correctly and on boot?

Thanks.

Hi

I wanted to find out regarding the config.json file. If I wanted to make any changes to my config.json file which one shall I use inorder for homebridge to working correctly and on boot?

Thanks.

@zhangrandy

This comment has been minimized.

Show comment
Hide comment
@zhangrandy

zhangrandy Mar 29, 2017

Thanks for this great tutorial, I also ran into the same problem as most of you: when manually starting homebridge, everything works fine, but with systemd boot, the homebridge service starts but the plugin returns no response . After trying many of the solutions from the comments, I think @stevenguh 's comment solved my problem: I have an bme280 sensors connected to the gpio, so after removing the 'User=homebridge' in homebridge.service as suggested, now the systemd service finally works! Thank you all for the help!

Thanks for this great tutorial, I also ran into the same problem as most of you: when manually starting homebridge, everything works fine, but with systemd boot, the homebridge service starts but the plugin returns no response . After trying many of the solutions from the comments, I think @stevenguh 's comment solved my problem: I have an bme280 sensors connected to the gpio, so after removing the 'User=homebridge' in homebridge.service as suggested, now the systemd service finally works! Thank you all for the help!

@kevinwlau

This comment has been minimized.

Show comment
Hide comment
@kevinwlau

kevinwlau Apr 2, 2017

I also had the problem many others had where the service would keep shutting down and auto-restarting, only to run for 1-2 seconds before restarting again. Even though I do not have anything using the gpio pins, removing the User=homebridge worked for me.

kevinwlau commented Apr 2, 2017

I also had the problem many others had where the service would keep shutting down and auto-restarting, only to run for 1-2 seconds before restarting again. Even though I do not have anything using the gpio pins, removing the User=homebridge worked for me.

@PierfrancescoElia

This comment has been minimized.

Show comment
Hide comment
@PierfrancescoElia

PierfrancescoElia Apr 13, 2017

Hello everyone! I want to run Homebridge in insecure mode.
Now from terminal i have to do homebridge -I.

How can I implement it in the bootup script? Thanks :)

Hello everyone! I want to run Homebridge in insecure mode.
Now from terminal i have to do homebridge -I.

How can I implement it in the bootup script? Thanks :)

@ddetton

This comment has been minimized.

Show comment
Hide comment
@ddetton

ddetton Apr 23, 2017

Homebridge was running fine if I just launched it directly from the command line but when I ran it as a service everything appeared to be running OK but none of my devices would respond in the Home app. All that I had to do to fix it was to delete the homebridge user, re-add the homebridge user then reset the file permissions for /var/lib/homebridge using the following command:

sudo chmod 777 /var/lib/homebridge -R

ddetton commented Apr 23, 2017

Homebridge was running fine if I just launched it directly from the command line but when I ran it as a service everything appeared to be running OK but none of my devices would respond in the Home app. All that I had to do to fix it was to delete the homebridge user, re-add the homebridge user then reset the file permissions for /var/lib/homebridge using the following command:

sudo chmod 777 /var/lib/homebridge -R

@pumamood

This comment has been minimized.

Show comment
Hide comment
@pumamood

pumamood May 17, 2017

Hi, if you install homebridge as a service and you create a new user you should add that user to video group to handle cec-client.
please add this command to your code
usermod -a -G video USER

Hi, if you install homebridge as a service and you create a new user you should add that user to video group to handle cec-client.
please add this command to your code
usermod -a -G video USER

@DarylMc

This comment has been minimized.

Show comment
Hide comment
@DarylMc

DarylMc Jun 2, 2017

@johannrichard
Thanks for your posts about systemd.
I use a plugin Homebridge-CBus to talk to my home lighting system.
CBus has a server running also on PI3.

The CBus server loads all the unit states at boot and I think Homebridge was connecting too quickly.
Homebridge was going into some sort of semi working state.
Restarting Homebridge after the CBus server was settled down fixed the problem.
So I added in the the same directory as homebridge.service a file homebridge.timer
Instead of enabling homebridge.service I enabled homebridge.timer as per your instructions.

It's doing exactly what I want it to do and seems to have overcome the problem.
I did edit homebridge.service as well based on the best I could figure out looking at other timer examples.
If you get the chance could you have a look at it and check if I have gone about it the wrong way or if homebridge.service is missing anything important.

homebridge.timer
`[Unit]
Description=Delay

[Timer]
OnBootSec=240

[Install]
WantedBy=multi-user.target`

homebridge.service
`[Unit]
Description=Node.js HomeKit Server

[Service]
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target`

DarylMc commented Jun 2, 2017

@johannrichard
Thanks for your posts about systemd.
I use a plugin Homebridge-CBus to talk to my home lighting system.
CBus has a server running also on PI3.

The CBus server loads all the unit states at boot and I think Homebridge was connecting too quickly.
Homebridge was going into some sort of semi working state.
Restarting Homebridge after the CBus server was settled down fixed the problem.
So I added in the the same directory as homebridge.service a file homebridge.timer
Instead of enabling homebridge.service I enabled homebridge.timer as per your instructions.

It's doing exactly what I want it to do and seems to have overcome the problem.
I did edit homebridge.service as well based on the best I could figure out looking at other timer examples.
If you get the chance could you have a look at it and check if I have gone about it the wrong way or if homebridge.service is missing anything important.

homebridge.timer
`[Unit]
Description=Delay

[Timer]
OnBootSec=240

[Install]
WantedBy=multi-user.target`

homebridge.service
`[Unit]
Description=Node.js HomeKit Server

[Service]
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target`

@asenovb

This comment has been minimized.

Show comment
Hide comment
@asenovb

asenovb Jun 28, 2017

Hi guys!

I was able to run the service but I am encountering the following Loop or I don't know how to call it:

In the status the Homebridge seems to load successfully but afterwards it is starting this Caching and this is the only thing I am getting:

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; disabled)
   Active: active (running) since Wed 2017-06-28 19:23:48 UTC; 5s ago
 Main PID: 5902 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─5902 homebridge

Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Loaded plugin: homebridge-vera
Jun 28 19:23:53 raspberrypi homebridge[5902]: VeraLink initializing
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Registering platform 'homebridge-veralink.Vera'
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] ---
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Loaded config.json with 0 accessories and 2 platforms.
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] ---
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Loading 2 platforms...
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] [int21h] Initializing Vera platform...
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Initializing BraviaPlatform platform...
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Initializing platform accessory 'TV'...
pi@raspberrypi:/var $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; disabled)
   Active: active (running) since Wed 2017-06-28 19:23:48 UTC; 9s ago
 Main PID: 5902 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─5902 homebridge

Jun 28 19:23:54 raspberrypi homebridge[5902]: ┌────────────┐
Jun 28 19:23:54 raspberrypi homebridge[5902]: │ 031-45-555 │
Jun 28 19:23:54 raspberrypi homebridge[5902]: └────────────┘
Jun 28 19:23:54 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:54 GMT EventedHTTPServer Server listening on port 43389
Jun 28 19:23:54 raspberrypi homebridge[5902]: [6/28/2017, 7:23:54 PM] Homebridge is running on port 43389.
Jun 28 19:23:54 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:54 GMT VeraLink Caching status...
Jun 28 19:23:55 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:55 GMT VeraLink Power state called: undefined true
Jun 28 19:23:55 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:55 GMT VeraLink Caching status...
Jun 28 19:23:56 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:56 GMT VeraLink Caching status...
Jun 28 19:23:57 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:57 GMT VeraLink Caching status...

asenovb commented Jun 28, 2017

Hi guys!

I was able to run the service but I am encountering the following Loop or I don't know how to call it:

In the status the Homebridge seems to load successfully but afterwards it is starting this Caching and this is the only thing I am getting:

● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; disabled)
   Active: active (running) since Wed 2017-06-28 19:23:48 UTC; 5s ago
 Main PID: 5902 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─5902 homebridge

Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Loaded plugin: homebridge-vera
Jun 28 19:23:53 raspberrypi homebridge[5902]: VeraLink initializing
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Registering platform 'homebridge-veralink.Vera'
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] ---
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Loaded config.json with 0 accessories and 2 platforms.
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] ---
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Loading 2 platforms...
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] [int21h] Initializing Vera platform...
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Initializing BraviaPlatform platform...
Jun 28 19:23:53 raspberrypi homebridge[5902]: [6/28/2017, 7:23:53 PM] Initializing platform accessory 'TV'...
pi@raspberrypi:/var $ sudo systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; disabled)
   Active: active (running) since Wed 2017-06-28 19:23:48 UTC; 9s ago
 Main PID: 5902 (homebridge)
   CGroup: /system.slice/homebridge.service
           └─5902 homebridge

Jun 28 19:23:54 raspberrypi homebridge[5902]: ┌────────────┐
Jun 28 19:23:54 raspberrypi homebridge[5902]: │ 031-45-555 │
Jun 28 19:23:54 raspberrypi homebridge[5902]: └────────────┘
Jun 28 19:23:54 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:54 GMT EventedHTTPServer Server listening on port 43389
Jun 28 19:23:54 raspberrypi homebridge[5902]: [6/28/2017, 7:23:54 PM] Homebridge is running on port 43389.
Jun 28 19:23:54 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:54 GMT VeraLink Caching status...
Jun 28 19:23:55 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:55 GMT VeraLink Power state called: undefined true
Jun 28 19:23:55 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:55 GMT VeraLink Caching status...
Jun 28 19:23:56 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:56 GMT VeraLink Caching status...
Jun 28 19:23:57 raspberrypi homebridge[5902]: Wed, 28 Jun 2017 19:23:57 GMT VeraLink Caching status...
@jcleek

This comment has been minimized.

Show comment
Hide comment
@jcleek

jcleek Jul 5, 2017

I had this working for several months, then it just quit. No changes to the Pi at all. The error listed below happens when I execute "sudo systemctl enable homebridge"

pi@raspberrypi:~ $ sudo systemctl enable homebridge
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

I tried updating and upgrading the Pi with sudo apt-get update and sudo apt-get upgrade but I continue to get the same error. Anyone have any ideas on correcting?

BTW, homebridge still runs fine when executed from the terminal, just not autorun.

jcleek commented Jul 5, 2017

I had this working for several months, then it just quit. No changes to the Pi at all. The error listed below happens when I execute "sudo systemctl enable homebridge"

pi@raspberrypi:~ $ sudo systemctl enable homebridge
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

I tried updating and upgrading the Pi with sudo apt-get update and sudo apt-get upgrade but I continue to get the same error. Anyone have any ideas on correcting?

BTW, homebridge still runs fine when executed from the terminal, just not autorun.

@jcleek

This comment has been minimized.

Show comment
Hide comment
@jcleek

jcleek Jul 18, 2017

Completely rebuilt the Pi and reinstalled homebridge. Sad that it requires rebuild every time it breaks...

jcleek commented Jul 18, 2017

Completely rebuilt the Pi and reinstalled homebridge. Sad that it requires rebuild every time it breaks...

@partymike

This comment has been minimized.

Show comment
Hide comment
@partymike

partymike Jul 24, 2017

I had the same issue, working for months then just recently it stopping running via the service although command line ran fine, I ended up removing the "homebridge" user and using the default user "pi", works great now and just needed a couple of lines changing in the "homebridge.service" file.

I know its not best practice using the default pi user, but tell that to the miss's who couldn't turn the lights on ;-)

I had the same issue, working for months then just recently it stopping running via the service although command line ran fine, I ended up removing the "homebridge" user and using the default user "pi", works great now and just needed a couple of lines changing in the "homebridge.service" file.

I know its not best practice using the default pi user, but tell that to the miss's who couldn't turn the lights on ;-)

@allsorts351

This comment has been minimized.

Show comment
Hide comment
@allsorts351

allsorts351 Jul 30, 2017

hi new guy here sorry when i try to run systemctl daemon-reload i get a error of failed to execute operation: Access Denied

anyone have any ideas how to fix this.

hi new guy here sorry when i try to run systemctl daemon-reload i get a error of failed to execute operation: Access Denied

anyone have any ideas how to fix this.

@AKWillows

This comment has been minimized.

Show comment
Hide comment
@AKWillows

AKWillows Aug 21, 2017

Hi - with regard to the DEBUG row which can be commented out. Where do i find the log files for homebridge? journalctl -f -u homebridge doesn't work as it says -u is an invalid argument. If I remove the -u, there is no file found

Hi - with regard to the DEBUG row which can be commented out. Where do i find the log files for homebridge? journalctl -f -u homebridge doesn't work as it says -u is an invalid argument. If I remove the -u, there is no file found

@jeffhalljr

This comment has been minimized.

Show comment
Hide comment
@jeffhalljr

jeffhalljr Sep 10, 2017

Thanks for the instructions... they worked perfectly. The only issue I ran into was that I had to delete my "home" in ios and setup my "home" again.

Thanks for the instructions... they worked perfectly. The only issue I ran into was that I had to delete my "home" in ios and setup my "home" again.

@fboulegue

This comment has been minimized.

Show comment
Hide comment
@fboulegue

fboulegue Sep 21, 2017

I get the following logs, what do I do wrong?

-- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
Sep 20 11:33:21 raspberrypi sudo[251]: root : TTY=unknown ; PWD=/root ; USER=root ; ENV=DEBUG=* ; COMMAND=/usr/local/bin/homebridge
Sep 20 11:33:21 raspberrypi sudo[251]: pam_unix(sudo:session): session opened for user root by (uid=0)
Sep 20 11:33:22 raspberrypi systemd[1]: Started LSB: Start daemon at boot time.
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** Please fix your application to use the native API of Avahi!
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** Please fix your application to use the native API of Avahi!
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** For more information see <http://0pointer.de/avahi-compa…node&f=DNSServiceRegister>
Sep 20 11:35:06 raspberrypi sudo[251]: pam_unix(sudo:session): session closed for user root

I get the following logs, what do I do wrong?

-- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
Sep 20 11:33:21 raspberrypi sudo[251]: root : TTY=unknown ; PWD=/root ; USER=root ; ENV=DEBUG=* ; COMMAND=/usr/local/bin/homebridge
Sep 20 11:33:21 raspberrypi sudo[251]: pam_unix(sudo:session): session opened for user root by (uid=0)
Sep 20 11:33:22 raspberrypi systemd[1]: Started LSB: Start daemon at boot time.
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** Please fix your application to use the native API of Avahi!
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** Please fix your application to use the native API of Avahi!
Sep 20 11:33:40 raspberrypi node[277]: *** WARNING *** For more information see <http://0pointer.de/avahi-compa…node&f=DNSServiceRegister>
Sep 20 11:35:06 raspberrypi sudo[251]: pam_unix(sudo:session): session closed for user root
@fkpwolf

This comment has been minimized.

Show comment
Hide comment
@fkpwolf

fkpwolf Oct 18, 2017

Try many times and still failed. Why was it so hard? At last:
sudo nohup homebridge &

fkpwolf commented Oct 18, 2017

Try many times and still failed. Why was it so hard? At last:
sudo nohup homebridge &

@nil-ghosh

This comment has been minimized.

Show comment
Hide comment
@nil-ghosh

nil-ghosh Oct 28, 2017

I am getting the following error when booting. NPM update check is looking into homebridge folder which does not exist. I just have 'pi' folder under home. Not sure why it is looking at a different location. Any idea? Thanks

pi@raspberrypi:~ $ journalctl -u homebridge
-- Logs begin at Sat 2017-10-28 00:17:01 BST, end at Sat 2017-10-28 01:07:16 BST. --
Oct 28 00:50:10 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibilit
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility laye
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** Please fix your application to use the native API of A
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-com
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** Please fix your application to use the native API of A
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-com
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** Please fix your application to use the native API of Avahi!
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is no
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** Please fix your application to use the native API of Avahi!
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=
Oct 28 00:50:31 raspberrypi homebridge[197]: ┌──────────────────────────────────────────────────────────────┐
Oct 28 00:50:31 raspberrypi homebridge[197]: │ npm update check failed │
Oct 28 00:50:31 raspberrypi homebridge[197]: │ Try running with sudo or get access │
Oct 28 00:50:31 raspberrypi homebridge[197]: │ to the local update config store via │
Oct 28 00:50:31 raspberrypi homebridge[197]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config │
Oct 28 00:50:31 raspberrypi homebridge[197]: └──────────────────────────────────────────────────────────────┘
Oct 28 00:50:31 raspberrypi homebridge[197]: /usr/local/lib/node_modules/hap-nodejs/node_modules/mkdirp/index.js:90
Oct 28 00:50:31 raspberrypi homebridge[197]: throw err0;
Oct 28 00:50:31 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE

nil-ghosh commented Oct 28, 2017

I am getting the following error when booting. NPM update check is looking into homebridge folder which does not exist. I just have 'pi' folder under home. Not sure why it is looking at a different location. Any idea? Thanks

pi@raspberrypi:~ $ journalctl -u homebridge
-- Logs begin at Sat 2017-10-28 00:17:01 BST, end at Sat 2017-10-28 01:07:16 BST. --
Oct 28 00:50:10 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibilit
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility laye
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** Please fix your application to use the native API of A
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-com
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** Please fix your application to use the native API of A
Oct 28 00:50:19 raspberrypi homebridge[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-com
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** Please fix your application to use the native API of Avahi!
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is no
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** Please fix your application to use the native API of Avahi!
Oct 28 00:50:19 raspberrypi node[197]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=
Oct 28 00:50:31 raspberrypi homebridge[197]: ┌──────────────────────────────────────────────────────────────┐
Oct 28 00:50:31 raspberrypi homebridge[197]: │ npm update check failed │
Oct 28 00:50:31 raspberrypi homebridge[197]: │ Try running with sudo or get access │
Oct 28 00:50:31 raspberrypi homebridge[197]: │ to the local update config store via │
Oct 28 00:50:31 raspberrypi homebridge[197]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config │
Oct 28 00:50:31 raspberrypi homebridge[197]: └──────────────────────────────────────────────────────────────┘
Oct 28 00:50:31 raspberrypi homebridge[197]: /usr/local/lib/node_modules/hap-nodejs/node_modules/mkdirp/index.js:90
Oct 28 00:50:31 raspberrypi homebridge[197]: throw err0;
Oct 28 00:50:31 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE

@DeucePie

This comment has been minimized.

Show comment
Hide comment
@DeucePie

DeucePie Nov 7, 2017

Followed the instructions but somehow my homebridge is located somewhere that wasn't outlined in the instructions. It states ExecStart variable should be either /usr/local/bin/homebridge or /usr/bin/homebridge but when I run which homebridge I get /opt/node/lib/node_modules/homebridge/bin/homebridge. I installed Node using the binary install instructions.

Any idea what I need to do to make sure that I can have this running via systemd?

I found the following when I ran sudo journalctl -u homebridge

Nov 07 05:57:28 raspberrypi homebridge[4111]: /opt/node/lib/node_modules/hap-nodejs/node_modules/mkdirp/index.js:90
Nov 07 05:57:28 raspberrypi homebridge[4111]: throw err0;
Nov 07 05:57:28 raspberrypi homebridge[4111]: ^
Nov 07 05:57:28 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Nov 07 05:57:28 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 07 05:57:28 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.

DeucePie commented Nov 7, 2017

Followed the instructions but somehow my homebridge is located somewhere that wasn't outlined in the instructions. It states ExecStart variable should be either /usr/local/bin/homebridge or /usr/bin/homebridge but when I run which homebridge I get /opt/node/lib/node_modules/homebridge/bin/homebridge. I installed Node using the binary install instructions.

Any idea what I need to do to make sure that I can have this running via systemd?

I found the following when I ran sudo journalctl -u homebridge

Nov 07 05:57:28 raspberrypi homebridge[4111]: /opt/node/lib/node_modules/hap-nodejs/node_modules/mkdirp/index.js:90
Nov 07 05:57:28 raspberrypi homebridge[4111]: throw err0;
Nov 07 05:57:28 raspberrypi homebridge[4111]: ^
Nov 07 05:57:28 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Nov 07 05:57:28 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 07 05:57:28 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.

@DYKN5000

This comment has been minimized.

Show comment
Hide comment
@DYKN5000

DYKN5000 Nov 22, 2017

Currently having issues with homebridge systemd:
The output with journalctl is here:

Nov 21 22:22:57 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:22:58 raspberrypi systemd[236]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:22:59 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:22:59 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:22:59 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:23:10 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:23:10 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:23:20 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:23:20 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:23:20 raspberrypi systemd[590]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:28:47 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:28:47 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:28:47 raspberrypi systemd[620]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:28:57 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:28:57 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:28:57 raspberrypi systemd[657]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:29:07 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:29:07 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:29:07 raspberrypi systemd[685]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:29:17 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:29:17 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:29:17 raspberrypi systemd[1]: Started Node.js HomeKit Server.

I modified the etc/default and etc homebridge/.service files so that it followed the result of the which homebridge:

which homebridge: /opt/node/lib/node_modules/homebridge/bin/homebridge
The fields that were changed were: ExecStart= & HOMEBRIDGE_OPTS= , which were changed to the above result respectively.

I followed everything else. What is wrong?

Currently having issues with homebridge systemd:
The output with journalctl is here:

Nov 21 22:22:57 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:22:58 raspberrypi systemd[236]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:22:59 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:22:59 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:22:59 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:23:10 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:23:10 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:23:10 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:23:20 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:23:20 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:23:20 raspberrypi systemd[590]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:23:20 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:28:47 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:28:47 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:28:47 raspberrypi systemd[620]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:28:47 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:28:57 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:28:57 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:28:57 raspberrypi systemd[657]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:28:57 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:29:07 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:29:07 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Nov 21 22:29:07 raspberrypi systemd[685]: homebridge.service: Failed at step EXEC spawning /opt/node/lib/node-modules/homebridge/bin/homebridge: No such file or directory
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Nov 21 22:29:07 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 21 22:29:17 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 21 22:29:17 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Nov 21 22:29:17 raspberrypi systemd[1]: Started Node.js HomeKit Server.

I modified the etc/default and etc homebridge/.service files so that it followed the result of the which homebridge:

which homebridge: /opt/node/lib/node_modules/homebridge/bin/homebridge
The fields that were changed were: ExecStart= & HOMEBRIDGE_OPTS= , which were changed to the above result respectively.

I followed everything else. What is wrong?

@krobipd

This comment has been minimized.

Show comment
Hide comment
@krobipd

krobipd Nov 30, 2017

is there any way to start homebridge after yahm (Homematic CCU) is successfully started.
the problem is when homebridge starts before the homematic CCU is ready it won't update the status of the devices.
so I have to restart homebridge after the CCU is successfully started and then everything works perfectly.

krobipd commented Nov 30, 2017

is there any way to start homebridge after yahm (Homematic CCU) is successfully started.
the problem is when homebridge starts before the homematic CCU is ready it won't update the status of the devices.
so I have to restart homebridge after the CCU is successfully started and then everything works perfectly.

@fuyucn

This comment has been minimized.

Show comment
Hide comment
@fuyucn

fuyucn Dec 3, 2017

I got a probelm: When i run "Homebridge" i can see the the "pin": "012-34-567" in from my config.json under pi/.homeassistrant. But if i run sudo homebridge or sudo systemctl start homebridge, the pin will be default which is "31-something".
I really do not understand how could this happens.

fuyucn commented Dec 3, 2017

I got a probelm: When i run "Homebridge" i can see the the "pin": "012-34-567" in from my config.json under pi/.homeassistrant. But if i run sudo homebridge or sudo systemctl start homebridge, the pin will be default which is "31-something".
I really do not understand how could this happens.

@iCarl

This comment has been minimized.

Show comment
Hide comment
@iCarl

iCarl Dec 4, 2017

@fuyucn run "sudo systemctl status homebridge -l" in order to see ful log

iCarl commented Dec 4, 2017

@fuyucn run "sudo systemctl status homebridge -l" in order to see ful log

@Jappert

This comment has been minimized.

Show comment
Hide comment
@Jappert

Jappert Dec 4, 2017

Hi there,

For some reason "which homebridge" results in:
/opt/node/lib/node_modules/homebridge/bin/homebridge

I have tried anything and everything mentioned above but I just can't get homebridge running under systemd. My best guess is it starts with the directory WHICH command is giving.

Jappert commented Dec 4, 2017

Hi there,

For some reason "which homebridge" results in:
/opt/node/lib/node_modules/homebridge/bin/homebridge

I have tried anything and everything mentioned above but I just can't get homebridge running under systemd. My best guess is it starts with the directory WHICH command is giving.

@tunaslim

This comment has been minimized.

Show comment
Hide comment
@tunaslim

tunaslim Dec 14, 2017

Hi, works like a charm with my OrangePi Zero. Thank you!

And I think

sudo systemctl --system daemon-reload

will be better.

Hi, works like a charm with my OrangePi Zero. Thank you!

And I think

sudo systemctl --system daemon-reload

will be better.

@sicaboy

This comment has been minimized.

Show comment
Hide comment
@sicaboy

sicaboy Dec 22, 2017

Those who have the problem:

homebridge.service: Failed at step EXEC spawning /usr/local/bin/homebridge: No such file or directory

Simply fix by running:

ln -s   /opt/nodejs/bin/homebridge   /usr/local/bin/homebridge

sicaboy commented Dec 22, 2017

Those who have the problem:

homebridge.service: Failed at step EXEC spawning /usr/local/bin/homebridge: No such file or directory

Simply fix by running:

ln -s   /opt/nodejs/bin/homebridge   /usr/local/bin/homebridge
@oleg77s

This comment has been minimized.

Show comment
Hide comment
@oleg77s

oleg77s Jan 20, 2018

Hi there
I need to restart homebridge.service (with homebridge-harmony-hub plugin) every day at 5am
What should i change/add in homebridge.service for this?
Or i should use a homebridge.timer ?

oleg77s commented Jan 20, 2018

Hi there
I need to restart homebridge.service (with homebridge-harmony-hub plugin) every day at 5am
What should i change/add in homebridge.service for this?
Or i should use a homebridge.timer ?

@oleg77s

This comment has been minimized.

Show comment
Hide comment
@oleg77s

oleg77s Jan 22, 2018

sudo crontab -e
0 5 * * 2 sudo systemctl restart homebridge.service
sudo /etc/init.d/cron restart

the best choice for me

oleg77s commented Jan 22, 2018

sudo crontab -e
0 5 * * 2 sudo systemctl restart homebridge.service
sudo /etc/init.d/cron restart

the best choice for me

@tenzion

This comment has been minimized.

Show comment
Hide comment
@tenzion

tenzion Feb 2, 2018

Is it possible to do this with Debian Chroot on a Synology?
I am having great trouble making Homebridge autostart on boot...

I cannot figure out how to make the autostart work with config.json NOT being placed at /root/.homebridge/config.json
Can anyone point me in the right direction? Thanks.

tenzion commented Feb 2, 2018

Is it possible to do this with Debian Chroot on a Synology?
I am having great trouble making Homebridge autostart on boot...

I cannot figure out how to make the autostart work with config.json NOT being placed at /root/.homebridge/config.json
Can anyone point me in the right direction? Thanks.

@martinB65

This comment has been minimized.

Show comment
Hide comment
@martinB65

martinB65 Feb 16, 2018

Feb 16 13:28:51 r-homebridge homebridge[24989]: ┌──────────────────────────────────────────────────────────────┐ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ npm update check failed │ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ Try running with sudo or get access │ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ to the local update config store via │ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config │ Feb 16 13:28:51 r-homebridge homebridge[24989]: └──────────────────────────────────────────────────────────────┘

Hi,
user nil-ghosh had the same Problem, but i didn't see any solutions.
As suggested i created system user without a home-directory. The configuration files for homebridge are located in /var/lib/homebridge.

Any help is appreciated.

btw: homebridge is running perfectly, this error message is only annoying, but obviously has no Impact on functionality.

Thx.
Martin

Solved: i created a homedirectory for user homebridge

martinB65 commented Feb 16, 2018

Feb 16 13:28:51 r-homebridge homebridge[24989]: ┌──────────────────────────────────────────────────────────────┐ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ npm update check failed │ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ Try running with sudo or get access │ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ to the local update config store via │ Feb 16 13:28:51 r-homebridge homebridge[24989]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config │ Feb 16 13:28:51 r-homebridge homebridge[24989]: └──────────────────────────────────────────────────────────────┘

Hi,
user nil-ghosh had the same Problem, but i didn't see any solutions.
As suggested i created system user without a home-directory. The configuration files for homebridge are located in /var/lib/homebridge.

Any help is appreciated.

btw: homebridge is running perfectly, this error message is only annoying, but obviously has no Impact on functionality.

Thx.
Martin

Solved: i created a homedirectory for user homebridge

@linstow89

This comment has been minimized.

Show comment
Hide comment
@linstow89

linstow89 Feb 20, 2018

haveing the following error

systemctl start homebridge

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2018-02-20 02:14:14 UTC; 7s ago
Process: 7923 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
Main PID: 7923 (code=exited, status=1/FAILURE)

Feb 20 02:14:14 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Feb 20 02:14:14 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Feb 20 02:14:14 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.

haveing the following error

systemctl start homebridge

● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2018-02-20 02:14:14 UTC; 7s ago
Process: 7923 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
Main PID: 7923 (code=exited, status=1/FAILURE)

Feb 20 02:14:14 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Feb 20 02:14:14 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Feb 20 02:14:14 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.

@Oggymator

This comment has been minimized.

Show comment
Hide comment
@Oggymator

Oggymator Mar 1, 2018

@linstow89
same problem here.

when I use sudo journalctl -u homebridge, got this message

raspberrypideconz systemd[1]: Started Node.js HomeKit Server.
raspberrypideconz homebridge[328]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
raspberrypideconz homebridge[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz homebridge[328]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
raspberrypideconz homebridge[328]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported p
raspberrypideconz homebridge[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz homebridge[328]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceReg
raspberrypideconz node[328]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
raspberrypideconz node[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz node[328]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
raspberrypideconz node[328]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partial
raspberrypideconz node[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz node[328]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister
raspberrypideconz homebridge[328]: ┌──────────────────────────────────────────────────────────────┐
raspberrypideconz homebridge[328]: │ npm update check failed │
raspberrypideconz homebridge[328]: │ Try running with sudo or get access │
raspberrypideconz homebridge[328]: │ to the local update config store via │
raspberrypideconz homebridge[328]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config │
raspberrypideconz homebridge[328]: └──────────────────────────────────────────────────────────────┘
raspberrypideconz homebridge[328]: /usr/lib/node_modules/hap-nodejs/node_modules/mkdirp/index.js:90
raspberrypideconz homebridge[328]: throw err0;
raspberrypideconz homebridge[328]: ^
raspberrypideconz homebridge[328]: Error: EACCES: permission denied, mkdir '/var/lib/homebridge'
raspberrypideconz homebridge[328]: at Object.fs.mkdirSync (fs.js:885:18)
raspberrypideconz systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
raspberrypideconz systemd[1]: homebridge.service: Unit entered failed state.
raspberrypideconz systemd[1]: homebridge.service: Failed with result 'exit-code'.
raspberrypideconz systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
raspberrypideconz systemd[1]: Stopped Node.js HomeKit Server.

Oggymator commented Mar 1, 2018

@linstow89
same problem here.

when I use sudo journalctl -u homebridge, got this message

raspberrypideconz systemd[1]: Started Node.js HomeKit Server.
raspberrypideconz homebridge[328]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
raspberrypideconz homebridge[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz homebridge[328]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
raspberrypideconz homebridge[328]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported p
raspberrypideconz homebridge[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz homebridge[328]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceReg
raspberrypideconz node[328]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
raspberrypideconz node[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz node[328]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node
raspberrypideconz node[328]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partial
raspberrypideconz node[328]: *** WARNING *** Please fix your application to use the native API of Avahi!
raspberrypideconz node[328]: *** WARNING *** For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister
raspberrypideconz homebridge[328]: ┌──────────────────────────────────────────────────────────────┐
raspberrypideconz homebridge[328]: │ npm update check failed │
raspberrypideconz homebridge[328]: │ Try running with sudo or get access │
raspberrypideconz homebridge[328]: │ to the local update config store via │
raspberrypideconz homebridge[328]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config │
raspberrypideconz homebridge[328]: └──────────────────────────────────────────────────────────────┘
raspberrypideconz homebridge[328]: /usr/lib/node_modules/hap-nodejs/node_modules/mkdirp/index.js:90
raspberrypideconz homebridge[328]: throw err0;
raspberrypideconz homebridge[328]: ^
raspberrypideconz homebridge[328]: Error: EACCES: permission denied, mkdir '/var/lib/homebridge'
raspberrypideconz homebridge[328]: at Object.fs.mkdirSync (fs.js:885:18)
raspberrypideconz systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
raspberrypideconz systemd[1]: homebridge.service: Unit entered failed state.
raspberrypideconz systemd[1]: homebridge.service: Failed with result 'exit-code'.
raspberrypideconz systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
raspberrypideconz systemd[1]: Stopped Node.js HomeKit Server.

@radu-danciu

This comment has been minimized.

Show comment
Hide comment
@radu-danciu

radu-danciu Mar 18, 2018

I had the same problem as several have described, with "homebridge.service: Main process exited, code=exited, status=1/FAILURE". In my case, the issue was related to the homebridge-nukiio plugin not being able to start up without root access for some reason. I'm not sure why that was, especially since I had chowned and chmoded everything to homebridge with 0777 to be sure (the service itself, the /var/default/homebridge environment, /var/lib/homebridge/*, including persist and config.json - I do mean EVERYTHING), but, even though I know it's not best practice, once I switched to User: root in /var/systemd/system/homebridge.service everything started working. (User: pi didn't work either, in case anybody is wondering; removing nukiio from the platforms in config.json and running with User: homebridge worked just fine).

I had the same problem as several have described, with "homebridge.service: Main process exited, code=exited, status=1/FAILURE". In my case, the issue was related to the homebridge-nukiio plugin not being able to start up without root access for some reason. I'm not sure why that was, especially since I had chowned and chmoded everything to homebridge with 0777 to be sure (the service itself, the /var/default/homebridge environment, /var/lib/homebridge/*, including persist and config.json - I do mean EVERYTHING), but, even though I know it's not best practice, once I switched to User: root in /var/systemd/system/homebridge.service everything started working. (User: pi didn't work either, in case anybody is wondering; removing nukiio from the platforms in config.json and running with User: homebridge worked just fine).

@ak-media

This comment has been minimized.

Show comment
Hide comment
@ak-media

ak-media Mar 23, 2018

My Homebridge works manually fine.

I tried to implement the App in systemd like you did.

in /etc/systemd/system i wrote homebridge.service:

[Unit]
	Description=Node.js Homekit Server
	After=syslog.target network-online.target
	[Service]
	Type=simple
	User=root
	EnvironmentFile=/etc/default/homebridge
	ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
	Restart=on-failure
	RestartSec=10
	KillMode=process
	[Install]
	WantedBy=multi-user.target

in /etc/default/homebridge this:

```
    # Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /root/.homebridge/
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*

   ```

After:

systemctl daemon-reload

systemctl enable homebridge.service

systemctl start homebridge.service

systemctl status homebridge.service tells me that:

```

● homebridge.service - Node.js Homekit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (exited) since Do 2018-03-22 19:55:27 CET; 57min ago
Mär 22 19:55:30 DietPi sudo[21050]: pam_unix(sudo:session): session closed for user root
Mär 22 20:31:18 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:31:41 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:31:41 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:33:08 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:33:17 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:33:17 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:38:19 DietPi systemd[1]: Started Node.js Homekit Server.
Mär 22 20:40:19 DietPi systemd[1]: Started Node.js Homekit Server.
Mär 22 20:52:51 DietPi systemd[1]: Started Node.js Homekit Server.


And Homebridge does not run…

After a manual start, Homebridge works fine again.

I have no clue what to do? Where is the trick?

Cheers
Andi

ak-media commented Mar 23, 2018

My Homebridge works manually fine.

I tried to implement the App in systemd like you did.

in /etc/systemd/system i wrote homebridge.service:

[Unit]
	Description=Node.js Homekit Server
	After=syslog.target network-online.target
	[Service]
	Type=simple
	User=root
	EnvironmentFile=/etc/default/homebridge
	ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
	Restart=on-failure
	RestartSec=10
	KillMode=process
	[Install]
	WantedBy=multi-user.target

in /etc/default/homebridge this:

```
    # Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /root/.homebridge/
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*

   ```

After:

systemctl daemon-reload

systemctl enable homebridge.service

systemctl start homebridge.service

systemctl status homebridge.service tells me that:

```

● homebridge.service - Node.js Homekit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
Active: active (exited) since Do 2018-03-22 19:55:27 CET; 57min ago
Mär 22 19:55:30 DietPi sudo[21050]: pam_unix(sudo:session): session closed for user root
Mär 22 20:31:18 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:31:41 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:31:41 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:33:08 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:33:17 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:33:17 DietPi systemd[1]: [/etc/systemd/system/homebridge.service:5] Invalid section header '[Service] Type=simple'
Mär 22 20:38:19 DietPi systemd[1]: Started Node.js Homekit Server.
Mär 22 20:40:19 DietPi systemd[1]: Started Node.js Homekit Server.
Mär 22 20:52:51 DietPi systemd[1]: Started Node.js Homekit Server.


And Homebridge does not run…

After a manual start, Homebridge works fine again.

I have no clue what to do? Where is the trick?

Cheers
Andi
@ak-media

This comment has been minimized.

Show comment
Hide comment
@ak-media

ak-media Mar 23, 2018

So, I wrote the homebridge.service again to avoid any unwanted CRs. But it does not work:

[root@DietPi:/etc/systemd/system# systemctl status homebridge
● homebridge.service - Node.js Homekit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fr 2018-03-23 12:51:24 CET; 4s ago
  Process: 4252 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 4252 (code=exited, status=1/FAILURE)

Mär 23 12:51:24 DietPi systemd[1]: Unit homebridge.service entered failed state.

ak-media commented Mar 23, 2018

So, I wrote the homebridge.service again to avoid any unwanted CRs. But it does not work:

[root@DietPi:/etc/systemd/system# systemctl status homebridge
● homebridge.service - Node.js Homekit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fr 2018-03-23 12:51:24 CET; 4s ago
  Process: 4252 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 4252 (code=exited, status=1/FAILURE)

Mär 23 12:51:24 DietPi systemd[1]: Unit homebridge.service entered failed state.

@ak-media

This comment has been minimized.

Show comment
Hide comment

Nobody?

@DarthCruiser

This comment has been minimized.

Show comment
Hide comment
@DarthCruiser

DarthCruiser Apr 4, 2018

I am running 3 instances of homebridge all started at boot using systemd.

Here are the contents of the the first homebridge.service script - located at /etc/systemd/system/. The only comment to share with you in relation to your file is - be careful running stuff as the root user. I use the root user - but my Debian Server is a Hyper-V Virtual Machine which is backed up daily hence recreating a Virtual Machine with no data loss is simple. Also some of the dynamically created folders, can appear in locations which differ from the relative tutorials:

====================================

[Unit]
Description=Node.js Homekit Server
After=syslog.target network-online.target

[Service]
Type=simple
User=root
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

===================================

Here is the contents of the first environment script, who's location is referenced in the service script above. I suggest moving the location of your homebridge conf.json file to a location which can be directly referenced - eg. /var/lib/homebridge - as referenced in the script below. On a Debian Server, I have never been successful in using '~/.somefolder' in service scripts and moving the script to the location suggested effectively addresses this. cp ~/.homebridge/config.json /var/lib/homebridge/config.json worked in my scenario.

===================================

# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge -P /usr/lib/node_modules -I

===================================

Depending on how you installed - on what, the script paths could be different.

Now reload the systemd config, make sure the service is enabled (symlink created) and I would then reboot.

... once booted I check my homebridge.service - see below.

===================================

root@homebridge:/etc/default# sudo systemctl status homebridge.service
● homebridge.service - Node.js Homekit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-04-04 23:33:12 BST; 40min ago
 Main PID: 875 (homebridge)
    Tasks: 11 (limit: 19660)
   CGroup: /system.slice/homebridge.service
           └─875 homebridge 

===================================

DarthCruiser commented Apr 4, 2018

I am running 3 instances of homebridge all started at boot using systemd.

Here are the contents of the the first homebridge.service script - located at /etc/systemd/system/. The only comment to share with you in relation to your file is - be careful running stuff as the root user. I use the root user - but my Debian Server is a Hyper-V Virtual Machine which is backed up daily hence recreating a Virtual Machine with no data loss is simple. Also some of the dynamically created folders, can appear in locations which differ from the relative tutorials:

====================================

[Unit]
Description=Node.js Homekit Server
After=syslog.target network-online.target

[Service]
Type=simple
User=root
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

===================================

Here is the contents of the first environment script, who's location is referenced in the service script above. I suggest moving the location of your homebridge conf.json file to a location which can be directly referenced - eg. /var/lib/homebridge - as referenced in the script below. On a Debian Server, I have never been successful in using '~/.somefolder' in service scripts and moving the script to the location suggested effectively addresses this. cp ~/.homebridge/config.json /var/lib/homebridge/config.json worked in my scenario.

===================================

# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge -P /usr/lib/node_modules -I

===================================

Depending on how you installed - on what, the script paths could be different.

Now reload the systemd config, make sure the service is enabled (symlink created) and I would then reboot.

... once booted I check my homebridge.service - see below.

===================================

root@homebridge:/etc/default# sudo systemctl status homebridge.service
● homebridge.service - Node.js Homekit Server
   Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-04-04 23:33:12 BST; 40min ago
 Main PID: 875 (homebridge)
    Tasks: 11 (limit: 19660)
   CGroup: /system.slice/homebridge.service
           └─875 homebridge 

===================================

@ddsforlife

This comment has been minimized.

Show comment
Hide comment
@ddsforlife

ddsforlife May 14, 2018

Hi, I´m quite new to Raspberry Pi etc and have a question. Homebridge works fine when I manually open it. This is the error log that happens when I try and do the above (autoload).

-- Logs begin at Fri 2016-11-04 07:16:43 +14, end at Mon 2018-05-14 16:35:45 +13. --
May 14 16:25:26 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 14 16:25:39 raspberrypi homebridge[403]: â<94><8C>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> npm update check failed â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> Try running with sudo or get access â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> to the local update config store via â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><94>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] Loaded plugin: homebridge-nest
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] Registering platform 'homebridge-nest.Nest'
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] ---
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] There was a problem reading your config.json file.
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] Please try pasting your config.json file here to validate it: http://jsonlint.co
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45]
May 14 16:25:45 raspberrypi homebridge[403]: /usr/lib/node_modules/homebridge/lib/server.js:207
May 14 16:25:45 raspberrypi homebridge[403]: throw err;
May 14 16:25:45 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
May 14 16:25:45 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
May 14 16:25:45 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
May 14 16:26:03 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
May 14 16:26:03 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
May 14 16:26:03 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 14 16:26:05 raspberrypi homebridge[883]: â<94><8C>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> npm update check failed â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> Try running with sudo or get access â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> to the local update config store via â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><94>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] Loaded plugin: homebridge-nest
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] Registering platform 'homebridge-nest.Nest'
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] ---
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] There was a problem reading your config.json file.
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] Please try pasting your config.json file here to validate it: http://jsonlint.co
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06]
May 14 16:26:06 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
May 14 16:26:06 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
May 14 16:26:06 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
May 14 16:26:17 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
May 14 16:26:17 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
May 14 16:26:17 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 14 16:26:19 raspberrypi homebridge[909]: â<94><8C>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> npm update check failed â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> Try running with sudo or get access â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> to the local update config store via â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><94>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] Loaded plugin: homebridge-nest
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] Registering platform 'homebridge-nest.Nest'
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] ---
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] There was a problem reading your config.json file.
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] Please try pasting your config.json file here to validate it: http://jsonlint.co
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20]
May 14 16:26:20 raspberrypi homebridge[909]: /usr/lib/node_modules/homebridge/lib/server.js:207

Can someone please help me. That would be much appreciated!

Ben
2018-05-14-165404_1824x984_scrot

ddsforlife commented May 14, 2018

Hi, I´m quite new to Raspberry Pi etc and have a question. Homebridge works fine when I manually open it. This is the error log that happens when I try and do the above (autoload).

-- Logs begin at Fri 2016-11-04 07:16:43 +14, end at Mon 2018-05-14 16:35:45 +13. --
May 14 16:25:26 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 14 16:25:39 raspberrypi homebridge[403]: â<94><8C>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> npm update check failed â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> Try running with sudo or get access â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> to the local update config store via â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><82> sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config â<94><82>
May 14 16:25:39 raspberrypi homebridge[403]: â<94><94>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] Loaded plugin: homebridge-nest
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] Registering platform 'homebridge-nest.Nest'
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] ---
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] There was a problem reading your config.json file.
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45] Please try pasting your config.json file here to validate it: http://jsonlint.co
May 14 16:25:45 raspberrypi homebridge[403]: [2018-5-14 16:25:45]
May 14 16:25:45 raspberrypi homebridge[403]: /usr/lib/node_modules/homebridge/lib/server.js:207
May 14 16:25:45 raspberrypi homebridge[403]: throw err;
May 14 16:25:45 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
May 14 16:25:45 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
May 14 16:25:45 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
May 14 16:26:03 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
May 14 16:26:03 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
May 14 16:26:03 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 14 16:26:05 raspberrypi homebridge[883]: â<94><8C>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> npm update check failed â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> Try running with sudo or get access â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> to the local update config store via â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><82> sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config â<94><82>
May 14 16:26:05 raspberrypi homebridge[883]: â<94><94>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] Loaded plugin: homebridge-nest
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] Registering platform 'homebridge-nest.Nest'
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] ---
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] There was a problem reading your config.json file.
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06] Please try pasting your config.json file here to validate it: http://jsonlint.co
May 14 16:26:06 raspberrypi homebridge[883]: [2018-5-14 16:26:06]
May 14 16:26:06 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
May 14 16:26:06 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
May 14 16:26:06 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
May 14 16:26:17 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
May 14 16:26:17 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
May 14 16:26:17 raspberrypi systemd[1]: Started Node.js HomeKit Server.
May 14 16:26:19 raspberrypi homebridge[909]: â<94><8C>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> npm update check failed â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> Try running with sudo or get access â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> to the local update config store via â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><82> sudo chown -R $USER:$(id -gn $USER) /home/homebridge/.config â<94><82>
May 14 16:26:19 raspberrypi homebridge[909]: â<94><94>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â<94><80>â
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] Loaded plugin: homebridge-nest
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] Registering platform 'homebridge-nest.Nest'
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] ---
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] There was a problem reading your config.json file.
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20] Please try pasting your config.json file here to validate it: http://jsonlint.co
May 14 16:26:20 raspberrypi homebridge[909]: [2018-5-14 16:26:20]
May 14 16:26:20 raspberrypi homebridge[909]: /usr/lib/node_modules/homebridge/lib/server.js:207

Can someone please help me. That would be much appreciated!

Ben
2018-05-14-165404_1824x984_scrot

@glk3504matic

This comment has been minimized.

Show comment
Hide comment
@glk3504matic

glk3504matic May 14, 2018

Hi, I am new to all of this and having a bit of trouble. My homebridge seems to error out every few hours. I tried reinstalling everything from scratch and the problem occurs. I am interested in using automatic restart on error to help solve my problem. I am running into an issue when trying to drag the homebridge and homebroidge.service folders into their location. I get a permissions issue. I am sure I am missing a basic thing and would appreciate any help. Thanks!

Hi, I am new to all of this and having a bit of trouble. My homebridge seems to error out every few hours. I tried reinstalling everything from scratch and the problem occurs. I am interested in using automatic restart on error to help solve my problem. I am running into an issue when trying to drag the homebridge and homebroidge.service folders into their location. I get a permissions issue. I am sure I am missing a basic thing and would appreciate any help. Thanks!

@node-ks

This comment has been minimized.

Show comment
Hide comment
@node-ks

node-ks May 16, 2018

@glk3504matic Use sudo pcmanfm to open an elevated file explorer and then try to move the folders.

node-ks commented May 16, 2018

@glk3504matic Use sudo pcmanfm to open an elevated file explorer and then try to move the folders.

@node-ks

This comment has been minimized.

Show comment
Hide comment
@node-ks

node-ks May 16, 2018

Anyone else run into the UUID issue?
Note: I intentionally left out the first few characters of the UUID
Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: xxxxxxxx-xxxx-467d-b156-96cce88db05b May 16 16:09:10 piOnTheRange homebridge[638]: at Bridge.Accessory.addBridgedAccessory (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:257:13) May 16 16:09:10 piOnTheRange homebridge[638]: at Server._configCachedPlatformAccessories (/usr/lib/node_modules/homebridge/lib/server.js:348:18) May 16 16:09:10 piOnTheRange homebridge[638]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:83:8) May 16 16:09:10 piOnTheRange homebridge[638]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) May 16 16:09:10 piOnTheRange homebridge[638]: at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) May 16 16:09:10 piOnTheRange homebridge[638]: at Module._compile (module.js:571:32) May 16 16:09:10 piOnTheRange homebridge[638]: at Object.Module._extensions..js (module.js:580:10) May 16 16:09:10 piOnTheRange homebridge[638]: at Module.load (module.js:488:32) May 16 16:09:10 piOnTheRange homebridge[638]: at tryModuleLoad (module.js:447:12)

node-ks commented May 16, 2018

Anyone else run into the UUID issue?
Note: I intentionally left out the first few characters of the UUID
Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: xxxxxxxx-xxxx-467d-b156-96cce88db05b May 16 16:09:10 piOnTheRange homebridge[638]: at Bridge.Accessory.addBridgedAccessory (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:257:13) May 16 16:09:10 piOnTheRange homebridge[638]: at Server._configCachedPlatformAccessories (/usr/lib/node_modules/homebridge/lib/server.js:348:18) May 16 16:09:10 piOnTheRange homebridge[638]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:83:8) May 16 16:09:10 piOnTheRange homebridge[638]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) May 16 16:09:10 piOnTheRange homebridge[638]: at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) May 16 16:09:10 piOnTheRange homebridge[638]: at Module._compile (module.js:571:32) May 16 16:09:10 piOnTheRange homebridge[638]: at Object.Module._extensions..js (module.js:580:10) May 16 16:09:10 piOnTheRange homebridge[638]: at Module.load (module.js:488:32) May 16 16:09:10 piOnTheRange homebridge[638]: at tryModuleLoad (module.js:447:12)

@glk3504matic

This comment has been minimized.

Show comment
Hide comment
@glk3504matic

glk3504matic May 16, 2018

img_0092
img_0093
I was able to get everything setup and placed correctly according to the step-by-step guide, but ran into this error. Any ideas? Thanks for the help on the elevated explorer window earlier.

img_0092
img_0093
I was able to get everything setup and placed correctly according to the step-by-step guide, but ran into this error. Any ideas? Thanks for the help on the elevated explorer window earlier.

@node-ks

This comment has been minimized.

Show comment
Hide comment
@node-ks

node-ks May 17, 2018

@glk3504matic use journalctl -u homebridge for a more detailed log. Also for your ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS in /etc/systemd/system/homebridge.service try ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS instead.

node-ks commented May 17, 2018

@glk3504matic use journalctl -u homebridge for a more detailed log. Also for your ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS in /etc/systemd/system/homebridge.service try ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS instead.

@node-ks

This comment has been minimized.

Show comment
Hide comment
@node-ks

node-ks May 17, 2018

@ddsforlife Your config.json file is probably corrupt and violates JSON formatting. Use http://jsonlint.co like the error suggests to validate the contents of your config.json file and then copy and paste the validated text back into the config.json file.

node-ks commented May 17, 2018

@ddsforlife Your config.json file is probably corrupt and violates JSON formatting. Use http://jsonlint.co like the error suggests to validate the contents of your config.json file and then copy and paste the validated text back into the config.json file.

@Patrykos9114

This comment has been minimized.

Show comment
Hide comment
@Patrykos9114

Patrykos9114 Jul 21, 2018

Any solution ? The homebridge server worked well for a few days, today it stopped.

zrzut ekranu 2018-07-21 o 20 16 52

zrzut ekranu 2018-07-21 o 20 17 42

Patrykos9114 commented Jul 21, 2018

Any solution ? The homebridge server worked well for a few days, today it stopped.

zrzut ekranu 2018-07-21 o 20 16 52

zrzut ekranu 2018-07-21 o 20 17 42

@mentaluproar

This comment has been minimized.

Show comment
Hide comment
@mentaluproar

mentaluproar Aug 7, 2018

I'm sorry. I don't understand where I'm messing up here. I get the following error.

sean@rock64:/etc/systemd/system$ systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: resources) since Tue 2018-08-07 05:29:14 UTC; 3s ago

Aug 07 05:29:14 rock64 systemd[1]: homebridge.service: Failed to run 'start' task: No such file or directory
Aug 07 05:29:14 rock64 systemd[1]: Failed to start Node.js HomeKit Server.
Aug 07 05:29:14 rock64 systemd[1]: homebridge.service: Unit entered failed state.
Aug 07 05:29:14 rock64 systemd[1]: homebridge.service: Failed with result 'resources'.

I'm sorry. I don't understand where I'm messing up here. I get the following error.

sean@rock64:/etc/systemd/system$ systemctl status homebridge
● homebridge.service - Node.js HomeKit Server
Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: resources) since Tue 2018-08-07 05:29:14 UTC; 3s ago

Aug 07 05:29:14 rock64 systemd[1]: homebridge.service: Failed to run 'start' task: No such file or directory
Aug 07 05:29:14 rock64 systemd[1]: Failed to start Node.js HomeKit Server.
Aug 07 05:29:14 rock64 systemd[1]: homebridge.service: Unit entered failed state.
Aug 07 05:29:14 rock64 systemd[1]: homebridge.service: Failed with result 'resources'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment