[How-To] Manually upgrade mono from 5.10 to 5.20 in a FreeNAS Jail

[How-To] Manually upgrade mono from 5.10 to 5.20 in a FreeNAS Jail

thxtex

Dabbler
Joined
Dec 8, 2017
Messages
27
Based on this resource I wrote a script that will create a jail with mono 5.10 and patch it up to 6.8.0.96. Put the code into a text file e.g. mono_patch.run and run it with "sh mono_patch.run".
It will run for half an hour. You will need to press enter once. At the end you will have a mono package in the root inside the jail. Copy it to the other jails requiring it and delete the mono_patch jail after use.

Thanks to ChaosBlade for the resource.

Code:
echo '{"pkgs":["mono","llvm80","libepoxy-1.5.2"]}' > /tmp/pkg.json
iocage create -n "mono_patch" -p /tmp/pkg.json -r 11.3-RELEASE dhcp="on" vnet="on" bpf="yes" boot="on"
rm /tmp/pkg.json
iocage exec mono_patch "ln -s /usr/local/bin/mono /usr/bin/mono"
iocage exec mono_patch "fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96"
iocage exec mono_patch "mkdir -p /usr/local/etc/pkg/repos"
iocage exec mono_patch "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"
iocage update mono_patch
iocage upgrade mono_patch
iocage exec mono_patch "portsnap fetch extract"
iocage exec mono_patch "pkg delete -y '*proto'"

iocage exec mono_patch "echo -e 'cd /usr/ports/lang/mono' > /tmp/mono_patch.sh"
iocage exec mono_patch "echo -e 'patch -E < /tmp/mono-patch-6.8.0.96' >> /tmp/mono_patch.sh"
iocage exec mono_patch "echo -e 'make -DBATCH install clean' >> /tmp/mono_patch.sh"
iocage exec mono_patch "echo -e 'make -DBATCH deinstall reinstall' >> /tmp/mono_patch.sh"
iocage exec mono_patch "echo -e 'make package' >> /tmp/mono_patch.sh"
iocage exec mono_patch "echo -e 'mv /usr/ports/lang/mono/work/pkg/mono-6.8.0.96.txz /' >> /tmp/mono_patch.sh"
iocage exec mono_patch "sh /tmp/mono_patch.sh"
 

Yakje

Explorer
Joined
Feb 8, 2017
Messages
82
@thxtex I ran ur script, but it's giving me the following errors:
(My system is on Freenas 11.3 and jails @ 11.3-RELEASE-p6)

===> Installing for mono-6.8.0.96 ===> Checking if mono is already installed ===> Registering installation for mono-6.8.0.96 pkg-static: Cannot get an exclusive lock on a database, it is locked by another process *** Error code 75 Stop. make: stopped in /usr/ports/lang/mono ===> Deinstalling for mono ===> mono not installed, skipping ===> Deinstalling for mono ===> mono not installed, skipping ===> Installing for mono-6.8.0.96 ===> Checking if mono is already installed ===> Registering installation for mono-6.8.0.96 pkg-static: Cannot get an exclusive lock on a database, it is locked by another process *** Error code 75 Stop. make[1]: stopped in /usr/ports/lang/mono *** Error code 1

I am getting these errors, both for mono & dialogports it seems. Any idea what could be causing this? :S
Error.jpg Error2.jpg
 
Last edited:

ChaosBlades

Contributor
Joined
Jul 4, 2015
Messages
137
@thxtex I ran ur script, but it's giving me the following errors:
(My system is on Freenas 11.3 and jails @ 11.3-RELEASE-p6)

===> Installing for mono-6.8.0.96 ===> Checking if mono is already installed ===> Registering installation for mono-6.8.0.96 pkg-static: Cannot get an exclusive lock on a database, it is locked by another process *** Error code 75 Stop. make: stopped in /usr/ports/lang/mono ===> Deinstalling for mono ===> mono not installed, skipping ===> Deinstalling for mono ===> mono not installed, skipping ===> Installing for mono-6.8.0.96 ===> Checking if mono is already installed ===> Registering installation for mono-6.8.0.96 pkg-static: Cannot get an exclusive lock on a database, it is locked by another process *** Error code 75 Stop. make[1]: stopped in /usr/ports/lang/mono *** Error code 1

I am getting these errors, both for mono & dialogports it seems. Any idea what could be causing this? :S
View attachment 35401 View attachment 35402
Looks like you didn't stop all services running mono before modifying it. The first and last commands from my guide still apply when using the script


Stop all services running mono. Should be "sonarr", "radarr", "lidarr", and "jackett".

service lidarr stop

*run script*

Restart all services running mono

service lidarr start
 

Yakje

Explorer
Joined
Feb 8, 2017
Messages
82
Looks like you didn't stop all services running mono before modifying it. The first and last commands from my guide still apply when using the script


Stop all services running mono. Should be "sonarr", "radarr", "lidarr", and "jackett".

service lidarr stop

*run script*

Restart all services running mono

service lidarr start

Thanks for ur reply!
I tried it again, and now it seems to have succeeded, although i'm not sure what exactly i have to copy where after the script has completed?
I now have a jail named: mono-patch @ /mnt/tank/iocage/jails/mono_patch/root, containing the following files and folders:
mono-patch.jpg
What are the next steps i should take?
 

ChaosBlades

Contributor
Joined
Jul 4, 2015
Messages
137
Thanks for ur reply!
I tried it again, and now it seems to have succeeded, although i'm not sure what exactly i have to copy where after the script has completed?
I now have a jail named: mono-patch @ /mnt/tank/iocage/jails/mono_patch/root, containing the following files and folders:
View attachment 35697
What are the next steps i should take?
The way I understood it was that you copy the mono-6.8.0.96.txz into the root of the jail you want to install mono 6.8 in then run pkg add /mono-6.8.0.96.txz but when I did this it kept asking for dependancies I was missing. Once I got all those installed and then subsequently mono 6.8 installed I tried Jackett and almost every tracker failed with an SSL error. At this point, I reverted to the tried and true method. I figure I did something wrong but I'm not going to bother. The way I understand it the script method only saves you CPU time and about 3-4GB per jail in storage space. Not worth it for me to spend the time to research what went wrong.

I just upgraded all my fresh 11.3-RELEASE jails with the following commands.

service jackett stop portsnap fetch extract fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96 cd /usr/ports/lang/mono patch -E < /tmp/mono-patch-6.8.0.96 make -DBATCH install clean make -DBATCH deinstall reinstall pkg update pkg upgrade service jackett start

Tested working with jackett and lidarr over the past couple of days. Compiling for sonarr and radarr now.

Edit (2/20): Sonarr, Radarr, Jackett, and Lidarr are all working great since this post.
 
Last edited:

Andre Clarke

Dabbler
Joined
Dec 4, 2015
Messages
48
The way I understood it was that you copy the mono-6.8.0.96.txz into the root of the jail you want to install mono 6.8 in then run pkg add /mono-6.8.0.96.txz but when I did this it kept asking for dependancies I was missing. Once I got all those installed and then subsequently mono 6.8 installed I tried Jackett and almost every tracker failed with an SSL error. At this point, I reverted to the tried and true method. I figure I did something wrong but I'm not going to bother. The way I understand it the script method only saves you CPU time and about 3-4GB per jail in storage space. Not worth it for me to spend the time to research what went wrong.

I just upgraded all my fresh 11.3-RELEASE jails with the following commands.

service jackett stop portsnap fetch extract fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96 cd /usr/ports/lang/mono patch -E < /tmp/mono-patch-6.8.0.96 make -DBATCH install clean make -DBATCH deinstall reinstall pkg update pkg upgrade service jackett start

Tested working with jackett and lidarr over the past couple of days. Compiling for sonarr and radarr now.
How did you patch this?.... is there a nano file... like the 5.20 patch
 

ChaosBlades

Contributor
Joined
Jul 4, 2015
Messages
137
How did you patch this?.... is there a nano file... like the 5.20 patch
nano is a text editor not a file type. I found out 'fetch' has a function to output the download into the file removing the extra steps to manually create it yourself with nano. It is now consolidated into one command below. This downloads the contents of the patch url and saves it to a "mono-patch-6.8.0.96" file located in the /tmp/ directory.

fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96


-o file, --output=file
Set the output file name to file. By default, a ``pathname''
is extracted from the specified URI, and its basename is used
as the name of the output file. A file argument of `-' indi-
cates that results are to be directed to the standard output.
If the file argument is a directory, fetched file(s) will be
placed within the directory, with name(s) selected as in the
default behaviour.
 

Andre Clarke

Dabbler
Joined
Dec 4, 2015
Messages
48
nano is a text editor not a file type. I found out 'fetch' has a function to output the download into the file removing the extra steps to manually create it yourself with nano. It is now consolidated into one command below. This downloads the contents of the patch url and saves it to a "mono-patch-6.8.0.96" file located in the /tmp/ directory.

fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96

Thanks for replying, did you compile Radarr and Sonarr, how is it working with this version?
 

ChaosBlades

Contributor
Joined
Jul 4, 2015
Messages
137
Thanks for replying, did you compile Radarr and Sonarr, how is it working with this version?
I edited the post with the instuctions just after I replied to you.
Edit (2/20): Sonarr, Radarr, Jackett, and Lidarr are all working great since this post.
 

Andre Clarke

Dabbler
Joined
Dec 4, 2015
Messages
48
The way I understood it was that you copy the mono-6.8.0.96.txz into the root of the jail you want to install mono 6.8 in then run pkg add /mono-6.8.0.96.txz but when I did this it kept asking for dependancies I was missing. Once I got all those installed and then subsequently mono 6.8 installed I tried Jackett and almost every tracker failed with an SSL error. At this point, I reverted to the tried and true method. I figure I did something wrong but I'm not going to bother. The way I understand it the script method only saves you CPU time and about 3-4GB per jail in storage space. Not worth it for me to spend the time to research what went wrong.

I just upgraded all my fresh 11.3-RELEASE jails with the following commands.

service jackett stop portsnap fetch extract fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96 cd /usr/ports/lang/mono patch -E < /tmp/mono-patch-6.8.0.96 make -DBATCH install clean make -DBATCH deinstall reinstall pkg update pkg upgrade service jackett start

Tested working with jackett and lidarr over the past couple of days. Compiling for sonarr and radarr now.

Edit (2/20): Sonarr, Radarr, Jackett, and Lidarr are all working great since this post.
i tried following this step, but when i get to patch -E < /tmp/mono-patch-6.8.0.96 its saying it cant find file..... can you get me the text for nano so i can update this
 

Yakje

Explorer
Joined
Feb 8, 2017
Messages
82
The way I understood it was that you copy the mono-6.8.0.96.txz into the root of the jail you want to install mono 6.8 in then run pkg add /mono-6.8.0.96.txz but when I did this it kept asking for dependancies I was missing. Once I got all those installed and then subsequently mono 6.8 installed I tried Jackett and almost every tracker failed with an SSL error. At this point, I reverted to the tried and true method. I figure I did something wrong but I'm not going to bother. The way I understand it the script method only saves you CPU time and about 3-4GB per jail in storage space. Not worth it for me to spend the time to research what went wrong.

I just upgraded all my fresh 11.3-RELEASE jails with the following commands.

service jackett stop portsnap fetch extract fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=211011' -o /tmp/mono-patch-6.8.0.96 cd /usr/ports/lang/mono patch -E < /tmp/mono-patch-6.8.0.96 make -DBATCH install clean make -DBATCH deinstall reinstall pkg update pkg upgrade service jackett start

Tested working with jackett and lidarr over the past couple of days. Compiling for sonarr and radarr now.

Edit (2/20): Sonarr, Radarr, Jackett, and Lidarr are all working great since this post.

I also tried following these steps, with a fresh 11.3 jail, but get the following, (which is probably the same issue @Andre Clarke is having) What am i missing? :
 

Attachments

  • file_to_patch.jpg
    file_to_patch.jpg
    80.6 KB · Views: 427

ChaosBlades

Contributor
Joined
Jul 4, 2015
Messages
137
I also tried following these steps, with a fresh 11.3 jail, but get the following, (which is probably the same issue @Andre Clarke is having) What am i missing? :
I have gotten that before and it was a typo in a command or I didn't cd into the mono ports directory before I tried to patch. The error is saying it is looking for a file and can't find it.

---------------------------------------------

If anyone wants to save a few GB and remove the EOL python 2 packages the following commands will clean up the ports directories from compiling mono and delete python 2. Tested on radarr, sonarr, jackett, and lidarr.

iocage console *jail name*

pkg install -y portupgrade

portsclean -CDD

pkg delete -y python27

exit

iocage restart *jail name*
 

Andre Clarke

Dabbler
Joined
Dec 4, 2015
Messages
48
@ChaosBlades i check everything, made sure, i was cd in the proper directory, still doing the same thing, can you just guide me how to do it the other way...please
 

ChaosBlades

Contributor
Joined
Jul 4, 2015
Messages
137
can i jump from 5.20 to 6.8?
I have not tried this. This is probably your issue. You will need to clean the ports directory.

pkg install -y portupgrade

portsclean -CDD

Should work now. If that does not work you will probably need to brute force the issue and delete the ports directory and re-extract.

rm -rf /usr/ports

portsnap fetch extract
 
Top