SOLVED Bazarr does not respond to service start/stop/status or autostart

sindreruud

Dabbler
Joined
Sep 21, 2017
Messages
24
Hi!

I have a issue with the service Bazarr that seems to be a TrueNAS/FreeBSD problem and not a bug with the service (?)

My system is TrueNAS-13.0-U4 and I have made a new iocage jail with 13.1-RELEASE-p7. Bazarr is installed and enabled with
Code:
pkg install bazarr
sysrc "bazarr_enable=YES"


Confirming it looks like it should
Code:
root@bazarr ~$ cat /etc/rc.conf
cron_flags="$cron_flags -J 15"

# Disable Sendmail by default
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Run secure syslog
syslogd_flags="-c -ss"

# Enable IPv6
ipv6_activate_all_interfaces="YES"
ifconfig_epair0b="SYNCDHCP"

bazarr_enable="YES"
rc_debug="YES"
rc_info="YES"


Now I should be able to do service bazarr start/stop/status. Note that I have added rc_debug and info to make it more verbose.

And now I try to start it:
Code:
root@bazarr ~$ service bazarr start
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: start_precmd: bazarr_precmd
Starting bazarr.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: doit:  limits -C daemon  su -m bazarr -c 'sh -c "/usr/sbin/daemon  -f -p /usr/local/bazarr/bazarr.pid /usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr"'

root@bazarr ~$ service bazarr status
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
bazarr is not running.


And now I try to start it by giving it the path, which works, and even service status works
Code:
root@bazarr ~$ /usr/local/etc/rc.d/bazarr start
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: start_precmd: bazarr_precmd
Starting bazarr.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: doit:  limits -C daemon  su -m bazarr -c 'sh -c "/usr/sbin/daemon  -f -p /usr/local/bazarr/bazarr.pid /usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr"'

root@bazarr ~$ service bazarr status
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
bazarr is running as pid 10012.


Now that it is running it responds to service status and stop:
Code:
root@bazarr ~$ service bazarr status
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
bazarr is running as pid 10012.

root@bazarr ~$ service bazarr stop
Stopping bazarr.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: doit: su -m bazarr -c 'sh -c "kill -TERM 10012"'
Waiting for PIDS: 10012.

root@bazarr ~$ service bazarr status
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
bazarr is not running.


But it is not able to start it again:
Code:
root@bazarr ~$ service bazarr start
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: start_precmd: bazarr_precmd
Starting bazarr.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: doit:  limits -C daemon  su -m bazarr -c 'sh -c "/usr/sbin/daemon  -f -p /usr/local/bazarr/bazarr.pid /usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr"'

root@bazarr ~$ service bazarr status
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
bazarr is not running.


Here is the rc.d file
Code:
#!/bin/sh
#
# Author: Michiel van Baak <michiel@vanbaak.eu>
#
# $FreeBSD: $
#
# PROVIDE: bazarr
# REQUIRE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable bazarr:
# bazarr_enable:   Set to NO by default. Set it to YES to enable it.
# bazarr_user:     The user account bazarr daemon runs as what
#                  you want it to be.
# bazarr_datadir:  Directory where bazarr user data lives.
#                  Default: /usr/local/bazarr

. /etc/rc.subr

name=bazarr
rcvar=bazarr_enable

load_rc_config ${name}

: ${bazarr_enable:=NO}
: ${bazarr_user:=bazarr}
: ${bazarr_datadir:="/usr/local/bazarr"}

pidfile="${bazarr_datadir}/bazarr.pid"
procname="/usr/local/bin/python3.9"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} ${procname} /usr/local/share/bazarr/bin/bazarr.py --no-update -c ${bazarr_datadir}"
start_precmd=bazarr_precmd

bazarr_precmd()
{
        if [ ! -d ${bazarr_datadir} ]; then
                install -d -o ${bazarr_user} ${bazarr_datadir}
        fi
}

run_rc_command "$1"


And here is sanity checking the paths:
Code:
root@bazarr ~$ ls -l /usr/local/bin/python3.9
-r-xr-xr-x  1 root  wheel  5200 Feb 18 02:10 /usr/local/bin/python3.9

root@bazarr ~$ ls -l /usr/local/share/bazarr/bin
total 24
drwxr-xr-x   2 root  wheel     4 Mar 27 13:04 __pycache__
drwxr-xr-x  10 root  wheel    15 Mar 27 13:04 bazarr
-rw-r--r--   1 root  wheel  3661 Dec  5 03:32 bazarr.py
drwxr-xr-x   3 root  wheel     3 Mar 27 13:04 frontend
drwxr-xr-x  99 root  wheel   115 Mar 27 13:05 libs
-rw-r--r--   1 root  wheel    61 Dec  5 03:32 requirements.txt
-rw-r--r--   1 root  wheel     7 Dec  5 03:32 VERSION

root@bazarr ~$ ls -l /usr/local/bazarr
total 4
drwxr-xr-x  2 bazarr  wheel  2 Mar 27 13:07 backup
-rw-------  1 bazarr  wheel  5 Mar 27 13:27 bazarr.pid
drwxr-xr-x  2 bazarr  wheel  2 Mar 27 13:07 cache
drwxr-xr-x  2 bazarr  wheel  4 Mar 27 13:07 config
drwxr-xr-x  2 bazarr  wheel  5 Mar 27 13:27 db
drwxr-xr-x  2 bazarr  wheel  3 Mar 27 13:07 log
drwxr-xr-x  2 bazarr  wheel  2 Mar 27 13:07 restore



Checking /var/log/messages for the jail I cannot see any relevant messages either. This makes me a bit lost, and I really have no idea where to go from here. Anyone see anything obvious that I might have overlooked?

Edit: Forgot to mention that restarting the iocage does not autostart the service either, and I can't find any log messages (also don't know where to look, other then /var/log/messages) to give me an idea why it doesn't start.

Edit2: Here is the /var/log/messages when restarting the iocage


Code:
Mar 27 13:56:13 bazarr syslogd: kernel boot file is /boot/kernel/kernel
Mar 27 13:56:13 bazarr root[12106]: /etc/rc: DEBUG: run_rc_command: doit: pkg_start
Mar 27 13:56:13 bazarr root[12113]: /etc/rc: DEBUG: checkyesno: bsnmpd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12118]: /etc/rc: DEBUG: run_rc_command: doit: pwcheck_start
Mar 27 13:56:13 bazarr root[12124]: /etc/rc: DEBUG: checkyesno: rpcbind_enable is set to NO.
Mar 27 13:56:13 bazarr root[12129]: /etc/rc: DEBUG: run_rc_command: doit: nisdomain_start
Mar 27 13:56:13 bazarr root[12134]: /etc/rc: DEBUG: checkyesno: nis_server_enable is set to NO.
Mar 27 13:56:13 bazarr root[12139]: /etc/rc: DEBUG: checkyesno: nis_ypldap_enable is set to NO.
Mar 27 13:56:13 bazarr root[12144]: /etc/rc: DEBUG: checkyesno: nis_ypxfrd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12149]: /etc/rc: DEBUG: checkyesno: rpc_ypupdated_enable is set to NO.
Mar 27 13:56:13 bazarr root[12154]: /etc/rc: DEBUG: checkyesno: nis_client_enable is set to NO.
Mar 27 13:56:13 bazarr root[12159]: /etc/rc: DEBUG: checkyesno: nis_ypset_enable is set to NO.
Mar 27 13:56:13 bazarr root[12164]: /etc/rc: DEBUG: checkyesno: keyserv_enable is set to NO.
Mar 27 13:56:13 bazarr root[12169]: /etc/rc: DEBUG: checkyesno: nis_yppasswdd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12175]: /etc/rc: DEBUG: checkyesno: rtadvd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12180]: /etc/rc: DEBUG: run_rc_command: doit: local_start
Mar 27 13:56:13 bazarr root[12185]: /etc/rc: DEBUG: checkyesno: lpd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12196]: /etc/rc: DEBUG: checkyesno: nscd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12201]: /etc/rc: DEBUG: checkyesno: rarpd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12206]: /etc/rc: DEBUG: checkyesno: rwhod_enable is set to NO.
Mar 27 13:56:13 bazarr root[12211]: /etc/rc: DEBUG: run_rc_command: doit: utx boot
Mar 27 13:56:13 bazarr root[12217]: /etc/rc: DEBUG: checkyesno: ftpproxy_enable is set to NO.
Mar 27 13:56:13 bazarr root[12223]: /etc/rc: DEBUG: run_rc_command: doit: msgs_start
Mar 27 13:56:13 bazarr root[12229]: /etc/rc: DEBUG: checkyesno: bazarr_enable is set to YES.
Mar 27 13:56:13 bazarr root[12233]: /etc/rc: DEBUG: run_rc_command: start_precmd: bazarr_precmd
Mar 27 13:56:13 bazarr root[12237]: /etc/rc: DEBUG: checkyesno: rc_startmsgs is set to YES.
Mar 27 13:56:13 bazarr root[12241]: /etc/rc: DEBUG: run_rc_command: doit:  limits -C daemon  su -m bazarr -c 'sh -c "/usr/sbin/daemon  -f -p /usr/local/bazarr/bazarr.pid /usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr"'
Mar 27 13:56:13 bazarr root[12251]: /etc/rc: DEBUG: checkyesno: inetd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12256]: /etc/rc: DEBUG: checkyesno: ftpd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12261]: /etc/rc: DEBUG: checkyesno: cron_dst is set to YES.
Mar 27 13:56:13 bazarr root[12265]: /etc/rc: DEBUG: checkyesno: cron_enable is set to YES.
Mar 27 13:56:13 bazarr root[12269]: /etc/rc: DEBUG: checkyesno: rc_startmsgs is set to YES.
Mar 27 13:56:13 bazarr root[12273]: /etc/rc: DEBUG: run_rc_command: doit:  limits -C daemon  /usr/sbin/cron  -J 15 -s
Mar 27 13:56:13 bazarr root[12280]: /etc/rc: DEBUG: checkyesno: sendmail_enable is set to NO.
Mar 27 13:56:13 bazarr root[12284]: /etc/rc: DEBUG: checkyesno: sendmail_submit_enable is set to NO.
Mar 27 13:56:13 bazarr root[12288]: /etc/rc: DEBUG: checkyesno: sendmail_enable is set to NO.
Mar 27 13:56:13 bazarr root[12292]: /etc/rc: DEBUG: checkyesno: sendmail_submit_enable is set to NO.
Mar 27 13:56:13 bazarr root[12296]: /etc/rc: DEBUG: checkyesno: sendmail_outbound_enable is set to NO.
Mar 27 13:56:13 bazarr root[12300]: /etc/rc: DEBUG: checkyesno: sendmail_msp_queue_enable is set to NO.
Mar 27 13:56:13 bazarr root[12305]: /etc/rc: DEBUG: checkyesno: sshd_enable is set to NO.
Mar 27 13:56:13 bazarr root[12310]: /etc/rc: DEBUG: run_rc_command: doit: /etc/rc.d/sysctl lastload
Mar 27 13:56:13 bazarr root[12319]: /etc/rc.d/sysctl: DEBUG: run_rc_command: doit: sysctl_start last
Mar 27 13:56:13 bazarr root[12325]: /etc/rc: DEBUG: checkyesno: jail_enable is set to NO.
Mar 27 13:56:13 bazarr root[12330]: /etc/rc: DEBUG: checkyesno: kern_securelevel_enable is set to NO.
(END)
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
pkg install bazarr sysrc "radarr_enable=YES"
Well there's your problem right there...

You install: Bazarr
You enable: radarr

Those are not the same thing.
 

sindreruud

Dabbler
Joined
Sep 21, 2017
Messages
24
Well there's your problem right there...

You install: Bazarr
You enable: radarr

Those are not the same thing.
Sorry, that's a copy/paste error in the post i made, not on the system. I will fix the post asap.

As verified in the rc.conf, it's definitely
bazarr_enable="YES"
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
/usr/local/share/bazarr/bin/bazarr.py
I see that this file would not be executable for the bazarr user... maybe that's it? Probably not much harm in setting that whole directory structure to be owned by bazarr too.
 

sindreruud

Dabbler
Joined
Sep 21, 2017
Messages
24
I see that this file would not be executable for the bazarr user... maybe that's it? Probably not much harm in setting that whole directory structure to be owned by bazarr too.
I've had that thought aswell, so I already tried that without luck unfortunately. And since /usr/local/etc/rc.d/bazarr start actually works it doesn't seem to be a permissions issue.

Anyway, here is the output after owner and mode is changed:
Code:
root@bazarr ~$ ls -l /usr/local/share/
total 136
[...]
drwxr-xr-x    3 bazarr  bazarr    4 Mar 27 13:05 bazarr
[...]

ls -l /usr/local/share/bazarr
total 13
drwxr-xr-x  6 bazarr  bazarr    9 Mar 27 13:05 bin
-rw-r--r--  1 bazarr  bazarr  298 Mar 23 12:54 package_info

root@bazarr ~$ ls -l /usr/local/share/bazarr/bin
total 24
drwxr-xr-x   2 bazarr  bazarr     4 Mar 27 13:04 __pycache__
drwxr-xr-x  10 bazarr  bazarr    15 Mar 27 13:04 bazarr
-rwxr-xr-x   1 bazarr  bazarr  3661 Dec  5 03:32 bazarr.py
drwxr-xr-x   3 bazarr  bazarr     3 Mar 27 13:04 frontend
drwxr-xr-x  99 bazarr  bazarr   115 Mar 27 13:05 libs
-rw-r--r--   1 bazarr  bazarr    61 Dec  5 03:32 requirements.txt
-rw-r--r--   1 bazarr  bazarr     7 Dec  5 03:32 VERSION

root@bazarr ~$ service bazarr start
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: start_precmd: bazarr_precmd
Starting bazarr.
/usr/local/etc/rc.d/bazarr: DEBUG: run_rc_command: doit:  limits -C daemon  su -m bazarr -c 'sh -c "/usr/sbin/daemon  -f -p /usr/local/bazarr/bazarr.pid /usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr"'

root@bazarr ~$ service bazarr status
/usr/local/etc/rc.d/bazarr: DEBUG: pid file (/usr/local/bazarr/bazarr.pid): not readable.
/usr/local/etc/rc.d/bazarr: DEBUG: checkyesno: bazarr_enable is set to YES.
bazarr is not running.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Try running just this bit:

/usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr
 

sindreruud

Dabbler
Joined
Sep 21, 2017
Messages
24
Try running just this bit:

/usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr

That works:

Code:
root@bazarr ~$ /usr/local/bin/python3.9 /usr/local/share/bazarr/bin/bazarr.py --no-update -c /usr/local/bazarr
Bazarr starting...
2023-03-27 17:51:55,346 - root                             (800e12000) :  INFO (server:67) - BAZARR is started and waiting for request on http://0.0.0.0:6767


However, I have made a new realization.

If I do /usr/local/etc/rc.d/bazarr start the bazarr logs say
Code:
27/03/2023 17:29:57|INFO   |root    |BAZARR is started and waiting for request on http://***.***.***.***:6767|


However, if I do service bazarr start it seems like it actually tries to start, because it makes this log entry right after:
Code:
27/03/2023 17:35:54|ERROR   |root                            |BAZARR requires a rar archive extraction utilities (unrar, unar) and it can't be found.|
'Traceback (most recent call last):\n 
File "/usr/local/share/bazarr/bin/bazarr/init.py", line 198, in init_binaries\n   
    exe = get_binary("unar")\n  File "/usr/local/share/bazarr/bin/bazarr/utilities/binaries.py", line 73, in get_binary\n   
    raise BinaryNotFound\n
    utilities.binaries.BinaryNotFound\n\n

During handling of the above exception, another exception occurred:\n\n
Traceback (most recent call last):\n 
File "/usr/local/share/bazarr/bin/bazarr/init.py", line 204, in init_binaries\n   
    exe = get_binary("unrar")\n 
File "/usr/local/share/bazarr/bin/bazarr/utilities/binaries.py", line 73, in get_binary\n   
    raise BinaryNotFound\n
    utilities.binaries.BinaryNotFound'|


Really confusing that the error only comes from the one method, not both methods. But I guess this is a bug with the application (?)
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
You could just install unar/unrar (pkg install unar unrar)
 

sindreruud

Dabbler
Joined
Sep 21, 2017
Messages
24
unrar was already installed, but not unar.
Code:
root@bazarr ~$ which unar
unar not found

root@bazarr ~$ which unrar
/usr/local/bin/unrar


So I have tried installing unar now and restarting the jail, but still get the same error in the logs. I have made a bug report on the github page.
 

sindreruud

Dabbler
Joined
Sep 21, 2017
Messages
24
Yeah.. I'm the idiot, sorry for wasting your time. I changed the shell to zsh in the jail i was creating out of pure habit. Guess it is a bad idea to change the shell of the root user... Guess I have learned the hard way.

Setting the shell back to the default csh has fixed the issue.

Thank you for taking the time to help @sretalla, very much appreciated!
 
Top