Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
[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

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

raidflex

Senior Member
Joined
Mar 14, 2012
Messages
489
I'm running Sonarr 2.0.0.5344 and Mono 6.8.0.105 (grabbed from comment #75) with no issues.

NOTE: I'm not running Sonarr "plugin"; I created the jail and installed everything manually, that's the way I like it.
I am not sure how this is working for you but I was able to replicate a permissions issue with Mono v6.4/v6.8. I tried 6.8 and 6.4 and both versions give a permissions error that sonarr/lidarr/radarr is unable to move files from the downloads folder after sab downloads them. I have had a standard jail setup for years working and only stopped after upgrading mono to v6. After switching back to Mono v5 I have no issues and the files are processed.

This is on Truenas 12.0-Release and iocage jail is at Freebsd 12.1.
 

jasonsansone

Member
Joined
Jul 18, 2019
Messages
79
I am not sure how this is working for you but I was able to replicate a permissions issue with Mono v6.4/v6.8. I tried 6.8 and 6.4 and both versions give a permissions error that sonarr/lidarr/radarr is unable to move files from the downloads folder after sab downloads them. I have had a standard jail setup for years working and only stopped after upgrading mono to v6. After switching back to Mono v5 I have no issues and the files are processed.

This is on Truenas 12.0-Release and iocage jail is at Freebsd 12.1.
I am running Sonarr 3.0.4.986, Radarr 3.0.0.3966, and Lidarr 0.7.1.1381 on Mono 6.8.0.105 without any issues. However I use NZBGet and not SAB.
 

raidflex

Senior Member
Joined
Mar 14, 2012
Messages
489
I am running Sonarr 3.0.4.986, Radarr 3.0.0.3966, and Lidarr 0.7.1.1381 on Mono 6.8.0.105 without any issues. However I use NZBGet and not SAB.
That must be it then , must be the combo of Sab, Sonarr, and mono v6.
 

achmetinternet

Junior Member
Joined
Jun 13, 2018
Messages
24
I am getting this error after I ran

cd /usr/ports/lang/mono

make -DBATCH install clean

Registering installation for mono-5.20.1.34_3
pkg-static: Unable to access file /usr/ports/lang/mono/work/stage/usr/local/%%HEAPVIZ%%bin/mono-heapviz:No such file or directory
*** Error code 74


Followed the above to the letter. FreeNAS is on 12.0, Jail is on 12.2 release, I tried it in the lidarr one. Then after trying

make -DBATCH deinstall reinstall

I got

root@lidarr:/usr/ports/lang/mono # make -DBATCH deinstall reinstall
===> Deinstalling for mono
===> mono not installed, skipping
===> Deinstalling for mono
===> mono not installed, skipping
===> Installing for mono-5.20.1.34_3
===> Checking if mono is already installed
===> Registering installation for mono-5.20.1.34_3
pkg-static: Unable to access file /usr/ports/lang/mono/work/stage/usr/local/%%HEAPVIZ%%bin/mono-heapviz:No such file or directory
*** Error code 74

Stop.
make[1]: stopped in /usr/ports/lang/mono
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/mono
root@lidarr:/usr/ports/lang/mono #


Can someone help me? I would not like to do the whole portsnap stuff again, it eats up a lot of CPU & time ;)
 

jasonsansone

Member
Joined
Jul 18, 2019
Messages
79
I am getting this error:

<
Registering installation for mono-5.20.1.34_3
pkg-static: Unable to access file /usr/ports/lang/mono/work/stage/usr/local/%%HEAPVIZ%%bin/mono-heapviz:No such file or directory
*** Error code 74
/>

Followed the above to the letter. FreeNAS is on 12.0, Jail is on 12.2 release, I tried it in the lidarr one.
Not sure off hand how to fix that, however Lidarr requires Mono 5.8+. If you are putting in the efforts for 5.2, I would bump up several versions.
 

colmconn

Member
Joined
Jul 28, 2015
Messages
174
First up you need to start with a clean mono port
  1. portsnap extract lang/mono
  2. cd /usr/ports/lang/mono
  3. get the patch: fetch -o patch-6.8.0.105.diff 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=211960'
  4. apply the patch: patch -E -p1 < patch-6.8.0.105.diff
    1. Note that application of the patch will partially fail and you will be left with a Makefile.rej containing the portions that failed to apply
  5. Since the patch partially fails, replace the Makefile with the corrected version below
  6. then you should be able to make the port: make -DBATCH package, you should be left with /usr/ports/lang/mono/work/pkg/mono-6.8.0.105.txz
Code:
# Created by: Yukihiro Nakai <nakai@FreeBSD.org>
# $FreeBSD: head/lang/mono/Makefile 529063 2020-03-24 19:54:57Z antoine $

PORTNAME=    mono
PORTVERSION=    6.8.0.105
PORTREVISION=    0
CATEGORIES=    lang
MASTER_SITES=    https://download.mono-project.com/sources/mono/
DISTFILES=    ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}

MAINTAINER=    mono@FreeBSD.org
COMMENT=    Open source implementation of .NET Development Framework

LICENSE=    MIT
LICENSE_FILE=    ${WRKSRC}/LICENSE

ONLY_FOR_ARCHS=    amd64 armv6 armv7 i386 powerpc powerpc64

BUILD_DEPENDS=    p5-XML-Parser>=0:textproc/p5-XML-Parser \
        bash:shells/bash \
        cmake>0:devel/cmake
LIB_DEPENDS=    libinotify.so:devel/libinotify
RUN_DEPENDS=        ca_root_nss>=0:security/ca_root_nss
HEAPVIS_RUN_DEPENDS=    ${PY_PILLOW}

OPTIONS_DEFINE=        MONOLITE NLS X11 HEAPVIZ
OPTIONS_DEFAULT=    MONOLITE X11
OPTIONS_SUB=    yes

HEAPVIZ_DESC=        Install mono-heapviz debug tool (requires py-pillow)
MONOLITE_DESC=        Use monolite to bootstrap mcs (otherwise use installed mcs)
MONOLITE_DISTFILES=    monolite-linux-${MONOLITE_VERSION}-latest.tar.gz:monolite
MONOLITE_MASTER_SITES=    http://download.mono-project.com/monolite/:monolite
MONOLITE_VERSION=    1051000004

NLS_CONFIGURE_OFF=    --disable-nls
NLS_USES=    gettext

X11_USES=    display:test

USES=    autoreconf bison compiler:c11 cpe gmake iconv libtool \
    pathfix perl5 python shebangfix tar:xz
USE_PERL5=    build
GNU_CONFIGURE=    yes
USE_LDCONFIG=    yes
SHEBANG_FILES=    scripts/mono-heapviz mono/mini/genmdesc.py mono/tests/test_lldb.py
BINARY_ALIAS=    python=${PYTHON_CMD}

CONFIGURE_ARGS=    --disable-dtrace --enable-btls
CPPFLAGS+=    -I${LOCALBASE}/include

MAKE_ENV=    MONO_SHARED_DIR="${WRKDIR}" \
        INSTALL_STRIP_FLAG="${STRIP}" \
        TZ=UTC

TEST_ARGS=    -k
TEST_TARGET=    check

PORTSCOUT=    limit:^\d+\.\d+\.[1-9]\d*

LOCALBASE?=    /usr/local
.if !exists(${LOCALBASE}/bin/mcs)
OPTIONS_SLAVE=    MONOLITE
.endif

.include <bsd.port.pre.mk>

.if ${ARCH} == "powerpc" || ${ARCH} == "powerpc64"
CONFIGURE_ARGS=--disable-btls \
    --disable-dtrace
CPPFLAGS+=-O2 -fno-strict-aliasing -Wno-missing-declarations \
    -Wno-maybe-uninitialized -pipe -D_LARGE_FILES -D_ALL_SOURCE \
    -D_THREAD_SAFE -D_REENTRANT
PLIST_SUB+=NO_PPC="@comment " \
    PPC=""
.else
PLIST_SUB+=NO_PPC="" \
    PPC="@comment "
.endif

post-extract-MONOLITE-on:
    ${MKDIR} ${WRKSRC}/mcs/class/lib/monolite-linux
    ${MV} ${WRKDIR}/monolite-linux-${MONOLITE_VERSION}-latest ${WRKSRC}/mcs/class/lib/monolite-linux/${MONOLITE_VERSION}

post-patch:
    ${REINPLACE_CMD} -e 's|^#!/bin/bash|#!/usr/bin/env bash|g' \
        ${WRKSRC}/scripts/mono-find-provides.in \
        ${WRKSRC}/scripts/mono-find-requires.in \
        ${WRKSRC}/scripts/mono-test-install
    ${FIND} ${WRKSRC} -name '*.sh' | ${XARGS} ${REINPLACE_CMD} \
        -e 's|^#!/bin/bash|#!/bin/sh|g'
    ${SED} 's/tarball/${PORTVERSION}/' ${WRKSRC}/mono/mini/Makefile.am.in \
        > ${WRKSRC}/mono/mini/Makefile.am
    ${REINPLACE_CMD} -e 's|/usr/share|${PREFIX}|g' \
        ${WRKSRC}/mcs/class/corlib/System/Environment.cs \
        ${WRKSRC}/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Unix.cs
    ${REINPLACE_CMD} -e 's|/usr/share/.mono|${PREFIX}/share/mono|g' \
        ${WRKSRC}/man/mono-configuration-crypto.1 \
        ${WRKSRC}/man/mono.1 \
        ${WRKSRC}/man/mozroots.1

post-configure:
    ${REINPLACE_CMD} -e 's|share\/man|man|g' \
        ${WRKSRC}/mcs/jay/Makefile

post-install:
    ${MKDIR} ${STAGEDIR}${PREFIX}/mono

.include <bsd.port.post.mk>
 

achmetinternet

Junior Member
Joined
Jun 13, 2018
Messages
24
First up you need to start with a clean mono port
  1. portsnap extract lang/mono
  2. cd /usr/ports/lang/mono
  3. get the patch: fetch -o patch-6.8.0.105.diff 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=211960'
  4. apply the patch: patch -E -p1 < patch-6.8.0.105.diff
    1. Note that application of the patch will partially fail and you will be left with a Makefile.rej containing the portions that failed to apply
  5. Since the patch partially fails, replace the Makefile with the corrected version below
  6. then you should be able to make the port: make -DBATCH package, you should be left with /usr/ports/lang/mono/work/pkg/mono-6.8.0.105.txz
Code:
# Created by: Yukihiro Nakai <nakai@FreeBSD.org>
# $FreeBSD: head/lang/mono/Makefile 529063 2020-03-24 19:54:57Z antoine $

PORTNAME=    mono
PORTVERSION=    6.8.0.105
PORTREVISION=    0
CATEGORIES=    lang
MASTER_SITES=    https://download.mono-project.com/sources/mono/
DISTFILES=    ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}

MAINTAINER=    mono@FreeBSD.org
COMMENT=    Open source implementation of .NET Development Framework

LICENSE=    MIT
LICENSE_FILE=    ${WRKSRC}/LICENSE

ONLY_FOR_ARCHS=    amd64 armv6 armv7 i386 powerpc powerpc64

BUILD_DEPENDS=    p5-XML-Parser>=0:textproc/p5-XML-Parser \
        bash:shells/bash \
        cmake>0:devel/cmake
LIB_DEPENDS=    libinotify.so:devel/libinotify
RUN_DEPENDS=        ca_root_nss>=0:security/ca_root_nss
HEAPVIS_RUN_DEPENDS=    ${PY_PILLOW}

OPTIONS_DEFINE=        MONOLITE NLS X11 HEAPVIZ
OPTIONS_DEFAULT=    MONOLITE X11
OPTIONS_SUB=    yes

HEAPVIZ_DESC=        Install mono-heapviz debug tool (requires py-pillow)
MONOLITE_DESC=        Use monolite to bootstrap mcs (otherwise use installed mcs)
MONOLITE_DISTFILES=    monolite-linux-${MONOLITE_VERSION}-latest.tar.gz:monolite
MONOLITE_MASTER_SITES=    http://download.mono-project.com/monolite/:monolite
MONOLITE_VERSION=    1051000004

NLS_CONFIGURE_OFF=    --disable-nls
NLS_USES=    gettext

X11_USES=    display:test

USES=    autoreconf bison compiler:c11 cpe gmake iconv libtool \
    pathfix perl5 python shebangfix tar:xz
USE_PERL5=    build
GNU_CONFIGURE=    yes
USE_LDCONFIG=    yes
SHEBANG_FILES=    scripts/mono-heapviz mono/mini/genmdesc.py mono/tests/test_lldb.py
BINARY_ALIAS=    python=${PYTHON_CMD}

CONFIGURE_ARGS=    --disable-dtrace --enable-btls
CPPFLAGS+=    -I${LOCALBASE}/include

MAKE_ENV=    MONO_SHARED_DIR="${WRKDIR}" \
        INSTALL_STRIP_FLAG="${STRIP}" \
        TZ=UTC

TEST_ARGS=    -k
TEST_TARGET=    check

PORTSCOUT=    limit:^\d+\.\d+\.[1-9]\d*

LOCALBASE?=    /usr/local
.if !exists(${LOCALBASE}/bin/mcs)
OPTIONS_SLAVE=    MONOLITE
.endif

.include <bsd.port.pre.mk>

.if ${ARCH} == "powerpc" || ${ARCH} == "powerpc64"
CONFIGURE_ARGS=--disable-btls \
    --disable-dtrace
CPPFLAGS+=-O2 -fno-strict-aliasing -Wno-missing-declarations \
    -Wno-maybe-uninitialized -pipe -D_LARGE_FILES -D_ALL_SOURCE \
    -D_THREAD_SAFE -D_REENTRANT
PLIST_SUB+=NO_PPC="@comment " \
    PPC=""
.else
PLIST_SUB+=NO_PPC="" \
    PPC="@comment "
.endif

post-extract-MONOLITE-on:
    ${MKDIR} ${WRKSRC}/mcs/class/lib/monolite-linux
    ${MV} ${WRKDIR}/monolite-linux-${MONOLITE_VERSION}-latest ${WRKSRC}/mcs/class/lib/monolite-linux/${MONOLITE_VERSION}

post-patch:
    ${REINPLACE_CMD} -e 's|^#!/bin/bash|#!/usr/bin/env bash|g' \
        ${WRKSRC}/scripts/mono-find-provides.in \
        ${WRKSRC}/scripts/mono-find-requires.in \
        ${WRKSRC}/scripts/mono-test-install
    ${FIND} ${WRKSRC} -name '*.sh' | ${XARGS} ${REINPLACE_CMD} \
        -e 's|^#!/bin/bash|#!/bin/sh|g'
    ${SED} 's/tarball/${PORTVERSION}/' ${WRKSRC}/mono/mini/Makefile.am.in \
        > ${WRKSRC}/mono/mini/Makefile.am
    ${REINPLACE_CMD} -e 's|/usr/share|${PREFIX}|g' \
        ${WRKSRC}/mcs/class/corlib/System/Environment.cs \
        ${WRKSRC}/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Unix.cs
    ${REINPLACE_CMD} -e 's|/usr/share/.mono|${PREFIX}/share/mono|g' \
        ${WRKSRC}/man/mono-configuration-crypto.1 \
        ${WRKSRC}/man/mono.1 \
        ${WRKSRC}/man/mozroots.1

post-configure:
    ${REINPLACE_CMD} -e 's|share\/man|man|g' \
        ${WRKSRC}/mcs/jay/Makefile

post-install:
    ${MKDIR} ${STAGEDIR}${PREFIX}/mono

.include <bsd.port.post.mk>
Thanks, I will give it a try later. One other question though: could I not upload an already pre-compiled *.txz file? And another one: which mono versions should I install for lidarr, jackett and radarr? Jackett doesn't seem to work in a 12.2 jail and I want to check if maybe it is the mono version that doesn't work with that OS version. Under 11.2 it ran without issues.
 
Last edited:

jasonsansone

Member
Joined
Jul 18, 2019
Messages
79
Thanks, I will give it a try later. One other question though: could I not upload an already pre-compiled *.txz file? And another one: which mono versions should I install for lidarr, jackett and radarr? Jackett doesn't seem to work in a 12.2 jail and I want to check if maybe it is the mono version that doesn't work with that OS version. Under 11.2 it ran without issues.
Yes you can download from any of the uploads / repos in this thread and simply install the tar ball. That is why a few people have shared them.
 

ornias

Neophyte Sage
Joined
Mar 6, 2020
Messages
1,037
Thanks, I will give it a try later. One other question though: could I not upload an already pre-compiled *.txz file?
Yes and no:
You can but you need to make one for every jail-os revision and architecture.
In this case it really is easier to install the tarbal ;)
 

zperetz

Member
Joined
Dec 2, 2017
Messages
34
Well, we've got some updates with move to 12.2 jails. If you really want to have fresh compiled package (while the previous one from 11.3 works just fine for the moment) you can do the following - execute bash shell on TrueNAS and run:
myjail=mono_compile
echo '{"pkgs":["ca_root_nss","gcc"]}' > /tmp/pkg.json
iocage create -n "$myjail" -p /tmp/pkg.json -r 12.2-RELEASE dhcp="on" vnet="on" bpf="yes" boot="on"
rm /tmp/pkg.json
iocage exec "$myjail" "fetch 'https://bz-attachments.freebsd.org/attachment.cgi?id=219414' -o /tmp/mono-patch-6.8.0.105"
iocage exec "$myjail" "mkdir -p /usr/local/etc/pkg/repos"
iocage exec "$myjail" "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"
iocage exec "$myjail" "pkg update"
iocage exec "$myjail" "pkg upgrade -y"
iocage exec "$myjail" "portsnap fetch extract"
iocage exec "$myjail" "echo -e 'cd /usr/ports/lang/mono' > /tmp/tmp.sh"
iocage exec "$myjail" "echo -e 'patch -p1 -E < /tmp/mono-patch-6.8.0.105' >> /tmp/tmp.sh"
iocage exec "$myjail" "echo -e 'make -DBATCH package' >> /tmp/tmp.sh"
iocage exec "$myjail" "echo -e 'mv /usr/ports/lang/mono/work/pkg/mono-6.8.0.105.txz /tmp' >> /tmp/tmp.sh"
iocage exec "$myjail" "sh /tmp/tmp.sh"


As usual, it takes about 8.7 Gb of thick jail space (if you chose one) and about 2 hours (at least) of CPU high load. And voila, you have your mono-6.8.0.105.txz in /tmp

A few points to add:
  • - I recommend to create separate jail for compilation and do not make it in the jail with mono services. After compilation you can copy mono package to safe place and destroy the compilation jail without any issues. Or destroy it if something goes wrong.
  • - If you look for easy life you can create jail with the pre-installed packages for compilation: echo '{"pkgs":["ca_root_nss","llvm10","libepoxy","p5-XML-Parser","bash","cmake","bison","gmake","python37","gettext-tools","xorg-vfbserver","xorg-fonts-miscbitmaps","font-alias","xkeyboard-config","xkbcomp","autoconf","automake","libtool","perl5.30","libinotify","libiconv","gettext-runtime","gcc"]}' > /tmp/pkg.json
  • - as always, you can install the package in mono services jail with pkg install -f mono-6.8.0.105.txz

Good luck and enjoy! :)
 
Last edited:

one800higgins

Junior Member
Joined
Jul 16, 2015
Messages
21
Forgive my ignorance, but after building mono in a separate jail like the above post, how do you install that local txz file in the other jails that need it? pkg install -f mono-6.8.0.105.txz won't just automatically find it. I feel like there's a missing step in between.
 

zperetz

Member
Joined
Dec 2, 2017
Messages
34
Forgive my ignorance, but after building mono in a separate jail like the above post, how do you install that local txz file in the other jails that need it? pkg install -f mono-6.8.0.105.txz won't just automatically find it. I feel like there's a missing step in between.
Of course, you have to copy/move the package from mono building jail to working mono-services jail. One of the ways is to launch mc from Shell menu in TrueNAS web interface or CLI, find your jails in /mnt/YOUR_JAILS_POOL/iocage/jails and make simple copy operation from mono_compile/tmp to the jail's place where you plan to execute pkg.
 

diedrichg

Neophyte Sage
Joined
Dec 4, 2012
Messages
1,299
Forgive my ignorance, but after building mono in a separate jail like the above post, how do you install that local txz file in the other jails that need it? pkg install -f mono-6.8.0.105.txz won't just automatically find it. I feel like there's a missing step in between.
Jails are walled gardens, they cannot access each other. As mentioned, you will either need to repeat the process for each jail or copy the file to each jail.
 

one800higgins

Junior Member
Joined
Jul 16, 2015
Messages
21
Ends up I’m just an idiot who shared the file out from the mono compile Jail and forgot to give the other jails access to the folder. Was trying to install from the correct location but before I remembered to fstab that location into existence. Late night work never goes over well.
 

Mannekino

Senior Member
Joined
Nov 14, 2012
Messages
299
Will Mono be updated in the default repository any time soon? I just upgraded to Radarr 3.0 and it gives me the following message:
Currently installed Mono version 5.10.1.57 is supported but upgrading to 5.20 is recommended.

So far it seems to be running without any issues. I'm still running on FreeNAS-11.3-U5, if I upgrade to TrueNAS 12 and upgrade my Jails to the 12.1-RELEASE or 12.2-RELEASE will that give me Mono 5.20?
 

thijsjek

Junior Member
Joined
Aug 12, 2017
Messages
14
Will Mono be updated in the default repository any time soon? I just upgraded to Radarr 3.0 and it gives me the following message:



So far it seems to be running without any issues. I'm still running on FreeNAS-11.3-U5, if I upgrade to TrueNAS 12 and upgrade my Jails to the 12.1-RELEASE or 12.2-RELEASE will that give me Mono 5.20?
I am running on truenas 12.0-RELEASE. The plugin is at version 12.1-RELEASE-P10 and there is still the old mono.
Like mentioned earlier by Ornidas i do:
Code:
pkg install libiconv
fetch https://github.com/jailmanager/jailmanager.github.io/releases/download/v0.0.1/mono-6.8.0.105.txz
pkg install -y mono-6.8.0.105.txz

works perfectly
 
Last edited:

mistermanko

Member
Joined
Jan 27, 2020
Messages
240
Radarr 3.0 and it gives me the following message
I thouhgt they dropped mono and used .netcore since v3, hence why radarr never really got love for FreeBSD. There's still a good .net implementation missing.
 

zperetz

Member
Joined
Dec 2, 2017
Messages
34
I am running on truenas 12.0-RELEASE. The plugin is at version 12.1-RELEASE-P10 and there is still the old mono.
Like mentioned earlier by Ornidas i do:
Code:
pkg install libiconv wget
wget https://github.com/jailmanager/jailmanager.github.io/releases/download/v0.0.1/mono-6.8.0.105.txz
pkg install -y mono-6.8.0.105.txz

works perfectly
You can use fetch to download the file without any additional installations.
 
Top