locast2plex icon indicating copy to clipboard operation
locast2plex copied to clipboard

Linux - won't complete startup when running as a service

Open kpix01 opened this issue 3 years ago • 16 comments

I'm trying to run locast2plex as a service (non-Docker), per the instructions in the readme. The service seems to start successfully, and Plex detects it , but it can't scan for channels. When I look at the log file, the last line is "Starting EPG thread..." and never continues to the next step, which should be "Locast2Plex is now online."

I've tried this 4 times, on freshly installed systems, 3 on the latest Debian, and once on Ubuntu Server. I'm getting the same result every time..

I'm running python3 main.py manually from the command line for now and just staying logged into the console, which seems to be working, but it's obviously not ideal.

Log file: Initiating Locast2Plex v0.6.5 Opening and Verifying Configuration File. /opt/locast2plex/config/config.ini /opt/locast2plex/config.ini Loading Configuration File: /opt/locast2plex/config.ini Tuner count set to 3 Server is set to run on 127.0.0.1:6077 No UUID found. Generating one now... UUID set to: wroonqxz... Getting user location... Getting location via IP Address. Got external IP redacted. Got location as Seattle - DMA 819 - Lat\Lon redacted-redacted Logging into Locast using username redacted... Validating User Info... User Info obtained. User didDonate: True User donationExpire: 2021-03-07 22:28:55 Starting First time Stations refresh... Checking FCC facilities database for updates. Cached facilities database is current. Getting list of stations based on DMA... Found 48 stations for DMA 819 Starting Stations thread... Starting device server on 127.0.0.1:6077 Now listening for requests. Starting SSDP server... Starting First time EPG refresh... Fetching: https://api.locastnet.org/api/watch/epg/819?startTime=2021-02-10T00:00:00 Fetching: https://api.locastnet.org/api/watch/epg/819?startTime=2021-02-11T00:00:00 Fetching: https://api.locastnet.org/api/watch/epg/819?startTime=2021-02-12T00:00:00 Fetching: https://api.locastnet.org/api/watch/epg/819?startTime=2021-02-13T00:00:00 Fetching: https://api.locastnet.org/api/watch/epg/819?startTime=2021-02-14T00:00:00 Fetching: https://api.locastnet.org/api/watch/epg/819?startTime=2021-02-15T00:00:00 Starting EPG thread...

kpix01 avatar Feb 10 '21 23:02 kpix01

I have the same issue, but the problem appears to be on the 'systemctl start locast2plex' command.

$ systemctl start locast2plex Job for locast2plex.service failed because the control process exited with error code. See "systemctl status locast2plex.service" and "journalctl -xe" for details.

$ systemctl status locast2plex.service ● locast2plex.service - locast2plex background service Loaded: loaded (/etc/systemd/system/locast2plex.service; enabled; vendor pre Active: failed (Result: exit-code) since Wed 2021-02-17 13:01:57 PST; 2min 3 Process: 2287 ExecStartPre=/usr/bin/touch /var/log/locast2plex.log (code=exit Feb 17 13:01:57 raspberrypi systemd[1]: Starting locast2plex background service Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Changing to the Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Failed at step Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Control process ex Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Failed with result Feb 17 13:01:57 raspberrypi systemd[1]: Failed to start locast2plex background lines 1-11/11 (END)...skipping... ● locast2plex.service - locast2plex background service Loaded: loaded (/etc/systemd/system/locast2plex.service; enabled; vendor pre Active: failed (Result: exit-code) since Wed 2021-02-17 13:01:57 PST; 2min 3 Process: 2287 ExecStartPre=/usr/bin/touch /var/log/locast2plex.log (code=exit Feb 17 13:01:57 raspberrypi systemd[1]: Starting locast2plex background service Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Changing to the Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Failed at step Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Control process ex Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Failed with result Feb 17 13:01:57 raspberrypi systemd[1]: Failed to start locast2plex background ● locast2plex.service - locast2plex background service Loaded: loaded (/etc/systemd/system/locast2plex.service; enabled; vendor pr Active: failed (Result: exit-code) since Wed 2021-02-17 13:01:57 PST; 2min Process: 2287 ExecStartPre=/usr/bin/touch /var/log/locast2plex.log (code=exi Feb 17 13:01:57 raspberrypi systemd[1]: Starting locast2plex background servic Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Changing to th Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Failed at step Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Control process e Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Failed with resul Feb 17 13:01:57 raspberrypi systemd[1]: Failed to start locast2plex background ● locast2plex.service - locast2plex background service Loaded: loaded (/etc/systemd/system/locast2plex.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2021-02-17 13:01:57 PST; 2min 35s ago Process: 2287 ExecStartPre=/usr/bin/touch /var/log/locast2plex.log (code=exited, status=200/CHDIR) Feb 17 13:01:57 raspberrypi systemd[1]: Starting locast2plex background service... Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Changing to the requested working directory failed: No such file or directory Feb 17 13:01:57 raspberrypi systemd[2287]: locast2plex.service: Failed at step CHDIR spawning /usr/bin/touch: No such file or directory Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Control process exited, code=exited, status=200/CHDIR Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Failed with result 'exit-code'. Feb 17 13:01:57 raspberrypi systemd[1]: Failed to start locast2plex background service.

$ journalctl -xe -- An ExecStartPre= process belonging to unit locast2plex.service has exited. -- -- The process' exit code is 'exited' and its exit status is 200. Feb 17 13:01:57 raspberrypi systemd[1]: locast2plex.service: Failed with resul -- Subject: Unit failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- The unit locast2plex.service has entered the 'failed' state with result 'ex Feb 17 13:01:57 raspberrypi systemd[1]: Failed to start locast2plex background -- Subject: A start job for unit locast2plex.service has failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- A start job for unit locast2plex.service has finished with a failure. -- -- The job identifier is 3318 and the job result is failed. Feb 17 13:01:57 raspberrypi polkitd(authority=local)[553]: Unregistered Authen Feb 17 13:04:33 raspberrypi systemd[1]: Configuration file /etc/systemd/system

I'm still learning, so if there's an obvious fix in these entries, I appreciate the heads up!

EDIT: Copy/pasta wasn't complete on systemctl status

mike16437 avatar Feb 17 '21 21:02 mike16437

Any chance you can paste your systemd file in here to look at?

Guyverix avatar Feb 19 '21 20:02 Guyverix

Also from your output, I would suggest cheating.. Active: failed (Result: exit-code) since Wed 2021-02-17 13:01:57 PST; 2min Process: 2287 ExecStartPre=/usr/bin/touch /var/log/locast2plex.log

try sudo touch /var/log/locast2plex.log ; sudo chmod 777 /var/log/locast2plex.log

Guyverix avatar Feb 19 '21 20:02 Guyverix

Can you guys pleas help me out here? Similar issue trying to get locast2plex starting automatically with Ubuntu:

Mar 29 20:37:49 BillyLInux systemd[1]: Starting locast2plex background service... Mar 29 20:37:49 BillyLInux systemd[3626]: locast2plex.service: Changing to the requested working directory failed: No such file or directory Mar 29 20:37:49 BillyLInux systemd[3626]: locast2plex.service: Failed at step CHDIR spawning /usr/bin/touch: No such file or directory Mar 29 20:37:49 BillyLInux systemd[1]: locast2plex.service: Control process exited, code=exited, status=200/CHDIR Mar 29 20:37:49 BillyLInux systemd[1]: locast2plex.service: Failed with result 'exit-code'. Mar 29 20:37:49 BillyLInux systemd[1]: Failed to start locast2plex background service.

Billymalcolm avatar Mar 30 '21 00:03 Billymalcolm

locate the touch executable file and copy or symlink it to /usr/bin

Guyverix avatar Mar 30 '21 01:03 Guyverix

locate the touch executable file and copy or symlink it to /usr/bin

But that's where the file called "touch" already is.

Billymalcolm avatar Mar 30 '21 17:03 Billymalcolm

Is it an actual file or a symlink to something that does not exist? try ls -la /usr/bin/touch, and see if it is zero byte, or non-executable, or messed up permissions perhaps? If you are also symlinked, make sure the destination file really exists as well.

Here is what I have: ` chubbard@guyver-office:~$ ls -la /usr/bin/touch

lrwxrwxrwx 1 root root 10 Jan 21 14:22 /usr/bin/touch -> /bin/touch

chubbard@guyver-office:~$ `

Guyverix avatar Mar 30 '21 18:03 Guyverix

Is it an actual file or a symlink to something that does not exist? try ls -la /usr/bin/touch, and see if it is zero byte, or non-executable, or messed up permissions perhaps? If you are also symlinked, make sure the destination file really exists as well.

Here is what I have: ` chubbard@guyver-office:~$ ls -la /usr/bin/touch

lrwxrwxrwx 1 root root 10 Jan 21 14:22 /usr/bin/touch -> /bin/touch

chubbard@guyver-office:~$ `

Mine is: -rwxrwxrwx 1 root root 100728 Sep 5 2019 /usr/bin/touch Not a link... Thanks for all your help!

Billymalcolm avatar Mar 30 '21 18:03 Billymalcolm

Hmm, are you actually able to run sudo /usr/bin/touch /var/log/locast2plex.log ?

Guyverix avatar Mar 30 '21 19:03 Guyverix

Wait a second. Did you update your systemd file? It assumes things like the install directory is in /opt. Did you get all that updated to the correct path?

Guyverix avatar Mar 30 '21 19:03 Guyverix

Wait a second. Did you update your systemd file? It assumes things like the install directory is in /opt. Did you get all that updated to the correct path?

I did not... None of the tutorials I read said to do that, or I completely missed it if they did...

Billymalcolm avatar Mar 30 '21 19:03 Billymalcolm

Wait a second. Did you update your systemd file? It assumes things like the install directory is in /opt. Did you get all that updated to the correct path?

I did not... None of the tutorials I read said to do that, or I completely missed it if they did...

If you might be able to tell me how to do that I would appreciate it! Something of a Linux newbie, I can get around but thats about all...

Billymalcolm avatar Mar 30 '21 19:03 Billymalcolm

ok, know the exact path of where you installed locast2plex, then sudo nano /etc/systemd/ (where-ever you put your systemd file itself). Edit all the service stuff that points to /opt/locast2plex (or reinstall locast2plex to the /opt directory).. The systemd file itself has some notes on what needs done. ( or look at the systemd file in the gihub GUI)

Guyverix avatar Mar 30 '21 19:03 Guyverix

Yes! I see the notes at the top now, thanks o much. I did all that and I made progress, now its saying that locast2plex.service: Failed at step EXEC spawning /usr/sbin/daemonize: No such file. I couldn't do the yum install, I did apt get daemonize, which worked. I'm actually having a good time figuring this out now that you have me pointed in the right direction. Thanks so much!!

Billymalcolm avatar Mar 30 '21 19:03 Billymalcolm

ok, know the exact path of where you installed locast2plex, then sudo nano /etc/systemd/ (where-ever you put your systemd file itself). Edit all the service stuff that points to /opt/locast2plex (or reinstall locast2plex to the /opt directory).. The systemd file itself has some notes on what needs done. ( or look at the systemd file in the gihub GUI)

Got it working. You're my hero. Thanks so much.

Billymalcolm avatar Mar 30 '21 19:03 Billymalcolm

Cool! Glad you were able to get that straightened out! Now only 72 more tickets that I can poke at :)

Guyverix avatar Mar 30 '21 21:03 Guyverix