diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.58k stars 280 forks source link

Hue-emulator service won't start #950

Open 350d opened 1 year ago

350d commented 1 year ago

Issue does not already exist?

I have searched and found no existing issue

Select Environment

Install Script

Home Assistant related?

No

Description

Hello! I have automatic setup on my RPi finished without any errors (except service not running) and I can run manually HueEmulator.py script and access web UI without any problems but my hue-emulator.service won't start and I don't see any errors in service status, just inactive (dead). sudo systemctl start hue-emulator.service just hangs and nothing happening...

Errorlog:

sudo journalctl -u hue-emulator.service
-- Journal begins at Sun 2023-07-16 16:17:01 EEST, ends at Wed 2023-11-15 00:07:14 EET. --
-- No entries --

Steps to reproduce

Run install script on my RPi. Its hangs on last step - Start service.

Please enter your operating system details here

Raspbian GNU/Linux 11 (bullseye)

What DiyHue version(branch) are you using?

master (latest)

mariusmotea commented 1 year ago

No errors in syslog? What happens if you execute sudo /opt/hue-emulator/HueEmulator3.py --debug ?

350d commented 1 year ago
image

Can you help me with syslog? How to check it?

mariusmotea commented 1 year ago

It looks like this is working fine if you start it manually. When executed as service it must log in syslog (most likely /var/log/syslog). Check this file with tail -f /var/log/syslog while you start the service from another console (sudo systemctl start hue-emulator)

350d commented 1 year ago

Nothing in tail -f /var/log/syslog while i start the service...

mariusmotea commented 1 year ago

try also sudo journalctl -u hue-emulator.service

350d commented 1 year ago

As I've mentioned in my bug report - there is nothing in sudo journalctl -u hue-emulator.service

350d commented 1 year ago

I've tried to comment out all Thread() lines in HueEmulator.py for test service start - doesn't work anyway. How I can check what's wrong with this service script in other way?

mariusmotea commented 1 year ago

I have no clue why nothing is logged. Have you tried to reinstall the application? Ensure you have the content from here in the systemd service file and do a systemctl daemon-reload to be sure it is applied.

Any exit code specified in the service status?

https://stackoverflow.com/questions/60776373/systemd-service-doesnt-start-silently-how-to-debug

350d commented 1 year ago

I've checked shebang in .py script and I've added absolute path to service file like ExecStart=/usr/bin/python3 /opt/hue-emulator/HueEmulator3.py and tested it before in cli via sudo /usr/bin/python3 /opt/hue-emulator/HueEmulator3.py and still no service start and silent journalctl. How I can add any logger lines like "IM HERE 1111" to the script just for testing?

Justdigit commented 1 year ago

I guess the Hue Team are closing down this DIY project... I am running the system on older versions... The new versions don't work for me.

mariusmotea commented 1 year ago

They cannot close the project because Hue Essentials will continue to support it and on Android you can install the last apk version that don't require cloud account.

I guess the Hue Team are closing down this DIY project... I am running the system on older versions... The new versions don't work for me.

350d commented 1 year ago

OK, UPDATE:

I've commented out After line in [Unit] section and service can run now without any problems.

[Unit]
Description=Hue Emulator Service
#After=multi-user.target
...
mariusmotea commented 1 year ago

There is an issue with your installation because it never reach runlevel 2. Probable more services are not starting...

https://unix.stackexchange.com/questions/404667/systemd-service-what-is-multi-user-target

Unix & Linux Stack Exchange
Systemd service - what is `multi-user.target`
I have come across a .service that contains the following: [Install] WantedBy=multi-user.target The original .service file can be found HERE. I am on Ubuntu 16.04LTS.