How to fix OpenWRT: Unknown package ‘…’

Problem:

You are trying to install an OpenWRT package using e.g.

opkg install luci-app-openvpn

but you see an error message like

Unknown package 'luci-app-openvpn'.
Collected errors:
 * opkg_install_cmd: Cannot install package luci-app-openvpn.

Solution:

There are two different reasons why this error can occur:

  1. You forgot to run
    opkg update

    Note that you need to run opkg update after each reboot since the package lists are only stored in the RAM

  2. The package actually doesn’t exist. Check
    opkg list

    for a list of packages that can be installed for your OpenWRT version and architecture. In very rare cases you might need to build a package from source if it isn’t available, or you might need to upgrade your OpenWRT version if that’s possible for your router.