Difference between revisions of "LELK-AN-001: Package installation using opkg"

From DAVE Developer's Wiki
Jump to: navigation, search
(Other useful OPKG commands)
(One intermediate revision by the same user not shown)
Line 8: Line 8:
 
This task can be performed using DAVE Yocto pre-built package server available at the <code>http://yocto.dave.eu</code> address.
 
This task can be performed using DAVE Yocto pre-built package server available at the <code>http://yocto.dave.eu</code> address.
  
== Installing packages on target ==
+
== Installing packages on target (manually) ==
  
To use <code>opkg</code> at runtime first of all you need to enable a channel, which commonly is a remote webserver that provide packages feed and the binary packages itself
+
To use <code>opkg</code> at runtime first of all you need to enable the network interface with <code>DNS</code> configuration for accessing external http servers.
  
 
An example of network interface configuration for Internet access is described here below. Configuration can be done directly on serial console with the following commands:
 
An example of network interface configuration for Internet access is described here below. Configuration can be done directly on serial console with the following commands:
Line 22: Line 22:
 
where ''192.168.0.254'' is the <code>gateway</code> address and ''8.8.8.8'' is the <code>DNS server</code> (in this case Google's one).
 
where ''192.168.0.254'' is the <code>gateway</code> address and ''8.8.8.8'' is the <code>DNS server</code> (in this case Google's one).
  
Once the network interface is configured, the DAVE's Yocto Lizard package server can be accessed for package downloading.
+
Once the network interface is configured, the DAVE's Yocto Lizard package server can be accessed for package downloading:
  
On the target edit the <code>opkg</code> configuration file to tell opkg where to look for packages.
+
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/<i>pack_name</i>
 +
 
 +
Where:
 +
* <code>cortexa8hf-vfp-neon-2.6.37.2</code> is the package directory
 +
* <code>http://yocto.dave.eu/lizard</code> is the URL of the webserver
 +
 
 +
For example:
 +
 
 +
'''
 +
<pre class="board-terminal">
 +
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-sftp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Connecting to yocto.dave.eu (79.143.179.155:80)
 +
openssh-sftp_6.1p1-r 100% |*******************************| 46000  0:00:00 ETA
 +
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Connecting to yocto.dave.eu (79.143.179.155:80)0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
openssh-keygen_6.1p1 100% |*******************************| 79936  0:00:00 ETA
 +
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Connecting to yocto.dave.eu (79.143.179.155:80)
 +
openssh-sshd_6.1p1-r 100% |*******************************|  188k  0:00:00 ETA
 +
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Connecting to yocto.dave.eu (79.143.179.155:80)
 +
openssh-ssh_6.1p1-r0 100% |*******************************|  161k  0:00:00 ETA
 +
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Connecting to yocto.dave.eu (79.143.179.155:80)
 +
openssh_6.1p1-r0-ara 100% |*******************************|  890  0:00:00 ETA
 +
root@lizard:~#
 +
</pre>
 +
 
 +
 
 +
After the required packages have been download, you need to install them using opkg:
 +
 
 +
<pre class="board-terminal">
 +
root@lizard:~# opkg
 +
opkg must have one sub-command argument
 +
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 <pkgs>          Install package(s)
 +
        configure <pkgs>        Configure unpacked package(s)
 +
        remove <pkgs|regexp>    Remove package(s)
 +
        flag <flag> <pkgs>      Flag package(s)
 +
        <flag>=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
 +
        list-changed-conffiles  List user modified configuration files
 +
        files <pkg>            List files belonging to <pkg>
 +
        search <file|regexp>    List package providing <file>
 +
        info [pkg|regexp]      Display all info for <pkg>
 +
        status [pkg|regexp]    Display all status for <pkg>
 +
        download <pkg>          Download <pkg> to current directory
 +
        compare-versions <v1> <op> <v2>
 +
                            compare versions using <= < > >= = << >>
 +
        print-architecture      List installable package architectures
 +
        depends [-A] [pkgname|pat]+
 +
        whatdepends [-A] [pkgname|pat]+
 +
        whatdependsrec [-A] [pkgname|pat]+
 +
        whatrecommends[-A] [pkgname|pat]+
 +
        whatsuggests[-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[<level>]            Set verbosity level to <level>.
 +
        --verbosity[=<level>]  Verbosity levels:
 +
                                        0 errors only
 +
                                        1 normal messages (default)
 +
                                        2 informative messages
 +
                                        3 debug
 +
                                        4 debug level 2
 +
        -f <conf_file>          Use <conf_file> as the opkg configuration file
 +
        --conf <conf_file>
 +
        --cache <directory>    Use a package cache
 +
        -d <dest_name>          Use <dest_name> as the the root directory for
 +
        --dest <dest_name>      package installation, removal, upgrading.
 +
                                <dest_name> should be a defined dest name from
 +
                                the configuration file, (but can also be a
 +
                                directory name in a pinch).
 +
        -o <dir>                Use <dir> as the root directory for
 +
        --offline-root <dir>    offline installation of packages.
 +
        --add-arch <arch>:<prio>        Register architecture with given priority
 +
        --add-dest <name>:<path>        Register destination with given path
 +
        --prefer-arch-to-version                Use the architecture priority package rather
 +
                                        than the higher version one if more
 +
                                        than one candidate is found.
 +
 
 +
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
 +
        --force-postinstall    Run postinstall scripts even in offline mode
 +
        --force-remove  Remove package even if prerm script fails
 +
        --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*'
 +
root@lizard:~#
 +
</pre>
 +
 
 +
For example, for the <code>openssh</code> packages previously downloaded, you can install the packages on the target with the following command:
 +
 
 +
<pre>
 +
root@lizard:~# opkg install openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh-keygen (6.1p1-r0-arago0) to root...go0_cortexa8hf-vfp-neon-2.6
 +
Configuring openssh-keygen.
 +
root@lizard:~# opkg install openssh-scp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh-scp (6.1p1-r0-arago0) to root...
 +
Configuring openssh-scp.
 +
update-alternatives: Linking //usr/bin/scp to /usr/bin/scp.openssh
 +
root@lizard:~# opkg install openssh-sftp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh-sftp (6.1p1-r0-arago0) to root...
 +
Configuring openssh-sftp.
 +
root@lizard:~# opkg install openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh-ssh (6.1p1-r0-arago0) to root...
 +
Configuring openssh-ssh.
 +
update-alternatives: Linking //usr/bin/ssh to /usr/bin/ssh.openssh
 +
root@lizard:~# opkg install openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh-sshd (6.1p1-r0-arago0) to root...
 +
Running useradd commands...
 +
Note: username sshd already exists, not re-creating it
 +
Configuring openssh-sshd.
 +
Adding system startup for /etc/init.d/sshd.
 +
Starting OpenBSD Secure Shell server: sshd
 +
done.
 +
root@lizard:~# opkg install openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh (6.1p1-r0-arago0) to root...
 +
Configuring openssh.
 +
root@lizard:~#
 +
</pre>
 +
 
 +
Once the system is restarted, the new openssh package will be activated using the installed scripts. For checking if the daemon is running, simply:
 +
 
 +
<pre class="board-terminal">
 +
root@lizard:~# ps | grep ssh
 +
  660 root      3916 S    /usr/sbin/sshd
 +
  747 root      3964 S    {sshd} sshd: root@pts/0
 +
  754 root      1780 S    grep ssh
 +
root@lizard:~#
 +
</pre>
 +
 
 +
{{ImportantMessage|text=The package dependencies will NOT be resolved automatically.
 +
}}
 +
 
 +
For example:
 +
 
 +
<pre class="board-terminal">
 +
root@lizard:~# opkg install openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 +
Installing openssh (6.1p1-r0-arago0) to root...
 +
Collected errors:
 +
* satisfy_dependencies_for: Cannot satisfy the following dependencies for openssh:
 +
*      openssh-ssh *  openssh-keygen *        openssh-sshd *
 +
* opkg_install_cmd: Cannot install package openssh.
 +
root@lizard:~#
 +
</pre>
 +
 
 +
== Installing packages on target (using feed) ==
 +
 
 +
We need to tell <code>opkg</code> on the embedded system where to look for packages.
  
 
The opkg configuration file is /etc/opkg/opkg.conf.
 
The opkg configuration file is /etc/opkg/opkg.conf.
 +
 +
Edit the opkg.conf file to look like this:
  
 
<pre>
 
<pre>
Line 54: Line 231:
 
<pre class="board-terminal">
 
<pre class="board-terminal">
 
root@lizard:~# opkg update
 
root@lizard:~# opkg update
...
+
Downloading http://yocto.dave.eu/all/Packages.gz.
...
+
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/any/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv5ehf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv5hf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv5tehf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv5thf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv6hf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv6thf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv7ahf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv7ahf-vfp-neon/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv7at2hf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/armv7at2hf-vfp-neon/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/cortexa8hf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/cortexa8hf-vfp-neon/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/cortexa8t2hf-vfp/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/cortexa8t2hf-vfp-neon/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/lizard/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 +
Downloading http://yocto.dave.eu/noarch/Packages.gz.
 +
wget: server returned error: HTTP/1.1 404 Not Found
 
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
 
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
 
Inflating http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
 
Inflating http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
Line 91: Line 304:
 
Downloading http://yocto.dave.eu/lizard/all/update-rc.d_0.7-r5_all.ipk.
 
Downloading http://yocto.dave.eu/lizard/all/update-rc.d_0.7-r5_all.ipk.
 
Configuring shadow-securetty.
 
Configuring shadow-securetty.
Configuring update-alternatives-worth.
+
Configuring update-alternatives-cworth.
 
Configuring openssh-ssh.
 
Configuring openssh-ssh.
 
update-alternatives: Linking //usr/bin/ssh to /usr/bin/ssh.openssh
 
update-alternatives: Linking //usr/bin/ssh to /usr/bin/ssh.openssh
Line 117: Line 330:
 
</pre>
 
</pre>
  
== Other useful OPKG commands ==
+
== Installed packages ==
  
A brief guide to OPKG command line interface is [http://wiki.openmoko.org/wiki/Opkg/Documentation here]. In the next section we'll show some example of OPKG usage.
+
To see which packages are installed, it is possibile to use the <code>list-installed</code> option:
  
=== List installed packages ===
+
<pre class="board-terminal">
 
+
root@lizard:~# opkg list-installed | grep openssh
User can see the list of installed packages with <code>opkg list-installed</code>
 
 
 
<pre>
 
root@lizard:~# opkg list-installed
 
base-passwd - 3.5.26-r2
 
libattr1 - 2.4.46-r4
 
libc6 - 2.15-r2-arago5
 
libcap2 - 2.22-r5
 
libcrypto1.0.0 - 1.0.1e-r15.0-arago9
 
libgcc-s1 - 4.7.3-r2-arago5
 
libgcrypt11 - 1.5.0-r2
 
libgpg-error0 - 1.11-r0
 
libz1 - 1.2.7-r0
 
 
openssh - 6.1p1-r0-arago0
 
openssh - 6.1p1-r0-arago0
 
openssh-keygen - 6.1p1-r0-arago0
 
openssh-keygen - 6.1p1-r0-arago0
Line 142: Line 342:
 
openssh-ssh - 6.1p1-r0-arago0
 
openssh-ssh - 6.1p1-r0-arago0
 
openssh-sshd - 6.1p1-r0-arago0
 
openssh-sshd - 6.1p1-r0-arago0
shadow - 4.1.4.3-r13
 
shadow-securetty - 4.1.4.3-r2-arago0
 
update-alternatives-cworth - 1:0.1.8+svnr649-r13.0-arago0
 
update-rc.d - 0.7-r5
 
 
root@lizard:~#
 
root@lizard:~#
 
</pre>
 
</pre>
 
=== List available packages ===
 
 
To list the available packages into the current configured channels use <code>opkg list</code>
 
 
<pre>
 
root@lizard:~# opkg list
 
a52dec - 0.7.4-r4 - liba52 version 0.7.4-r4  Library for reading some sort of media format.
 
a52dec-doc - 0.7.4-r4 - liba52 version 0.7.4-r4  Library for reading some sort of media format.
 
acl - 2.2.51-r3 - acl version 2.2.51-r3  utilities for access control list
 
acl-dbg - 2.2.51-r3 - acl version 2.2.51-r3 - Debugging files  utilities for access control
 
list  This package contains ELF symbols and  related sources for
 
debugging purposes.
 
acl-dev - 2.2.51-r3 - acl version 2.2.51-r3 - Development files  utilities for access control
 
list  This package contains symbolic links,  header files, and related
 
items necessary for software development.
 
acl-doc - 2.2.51-r3 - acl version 2.2.51-r3 - Documentation files  utilities for access control
 
list  This package contains documentation.
 
acl-locale-de - 2.2.51-r3 - acl version 2.2.51-r3 - de translations  utilities for access control
 
list  This package contains language  translation files for the de
 
locale.
 
acl-locale-es - 2.2.51-r3 - acl version 2.2.51-r3 - es translations  utilities for access control
 
list  This package contains language  translation files for the es
 
locale.
 
acl-locale-fr - 2.2.51-r3 - acl version 2.2.51-r3 - fr translations  utilities for access control
 
list  This package contains language  translation files for the fr
 
locale.
 
acl-locale-gl - 2.2.51-r3 - acl version 2.2.51-r3 - gl translations  utilities for access control
 
list  This package contains language  translation files for the gl
 
locale.
 
acl-locale-pl - 2.2.51-r3 - acl version 2.2.51-r3 - pl translations  utilities for access control
 
list  This package contains language  translation files for the pl
 
 
[...]
 
</pre>
 
 
=== Package info ===
 
 
To see a package characteristics use <code>opkg info <package_name> </code>:
 
 
<pre>
 
root@lizard:~# opkg info openssh
 
Package: openssh
 
Version: 6.1p1-r0-arago0
 
Depends: openssh-scp, openssh-ssh, openssh-keygen, openssh-sshd
 
Recommends: update-rc.d
 
Conflicts: dropbear
 
Status: install user installed
 
Section: console/network
 
Architecture: cortexa8hf-vfp-neon-2.6.37.2
 
Maintainer: OE-Core Developers <openembedded-core@lists.openembedded.org>
 
MD5Sum: 12d42e54c312a08c4321125ec4a1194b
 
Size: 890
 
Filename: openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
 
Source: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.1p1.tar.gz file://nostrip.patch file://sshd_config file://ssh_config file://init file://openssh-CVE-2011-4327.patch
 
Description: Secure rlogin/rsh/rcp/telnet replacement  Secure rlogin/rsh/rcp/telnet
 
replacement (OpenSSH) Ssh (Secure Shell) is  a program for logging into
 
a remote machine and for executing commands on  a remote machine.
 
Installed-Time: 1508849774
 
 
root@lizard:~#
 
</pre>
 
 
== References ==
 
 
{{reflist}}
 

Revision as of 11:59, 12 December 2017

Info Box
Lizard.jpg Applies to Lizard

Introduction[edit | edit source]

Thanks to the opkg packet manager installed on Yocto built root file system, Lizard module allows to install new packages (if available).

This task can be performed using DAVE Yocto pre-built package server available at the http://yocto.dave.eu address.

Installing packages on target (manually)[edit | edit source]

To use opkg at runtime first of all you need to enable the network interface with DNS configuration for accessing external http servers.

An example of network interface configuration for Internet access is described here below. Configuration can be done directly on serial console with the following commands:

root@sbc-lynx:~# ifconfig eth0 192.168.0.94
root@sbc-lynx:~# route add default gw 192.168.0.254
root@sbc-lynx:~# echo "nameserver 8.8.8.8" > /etc/resolv.conf

where 192.168.0.254 is the gateway address and 8.8.8.8 is the DNS server (in this case Google's one).

Once the network interface is configured, the DAVE's Yocto Lizard package server can be accessed for package downloading:

root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/pack_name

Where:

For example:

root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-sftp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh-sftp_6.1p1-r 100% |*******************************| 46000   0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Connecting to yocto.dave.eu (79.143.179.155:80)0_cortexa8hf-vfp-neon-2.6.37.2.ipk
openssh-keygen_6.1p1 100% |*******************************| 79936   0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk 
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh-sshd_6.1p1-r 100% |*******************************|   188k  0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk 
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh-ssh_6.1p1-r0 100% |*******************************|   161k  0:00:00 ETA
root@lizard:~# wget http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk 
Connecting to yocto.dave.eu (79.143.179.155:80)
openssh_6.1p1-r0-ara 100% |*******************************|   890   0:00:00 ETA
root@lizard:~#


After the required packages have been download, you need to install them using opkg:

root@lizard:~# opkg
opkg must have one sub-command argument
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 <pkgs>          Install package(s)
        configure <pkgs>        Configure unpacked package(s)
        remove <pkgs|regexp>    Remove package(s)
        flag <flag> <pkgs>      Flag package(s)
         <flag>=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
        list-changed-conffiles  List user modified configuration files
        files <pkg>             List files belonging to <pkg>
        search <file|regexp>    List package providing <file>
        info [pkg|regexp]       Display all info for <pkg>
        status [pkg|regexp]     Display all status for <pkg>
        download <pkg>          Download <pkg> to current directory
        compare-versions <v1> <op> <v2>
                            compare versions using <= < > >= = << >>
        print-architecture      List installable package architectures
        depends [-A] [pkgname|pat]+
        whatdepends [-A] [pkgname|pat]+
        whatdependsrec [-A] [pkgname|pat]+
        whatrecommends[-A] [pkgname|pat]+
        whatsuggests[-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[<level>]             Set verbosity level to <level>.
        --verbosity[=<level>]   Verbosity levels:
                                        0 errors only
                                        1 normal messages (default)
                                        2 informative messages
                                        3 debug
                                        4 debug level 2
        -f <conf_file>          Use <conf_file> as the opkg configuration file
        --conf <conf_file>
        --cache <directory>     Use a package cache
        -d <dest_name>          Use <dest_name> as the the root directory for
        --dest <dest_name>      package installation, removal, upgrading.
                                <dest_name> should be a defined dest name from
                                the configuration file, (but can also be a
                                directory name in a pinch).
        -o <dir>                Use <dir> as the root directory for
        --offline-root <dir>    offline installation of packages.
        --add-arch <arch>:<prio>        Register architecture with given priority
        --add-dest <name>:<path>        Register destination with given path
        --prefer-arch-to-version                Use the architecture priority package rather
                                        than the higher version one if more
                                        than one candidate is found.

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
        --force-postinstall     Run postinstall scripts even in offline mode
        --force-remove  Remove package even if prerm script fails
        --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*'
root@lizard:~#

For example, for the openssh packages previously downloaded, you can install the packages on the target with the following command:

root@lizard:~# opkg install openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-keygen (6.1p1-r0-arago0) to root...go0_cortexa8hf-vfp-neon-2.6
Configuring openssh-keygen.
root@lizard:~# opkg install openssh-scp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-scp (6.1p1-r0-arago0) to root...
Configuring openssh-scp.
update-alternatives: Linking //usr/bin/scp to /usr/bin/scp.openssh
root@lizard:~# opkg install openssh-sftp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-sftp (6.1p1-r0-arago0) to root...
Configuring openssh-sftp.
root@lizard:~# opkg install openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-ssh (6.1p1-r0-arago0) to root...
Configuring openssh-ssh.
update-alternatives: Linking //usr/bin/ssh to /usr/bin/ssh.openssh
root@lizard:~# opkg install openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh-sshd (6.1p1-r0-arago0) to root...
Running useradd commands...
Note: username sshd already exists, not re-creating it
Configuring openssh-sshd.
 Adding system startup for /etc/init.d/sshd.
Starting OpenBSD Secure Shell server: sshd
done.
root@lizard:~# opkg install openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk
Installing openssh (6.1p1-r0-arago0) to root...
Configuring openssh.
root@lizard:~#

Once the system is restarted, the new openssh package will be activated using the installed scripts. For checking if the daemon is running, simply:

root@lizard:~# ps | grep ssh
  660 root      3916 S    /usr/sbin/sshd
  747 root      3964 S    {sshd} sshd: root@pts/0
  754 root      1780 S    grep ssh
root@lizard:~#


200px-Emblem-important.svg.png

The package dependencies will NOT be resolved automatically.

For example:

root@lizard:~# opkg install openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk 
Installing openssh (6.1p1-r0-arago0) to root...
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for openssh:
 *      openssh-ssh *   openssh-keygen *        openssh-sshd *
 * opkg_install_cmd: Cannot install package openssh.
root@lizard:~#

Installing packages on target (using feed)[edit | edit source]

We need to tell opkg on the embedded system where to look for packages.

The opkg configuration file is /etc/opkg/opkg.conf.

Edit the opkg.conf file to look like this:

root@lizard:~# vi /etc/opkg/opkg.conf
# Must have one or more source entries of the form:
#
#   src <src-name> <source-url>
#
# and one or more destination entries of the form:
#
#   dest <dest-name> <target-path>
#
# where <src-name> and <dest-names> are identifiers that
# should match [a-zA-Z0-9._-]+, <source-url> should be a
# URL that points to a directory containing a Familiar
# Packages file, and <target-path> should be a directory
# that exists on the target system.


and add the following server:

src/gz cortexa8hf-vfp-neon http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/
src/gz all http://yocto.dave.eu/lizard/all
root@lizard:~# opkg update
Downloading http://yocto.dave.eu/all/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/any/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv5ehf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv5hf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv5tehf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv5thf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv6hf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv6thf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv7ahf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv7ahf-vfp-neon/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv7at2hf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/armv7at2hf-vfp-neon/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/cortexa8hf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/cortexa8hf-vfp-neon/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/cortexa8t2hf-vfp/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/cortexa8t2hf-vfp-neon/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/lizard/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/noarch/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
Inflating http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/Packages.gz.
Updated list of available packages in /var/lib/opkg/cortexa8hf-vfp-neon.
Downloading http://yocto.dave.eu/lizard/all/Packages.gz.
Inflating http://yocto.dave.eu/lizard/all/Packages.gz.
Updated list of available packages in /var/lib/opkg/all.

Then, simply, instruct opkg to install the required package, for example:

root@lizard:~# opkg install openssh
Installing openssh (6.1p1-r0-arago0) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing openssh-scp (6.1p1-r0-arago0) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-scp_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing update-alternatives-cworth (1:0.1.8+svnr649-r13.0-arago0) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/update-alternatives-cworth_0.1.8+svnr649-r13.0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing openssh-ssh (6.1p1-r0-arago0) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-ssh_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing openssh-keygen (6.1p1-r0-arago0) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-keygen_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing openssh-sshd (6.1p1-r0-arago0) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/openssh-sshd_6.1p1-r0-arago0_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing shadow (4.1.4.3-r13) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/shadow_4.1.4.3-r13_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Installing shadow-securetty (4.1.4.3-r2-arago0) to root...
Downloading http://yocto.dave.eu/lizard/lizard/shadow-securetty_4.1.4.3-r2-arago0_lizard.ipk.
Installing base-passwd (3.5.26-r2) to root...
Downloading http://yocto.dave.eu/lizard/cortexa8hf-vfp-neon-2.6.37.2/base-passwd_3.5.26-r2_cortexa8hf-vfp-neon-2.6.37.2.ipk.
Running useradd commands...
Note: username sshd already exists, not re-creating it
Installing update-rc.d (0.7-r5) to root...
Downloading http://yocto.dave.eu/lizard/all/update-rc.d_0.7-r5_all.ipk.
Configuring shadow-securetty.
Configuring update-alternatives-cworth.
Configuring openssh-ssh.
update-alternatives: Linking //usr/bin/ssh to /usr/bin/ssh.openssh
Configuring openssh-scp.
update-alternatives: Linking //usr/bin/scp to /usr/bin/scp.openssh
Configuring openssh-keygen.
Configuring base-passwd.
Configuring shadow.
update-alternatives: Linking //usr/bin/passwd to /usr/bin/passwd.shadow
update-alternatives: Linking //usr/bin/chfn to /usr/bin/chfn.shadow
update-alternatives: Linking //usr/bin/newgrp to /usr/bin/newgrp.shadow
update-alternatives: Linking //usr/bin/chsh to /usr/bin/chsh.shadow
update-alternatives: Linking //usr/bin/groups to /usr/bin/groups.shadow
update-alternatives: Linking //usr/sbin/chpasswd to /usr/sbin/chpasswd.shadow
update-alternatives: Linking //bin/login to /bin/login.shadow
update-alternatives: Linking //sbin/vipw to /sbin/vipw.shadow
update-alternatives: Linking //sbin/vigr to /sbin/vigr.shadow
Configuring openssh-sshd.
 System startup links for /etc/init.d/sshd already exist.
Restarting OpenBSD Secure Shell server: sshdstopped /usr/sbin/sshd (pid 910)
.
Configuring update-rc.d.
Configuring openssh.
root@lizard:~#

Installed packages[edit | edit source]

To see which packages are installed, it is possibile to use the list-installed option:

root@lizard:~# opkg list-installed | grep openssh
openssh - 6.1p1-r0-arago0
openssh-keygen - 6.1p1-r0-arago0
openssh-scp - 6.1p1-r0-arago0
openssh-sftp - 6.1p1-r0-arago0
openssh-ssh - 6.1p1-r0-arago0
openssh-sshd - 6.1p1-r0-arago0
root@lizard:~#