Skip to main content
opkg (Open PacKaGe management) is the default package manager for OpenWrt. It is a lightweight tool designed for embedded Linux systems that handles .ipk packages — the same format used by Entware and historically by the NSLU2 project. opkg resolves dependencies recursively and can install packages from remote repositories over the network.
OpenWrt also supports apk (Alpine Package Keeper) as an alternative to opkg on newer builds. Check your firmware’s configuration to see which is active.

Repository Configuration

opkg fetches package lists and packages from feeds defined in /etc/opkg/distfeeds.conf. This file is auto-generated for your specific target and release:
src/gz openwrt_core https://downloads.openwrt.org/releases/23.05.0/targets/ath79/generic/packages
src/gz openwrt_base https://downloads.openwrt.org/releases/23.05.0/packages/mips_24kc/base
src/gz openwrt_luci https://downloads.openwrt.org/releases/23.05.0/packages/mips_24kc/luci
src/gz openwrt_packages https://downloads.openwrt.org/releases/23.05.0/packages/mips_24kc/packages
src/gz openwrt_routing https://downloads.openwrt.org/releases/23.05.0/packages/mips_24kc/routing
You can add custom or community feeds in /etc/opkg/customfeeds.conf to avoid overwriting the auto-generated distfeeds on upgrade.

Common Commands

Update Package Lists

Always run this before installing packages. It downloads the current package index from all configured feeds.
opkg update

Install a Package

opkg install <package>
Example:
opkg install tcpdump
opkg automatically resolves and installs any missing dependencies.

Remove a Package

opkg remove <package>
Add --autoremove to also remove dependencies that are no longer needed:
opkg remove <package> --autoremove

List Available Packages

opkg list
Filter by name pattern:
opkg list | grep luci

List Installed Packages

opkg list-installed

Show Package Information

Displays version, description, dependencies, and installation status:
opkg info <package>
Example:
opkg info dnsmasq

List Files Installed by a Package

opkg files <package>
Example:
opkg files uci

Built-in vs. Runtime Packages

Packages can be included in OpenWrt in two ways:
MethodHowTrade-off
Built into firmwareSelected via make menuconfig at build time, compiled into the firmware imageAlways available, survives factory reset, uses flash space
Installed at runtimeInstalled via opkg install after the device is runningFlexible, but requires network access and writable storage
Flash storage constraints: Most consumer routers have only 4–16 MB of flash. After accounting for the base system, you may have only 1–4 MB of usable overlay space. Check available space with df -h before installing large packages.

Storage Considerations

opkg installs packages into the writable overlay filesystem (see Filesystem Layout). On flash-constrained devices:
  • Prefer small, targeted packages over large meta-packages
  • Use opkg list-installed to audit what is installed
  • Consider using a USB drive or external storage as an extroot to expand available space
  • Packages installed at runtime are not automatically preserved across sysupgrade unless explicitly listed in /etc/sysupgrade.conf
To persist a list of runtime-installed packages across firmware upgrades, save the output of opkg list-installed and reinstall after upgrading.