SOLVED [PSA] Sonarr v4 Upgrade in a Jail

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
[This applies to TrueNAS CORE and the Jail system, not to SCALE]

Just to let anyone know in advance...

Sonarr has released a v4, which is based on dotnet (no longer Mono... although at least one dependency library is still used from Mono).

In order to take an existing jail from running sonarr v3, you will need to do at least 2 things:

1. make sure your jail is set for allow_mlock (iocage set allow_mlock=1 <jailname>)

2. from inside the jail (iocage console <jailname>) either remove the sonarr pkg (pkg remove sonarr) and install the sonarr-devel pkg (pkg install sonarr-devel) or upgrade the sonarr-devel pkg if that's already what you had (pkg upgrade ... then y)

if you're not sure which pkg you're running, use pkg info | grep sonarr.

EDIT: The sonarr pkg has now been upgraded in the latest train, so you can probably just use that now, no need to remain on the sonarr-devel pkg.

That has worked fine in my experience (after a bit of figuring it out).
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
In case it helps, here's a script which would install you a jail from scratch with the new version:

Code:
echo '{"pkgs":["sonarr"]}' > /tmp/pkg.json
iocage create -n "sonarr" -p /tmp/pkg.json -r 13.2-RELEASE dhcp="on" vnet="on" allow_raw_sockets="1" allow_mlock=1 boot="on" bpf="yes"
rm /tmp/pkg.json
iocage exec sonarr mkdir -p /config
iocage exec sonarr mkdir -p /mnt/TV
iocage exec sonarr mkdir -p /mnt/downloads
iocage fstab -a sonarr /mnt/appspool/apps/sonarr /config nullfs rw 0 0
iocage fstab -a sonarr /mnt/datapool/data/Multimedia/TV /mnt/TV nullfs rw 0 0
iocage fstab -a sonarr /mnt/datapool/Downloads /mnt/downloads nullfs rw 0 0
iocage exec sonarr "pw user add sonarruser -c sonarruser -u 568 -d /nonexistent -s /usr/bin/nologin"
iocage exec sonarr chown -R sonarruser:wheel /usr/local/share/sonarr /config
iocage exec sonarr chown sonarruser:wheel /usr/local/etc/rc.d/sonarr
iocage exec sonarr chmod u+x /usr/local/etc/rc.d/sonarr
iocage exec sonarr sysrc "sonarr_enable=YES"
iocage exec sonarr sysrc "sonarr_user=sonarruser"
iocage exec sonarr sysrc "sonarr_data_dir=/config"
iocage exec sonarr service sonarr start
iocage exec sonarr mkdir -p /usr/local/etc/pkg/repos
iocage exec sonarr echo 'FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest" }' >/usr/local/etc/pkg/repos/FreeBSD.conf


You'll need to edit the username (sonarruser), uid (568) and paths (everything beginning with /mnt/) to ones that make sense on your system.

You may also need to work out if that last line will work without being at the console of the jail... too many quotes and brackets to work as an iocage exec, I think.
 
Last edited:

TripitakaBC

Cadet
Joined
Mar 10, 2015
Messages
4
OK, so my setup is a little funky but it worked after I ran chown -R sonarr:[my media group] /usr/local/share/sonarr and /usr/local/sonarr

Also, v4 is now on main release so uninstalling sonarr v3 then installing sonarr v4 works OK. If you can't uninstall v3 then most likely - like me - you had locked it to prevent it breaking with the who sqlite and mono issue a while back. Run pkg sonarr unlock and then pkg remove sonarr

Dont forget to backup BEFORE you uninstall!!!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Indeed, seems now the pkg sonarr is already v4 and sonarr-devel has been left behind in the latest (not yet in quarterly).

If you were using another user than the automatically created "sonarr" for your jail, you indeed do need to run the chown as indicated above with your custom user and/or group in there.
 
Last edited:

pnmhunter

Cadet
Joined
Jan 13, 2024
Messages
1
Thanks this worked for me.
To get past the forced login I had to edit /usr/local/sonarr/config.xml
<AuthenticationMethod>Basic</AuthenticationMethod>
<AuthenticationRequired>DisabledForLocalAddresses</AuthenticationRequired>
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
To get past the forced login I had to edit /usr/local/sonarr/config.xml
<AuthenticationMethod>Basic</AuthenticationMethod>
<AuthenticationRequired>DisabledForLocalAddresses</AuthenticationRequired>
I was able to set that in the GUI after the first login following the upgrade... not sure on the settings that made it necessary for you to edit that way, but good to know in case.
 
Joined
Jan 18, 2024
Messages
1
One other thing I had to do, my jail wouldn't pull v4 (instead tried to reinstall v3) until I changed my FreeBSD.conf file from 'quarterly' to 'latest'.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Thanks for the post helped me get things working. Specifically all I had to do was set mlock for my jail. Everything else just works and upon loading up the webpage for the first time I was prompted for the authentication setup.

When things were not working I was seeing sonarr get partially started, this is all I saw from 'ps auxw | grep sonarr'
Code:
daemon: /usr/local/share/sonarr/bin/Sonarr[43122] (daemon)


After doing the mlock change I see two processes.
Code:
/usr/local/share/sonarr/bin/Sonarr --data=/usr/local/sonarr --nobrowser
daemon: /usr/local/share/sonarr/bin/Sonarr[43122] (daemon)



1706071857212.png
 
Last edited:

xCatalystx

Contributor
Joined
Dec 3, 2014
Messages
117
My upgrade process looked like the following - for anyones ref:

iocage exec <jailname> "service stop sonarr" && iocage snapshot <jailname>

iocage exec <jailname> "pkg update && pkg upgrade"
iocage exec <jailname> "chown -R sonarr:sonarr /usr/local/share/sonarr"
iocage exec <jailname> "chown -R sonarr:sonarr /usr/local/sonarr/"

iocage set allow_mlock=1 <jailname>
iocage restart <jailname>

iocage exec <jailname> "service sonarr status"

Note: In my case one jail just needed mlock - while the other needed mlock and chown on /usr/local/sonarr (both /usr/local/share/sonarr were correct)
 
Top