User Tools

Site Tools


kb:ni-rt:linuxrt:opkg

02 Package Manager

For all following commands it is assumed that the user is logged in as admin or another user with root privileges.

OPKG is the packet manager on NI Linux RT (https://wiki.openwrt.org/doc/techref/opkg). With OPKG it's possible to install a lot of software from the Linux ecosystem. If the system has connection to the Internet, the packet manager downloads all necessary packages and dependencies.

Official NI Repositories

Downloadsite of the official NI package feeds: http://download.ni.com/ni-linux-rt/feeds/

The configuration of the OPKG package manager is in /etc/opkg/.

Step-by-step instructions for installing and configuring a package

Basic Usage

Install the text editor nano:

$ opkg install nano
$

Remove a package:

$ opkg remove nano
$

List all available packages:

$ opkg list
$

List all installed packages:

$ opkg list-installed
$

Check if a package is available:

$ opkg list | grep python
$

Installation of packages on offline devices

If a device has no internet connection, opkg can't check the online repository for packages and can't download files. Nevertheless it's possible to install new packages. Requirement is a second device with with the same version of NI Linux RT. On this device one can download the necessary packages, copy them to the target device and install it there. The problem with this procedure is, that opkg can't determine the dependencies for the package. Therefore it's necessary to check the dependencies of the package, check wich of these dependencies are installed on the target and download all missing packages manually (and hopefully don't end in the dependency hell).

Alternatively you can download the package files direct from the NI RTLinux feed at http://download.ni.com/ni-linux-rt/feeds/.

Example for Ghostscript

Check dependencies on online-target:

$ opkg info ghostscript
Package: ghostscript
Version: 9.15-r1.16
Depends: libtiff5 (>= 4.0.3), libc6 (>= 2.21), libcups2 (>= 2.0.2), libcupsimage2 (>= 2.0.2), libfontconfig1 (>= 2.11.1)
Status: install user installed
Section: console/utils
Architecture: core2-64
Maintainer: NI Linux Real-Time Maintainers <nilrt@ni.com>
MD5Sum: 827b7ccf7610d3dc53de6f471a673dbb
Size: 21366174
Filename: ghostscript_9.15-r1.16_core2-64.ipk
Source: http://downloads.ghostscript.com/public/ghostscript-9.15.tar.gz file://ghostscript-9.02-prevent_recompiling.patch file://ghostscript-9.02-genarch.patch file://objarch.h file://ghostscript-9.02-parallel-make.patch file://cups-no-gcrypt.patch file://ghostscript-9.15-parallel-make.patch
Description: The GPL Ghostscript PostScript/PDF interpreter  Ghostscript is used for
 PostScript/PDF preview and printing.  Usually as   a back-end to a
 program such as ghostview, it can display PostScript and   PDF documents
 in an X11 environment. Furthermore, it can render   PostScript and PDF
 files as graphics to be printed on non-PostScript   printers. Supported
 printers include common dot-matrix, inkjet and laser   models.

Dependencies for this package: libtiff5 (>= 4.0.3), libc6 (>= 2.21), libcups2 (>= 2.0.2), libcupsimage2 (>= 2.0.2), libfontconfig1 (>= 2.11.1)

Check the offline-target for installed dependencies:

$ opkg list-installed libtiff5
$ opkg list-installed libc6   
libc6 - 2.21-r0.239
$ opkg list-installed libcups2
$ opkg list-installed libcupsimage2
$ opkg list-installed libfontconfig1
libfontconfig1 - 2.11.1-r0.172

Now we see just two of five packages are installed. We need to download and install the rest manually.

Online-Target:

$ mkdir packages
$ cd packages
$ opkg download ghostscript
Downloading http://download.ni.com/ni-linux-rt/feeds/2016/x64/ipk/core2-64/ghostscript_9.15-r1.16_core2-64.ipk.
Downloaded ghostscript as ghostscript_9.15-r1.16_core2-64.ipk.
$ opkg download libtiff5   
Downloading http://download.ni.com/ni-linux-rt/feeds/2016/x64/ipk/core2-64/libtiff5_4.0.3-r0.46_core2-64.ipk.
Downloaded libtiff5 as libtiff5_4.0.3-r0.46_core2-64.ipk.
 
...

Copy the packages per USB or somehow else to the offline-target.

Offline-Target:

$ cd packages
$ ls -lah
total 21344
drwxr-xr-x    2 admin    administ    4.0K Jul  6 12:55 .
drwxr-xr-x    4 admin    administ    4.0K Jul  6 12:55 ..
-rw-r--r--    1 admin    administ   20.4M Jul  6 12:55 ghostscript_9.15-r1.16_core2-64.ipk
-rw-r--r--    1 admin    administ  206.0K Jul  6 12:55 libcups2_2.0.2-r0.17_core2-64.ipk
-rw-r--r--    1 admin    administ   14.4K Jul  6 12:55 libcupsimage2_2.0.2-r0.17_core2-64.ipk
-rw-r--r--    1 admin    administ   76.9K Jul  6 12:55 liblzma5_5.2.0-r0.155_core2-64.ipk
-rw-r--r--    1 admin    administ  161.7K Jul  6 12:55 libtiff5_4.0.3-r0.46_core2-64.ipk
$opkg install libcups2_2.0.2-r0.17_core2-64.ipk 
Installing libcups2 (2.0.2-r0.17) on root.
Configuring libcups2.
 
...

It's possible that one of the downloaded packages itself has dependencies that are not installed. In this case you have to go back to the online-target, download it and install it on the offline-target.

After all, you can remove the manually copied packages.

kb/ni-rt/linuxrt/opkg.txt · Last modified: 2021/03/24 08:35 by manuel.sebald