How to make network driver survive updates?

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
Hi,

I need the Tehuti Networks TN40XX Network Adapter driver for my network card.
I downloaded the package to /root, installed it via pkg add tn40xx_freebsd12_amd64-1.1.txz and after a reboot it simply worked.
Now after I upgraded the TrueNAS to 12.0-U6.1 the system forgot about the card and I had to reinstall it on the local console.

I am now asking for advise on how to make this change permanent via tunables.
Here is the manifest of the driver
Code:
{
    "name":"tn40xx_freebsd12_amd64",
    "origin":"FreeBSD/v1.0/driver",
    "version":"1.1",
    "comment":"Tehuti Networks TN4010 Network Driver",
    "maintainer":"support@tehutinetworks.net",
    "www":"http://www.tehutinetworks.net",
    "abi":"FreeBSD:12:amd64",
    "arch":"freebsd:12:x86:64",
    "prefix":"/boot/modules",
    "flatsize":1185456,
    "licenselogic":"and","licenses":["MIT","BSD3CLAUSE"],
    "desc":"tn40xx.ko is a device driver for Tehuti Networks TN4010 based NICs",
    "files":{
        "/boot/modules/tn40xx.ko":"1$90dd419aee910eee320db3fa57bac07b99c563f36132d5838a95d6a82f298b0c"
    },
    "scripts":{
        "post-install":"
            kldxref /boot/modules ;
            grep -v tn40 /boot/loader.conf > /tmp/loader.conf ;
            echo tn40xx_load=\"YES\" >> /tmp/loader.conf ;
            mv /tmp/loader.conf /boot/loader.conf",
        "post-deinstall":"
            kldxref /boot/modules ;
            grep -v tn40 /boot/loader.conf > /tmp/loader.conf ;
            mv /tmp/loader.conf /boot/loader.conf"
    }
}

So it seems on installation only the driver is copied to /boot/modules, kldxref is called and the loader.conf is modified.

Now I am not quite sure if it's enough to add the tunable tn40xx_load="YES" for loader.conf or if I also have to make the copy and kldxref call via tunables to make it survive updates.

Thanks in advance
Frank
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
TrueNAS is an appliance, and is not designed for you to be modifying the system. There are no particular arrangements that have been made of the sort you envision. The developers will have the FreeBSD system do whatever they need in order to ensure smooth upgrades of the things they've installed from one version to the next. Because your driver isn't one of those things, you are basically going to be at the mercy of random factors you don't have visibility into.

1) You can store a copy of your thing's driver on the pool and reinstall after updates. This is not guaranteed to work and may be annoying.

2) You can file a Jira ticket and ask for your driver to be added to the base system. This is somewhat hit or miss, especially if it isn't upstream in FreeBSD.

3) You can pull your off-brand card and install a supported card. The choices are outlined in the 10 Gig Networking Primer. This is virtually guaranteed to work.

In general, wish-buying of hardware, where you buy some random thing and then wish/hope/expect for someone to make your purchase work for you, is a bad idea, because there are hundreds of ethernet cards out there that are poorly supported or unsupported. It is far better to use the available resources here to identify a highly compatible card that is known to work swimmingly well with FreeNAS/TrueNAS, and then go get one of those. These are generally going to be very well supported for years to come, with minimal to no drama.

You are welcome to attempt to script your hacky driver install attempt, but no particular behaviours are guaranteed by the base system, since you're not expected to be tinkering in it. Therefore, no one has the correct answer to what steps are "sufficient".
 

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
I am back with an answer to my question above.
Just in case somebody else happens to have this card.
Today I finally updated to 12.0-U8 and the cards driver had survived and got loaded without any issues.
I just added a simple tunable like this:
1645723197024.png
 
Top