LinuxCommandLibrary

opkg

Manage software packages on embedded Linux systems

TLDR

Install a package

$ opkg install [package]
copy

Remove a package
$ opkg remove [package]
copy

Update the list of available packages
$ opkg update
copy

Upgrade one or more specific package(s)
$ opkg upgrade [package(s)]
copy

Display information for a specific package
$ opkg info [package]
copy

List all the available packages
$ opkg list
copy

Find out which package owns a file
$ opkg search /[path/to/file]
copy

List all files belonging to a package
$ opkg files [package]
copy

SYNOPSIS

opkg [options] command [arguments...]

PARAMETERS

command: update
    Updates the list of available packages from configured repositories.

command: upgrade [pkg...]
    Upgrades all installed packages or specified packages to their newest versions.

command: install pkg...
    Installs one or more specified packages, along with their dependencies.

command: remove pkg...
    Removes one or more specified packages. Use with --autoremove to remove unneeded dependencies.

command: list
    Lists all packages available in the configured repositories.

command: list-installed
    Lists all currently installed packages on the system.

command: search pattern
    Searches for packages whose names or descriptions match the given pattern.

command: info pkg...
    Displays detailed information about one or more specified packages.

command: files pkg
    Lists all files owned and installed by a specific package.

command: status
    Displays the status of installed packages, indicating if they are installed, removed, or partially configured.

command: download pkg...
    Downloads the specified packages to the current directory without installing them.

command: configure pkg...
    Re-configures one or more specified packages, typically running their post-install scripts.

-V level, --verbosity level
    Sets the verbosity level for output (0-9). Higher numbers provide more detailed information.

-f conf_file
    Specifies an alternative configuration file to use instead of the default /etc/opkg.conf.

-t directory
    Uses the specified directory for temporary files during operations.

-o directory
    Sets the offline root directory for installations, useful for building system images.

-v
    Enables verbose output, showing more details about the operation.

-q
    Enables quiet output, suppressing informational messages.

--no-install-recommends
    Prevents the installation of recommended packages during an install operation.

--no-install-suggests
    Prevents the installation of suggested packages during an install operation.

--nodeps
    Ignores package dependencies. Use with caution, as it can lead to broken packages.

--force-depends
    Forces installation/removal even if dependencies are not met or conflicts exist.

--force-overwrite
    Forces overwriting of existing files when installing a package, potentially resolving file conflicts.

--force-postinstall
    Forces the execution of post-installation scripts, even if errors occur or conditions are not met.

--force-removal-of-dependent-packages
    Forces removal of packages that depend on the package being removed, potentially breaking the system.

--force-maintainer
    Forces opkg into maintainer mode, which can alter its behavior for package developers.

--recursive
    Recursively install or remove packages, including their nested dependencies (where applicable).

--cache directory
    Specifies an alternative cache directory for downloaded package files.

--offline-root directory
    Installs packages into the specified offline root directory for pre-populating system images.

--add-arch arch priority
    Adds a supported architecture and its priority for dependency resolution.

--arch arch
    Specifies the architecture for which to manage packages, overriding the system's detected architecture.

DESCRIPTION

opkg is a lightweight package manager primarily designed for embedded Linux systems, such as OpenWrt routers, IoT devices, and other resource-constrained environments. It is a fork of the ipkg package manager and handles .ipk package files.

opkg simplifies the process of installing, upgrading, and removing software packages on these systems, managing dependencies, and interacting with package repositories. It provides a command-line interface for common package management operations like updating package lists, installing new software, upgrading existing packages, removing unwanted ones, and querying information about installed or available packages. Due to its minimal resource footprint, opkg is a crucial tool for maintaining and extending the functionality of many embedded Linux distributions where full-featured package managers like APT or DNF would be too heavy.

CAVEATS

opkg is specifically designed for embedded systems and may not be found or suitable for general-purpose Linux distributions like Debian, Ubuntu, Fedora, or Arch Linux, which use their own, more robust package management systems. Its dependency resolution and package format (.ipk) are simpler than those of larger package managers, making it less suitable for complex server or desktop environments.

CONFIGURATION

opkg reads its configuration from /etc/opkg.conf and potentially additional files in /etc/opkg.d/. These files define package repositories (src/gz lines), architecture settings, and other operational parameters. Users can specify custom configuration files using the -f option.

PACKAGE SOURCES

Packages are fetched from repositories defined in the configuration. These are typically HTTP/HTTPS URLs pointing to directories containing .ipk files and package index files (like Packages.gz). The opkg update command downloads these index files to build a local cache of available packages, allowing opkg to know which packages are available for installation.

HISTORY

opkg originated as a fork of the ipkg package manager. ipkg itself was created for use on embedded Linux devices, particularly during the early days of devices like the Linksys NSLU2 and eventually adopted by projects like OpenWrt. As ipkg development became stagnant, opkg emerged to address its limitations and continue active development, specifically tailored to the needs of the OpenWrt project and other embedded Linux distributions. It gained popularity for its efficiency and small footprint, making it ideal for devices with limited storage and processing power.

SEE ALSO

ipkg, apt(8), dpkg(1), yum(8), dnf(8), pacman(8), rpm(8)

Copied to clipboard