FreeBSD shared object not found


I was helping a client with their FreeBSD install on the weekend, and she was having trouble with pkg. We sorted it out, and I was granted permission to share.

When she attempted to update a package:

==> Shared object "" not found required by "pkg".

This is usually indicitive of a system version mismatch, such as running FreeBSD 11.x packages on a system upgraded to 12 with freebsd-update. THe recommended solution is to reinstall pkgng with:

# pkg-static install -f pkg

If this still doesn’t work, you can force pkgng to boostrap:

# pkg-static bootstrap -f
==> Major OS version upgrade detected. Running "pkg-static install -f pkg" recommended.
==> pkg(8) is already installed. Forcing reinstallation through pkg(7).

It’s also worth checking your /etc/pkg/FreeBSD.conf to see if it changed from latest to quarterly if you elected to use the former before.

Now you can update your repo, then upgrade and install packages as before:

# pkg update
==> All respositories are up to date

Author bio and support


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!