Skip to content

Get pkg running in FreeNAS

FreeNAS is an appliance, which means that the developers has taken a lots of measures to get FreeNAS to stay that way.
The system is not meant to be tinkered with because of the risk of dataloss. A lot of people are depending on the content of their NAS Systems, so installing 3. party software on top of the FreeNAS software environment can alter the system useless, and maybe be the cause of dataloss.

That said, sometimes you find yourself in the need of just a tiny single piece of software that you cant wait for the developers to implement. In my case we have based all our monitoring of the systems on Zabbix. So I would like to have the latest stable version of Zabbix_agentd on my FreeNAS box’s, and due to the nature of zabbix I want to give it full access to the hardware and IPMI.

I found a solution on the internet here: Fix pkg on FreeNAS 11.2

Because of the mysterious ways of the internet, I have decided to write the same procedure on my blog to have a redundant copy of it for my own sake and for everybody else.

When you run

$ pkg install something

You are greeted with the error

$ pkg: Repository local load error: access repo file(/var/db/pkg/repo-local.sqlite) failed: No such file or directory

This is fixed by editing the configuration files in /usr/local/etc/pkg/repos/

local.conf
FreeBSD.conf

The parameter “enabled”, needs to be the opposite of what they are now.
in local.conf toggle “yes” to “no” and in FreeBSD.conf toggle “no” to “yes”.

$ nano /usr/local/etc/pkg/repos/local.conf

local: {
    url: "file:///usr/ports/packages",
    enabled: no
}

 

$ nano /usr/local/etc/pkg/repos/FreeBSD.conf

FreeBSD: {
    enabled: yes
}

Now you are able to run without errors

$ pkg update

Be aware that everything you install will be removed when you update the FreeNAS system.
Place config files and start-up scripts on their own ZFS dataset, plus make sure to document everything that you install, to get the system up and running after an update.

Published inBSD

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.