Opkg Package Management

The opkg package manager can install, update and remove individual software packages, resolve dependencies between packages and report what software is installed.  Here, we'll explain how to install an individual package, download an updated list of packages, see what is currently installed and manage the package repositories. Let's imagine that you have just finished the Bitbake tutorial.  To install the helloworld-0.0.ipk package, copy this file over to your home directory the COM.

$ opkg install helloworld-0.0.ipk
$ hello
Hello, World!

Note: If you are using an older root filesystem with a verdex board, use the command ipkg in place of opkg.

Installing and removing a single package with no dependencies is pretty straightforward.  Fortunately, getting large packages with lots of dependencies is also simple if your COM has access to the internet.

$ opkg update
Downloading http://cumulus.gumstix.org/feeds/unstable/ipk/glibc/armv7a/base/Packages.gz.
Inflating http://cumulus.gumstix.org/feeds/unstable/ipk/glibc/armv7a/base/Packages.gz.
Updated list of available packages in /var/lib/opkg/base. ... $ opkg list_installed | grep gcc
libgcc1 - 4.3.3-r17.1.6
$ opkg install task-native-sdk
...

Begin by fetching an updated list of packages from the internet, then list the packages currently installed on the system.  This list is extensive, so it's helpful to filter applications with a tool like grep.   Here, we search for gcc to see if a software development kit (SDK) is available, and then use opkg to download and install one.

Note: This particular package can take up to an hour to download and install, but can be rather convenient.

By default, opkg uses the Gumstix repositories defined in the configurations files found under /etc/opkg/. This repository, however, does not contain all the packages you can build using OpenEmbedded. For example, we can add the armv7a base·Angstrom Distribution repository to our list of repositories.

 

$ opkg list | wc -l
17698
$ echo 'src/gz angstrom-base http://feeds.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/
base' > /etc/opkg/angstrom-base.conf
$ opkg update
...
$ opkg list | wc -l
21755

With your own web server you can use OpenEmbedded to host your package repository.  Do this by directing your web server to export the contents of your ipk folder in your tmp directory. The OpenEmbedded Manual explains the benefits and shortcomings of this approach andl explains how to set it up.  See the Package Feeds section of the Reference chapter (Chapter 9). This is particularly useful in collaborative environments when one computer is the dedicated OpenEmbedded build machine.

Repositories

There are several useful repositories. By default, Gumstix COMs fetch packages from the Gumstix repositories.  The Angstrom distribution maintains an online package browser showing the content of all their package repositories.

Opkg Reference

Here is the full usage information for opkg:

usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
    update            Update list of available packages
    upgrade            Upgrade installed packages
    install         Install package(s)
    configure     Configure unpacked package(s)
    remove     Remove package(s)
    flag      Flag package(s)
     =hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
    list            List available packages
    list-installed        List installed packages
    list-upgradable        List installed and upgradable packages
    files         List files belonging to 
    search     List package providing 
    info [pkg|regexp]    Display all info for 
    status [pkg|regexp]    Display all status for 
    download         Download  to current directory
    compare-versions   
                        compare versions using = = 
    print-architecture    List installable package architectures
    whatdepends [-A] [pkgname|pat]+
    whatdependsrec [-A] [pkgname|pat]+
    whatprovides [-A] [pkgname|pat]+
    whatconflicts [-A] [pkgname|pat]+
    whatreplaces [-A] [pkgname|pat]+

Options:
    -A            Query all packages not just those installed
    -V[]        Set verbosity level to .
    --verbosity[=]    Verbosity levels:
                    0 errors only
                    1 normal messages (default)
                    2 informative messages
                    3 debug
                    4 debug level 2
    -f         Use  as the opkg configuration file
    --conf 
    --cache     Use a package cache
    -d         Use  as the the root directory for
    --dest     package installation, removal, upgrading.
                 should be a defined dest name from
                the configuration file, (but can also be a
                directory name in a pinch).
    -o         Use  as the root directory for
    --offline-root     offline installation of packages.

Force Options:
    --force-depends        Install/remove despite failed dependencies
    --force-maintainer    Overwrite preexisting config files
    --force-reinstall    Reinstall package(s)
    --force-overwrite    Overwrite files from other package(s)
    --force-downgrade    Allow opkg to downgrade packages
    --force-space        Disable free space checks
    --noaction        No action -- test only
    --download-only    No action -- download only
    --nodeps        Do not follow dependencies
    --force-removal-of-dependent-packages
                Remove package and all dependencies
    --autoremove        Remove packages that were installed
                automatically to satisfy dependencies
    -t            Specify tmp-dir.
    --tmp-dir        Specify tmp-dir.

 regexp could be something like 'pkgname*' '*file*' or similar
 e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
Home Add software packages