Differences

This shows you the differences between two versions of the page.

doc:techref:opkg [2012/12/26 01:23]
valentt
doc:techref:opkg [2014/07/19 11:17] (current)
brakke Changed note to current version
Line 1: Line 1:
====== OPKG Package Manager ====== ====== OPKG Package Manager ======
The ''opkg'' utility (an ipkg fork) is a lightweight package manager used to download and install OpenWrt packages from local package repositories or ones located in the Internet.\\ The ''opkg'' utility (an ipkg fork) is a lightweight package manager used to download and install OpenWrt packages from local package repositories or ones located in the Internet.\\
-GNU/Linux users already familiar with ''apt-get'', ''aptitude'', ''pacman'', ''yum'', etc. will recognize the similarities.+GNU/Linux users already familiar with ''apt-get'', ''aptitude'', ''pacman'', ''yum'', etc. will recognize the similarities. It also has similarities with NSLU2's [[http://www.nslu2-linux.org/wiki/Optware/|Optware]], also made for embedded devices. OPKG is however a full package manager for the root file system, instead of just a way to add software to a seperate directory (e.g. ''/opt''). This also includes the possibility to add kernel modules and drivers. OPKG is sometimes called //Entware//, but this is mainly to refer to the [[http://entware.wl500g.info|Entware repository]] for embedded devices.
''Opkg'' attempts to resolve dependencies with packages in the repositories - if this fails, it will report an error, and abort the installation of that package. ''Opkg'' attempts to resolve dependencies with packages in the repositories - if this fails, it will report an error, and abort the installation of that package.
Line 8: Line 8:
To ignore dependency errors, pass the ''--force-depends'' flag. To ignore dependency errors, pass the ''--force-depends'' flag.
-:!: **Please note:** If you are using Attitude Adjustment (bleeding edge version), ''opkg install <pkg>'' may fail, if the package in the repository is for a newer kernel version then the kernel version on your flash.+:!: **Please note:** If you are using Barrier Breaker (bleeding edge version), ''opkg install <pkg>'' may fail, if the package in the repository is for a newer kernel version then the kernel version on your flash.
===== Invocation ===== ===== Invocation =====
Line 17: Line 17:
</code> </code>
-You can use [[wp>regular_expression|regular expressions]].+You can use [[wp>Glob_(programming)|glob patterns]].
==== Package Manipulation ==== ==== Package Manipulation ====
| ''**update**''  | Update list of available packages\\ This simply retrieves a file like this one: [[http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages|example]], for your OpenWrt installation and stores it on your [[wp>tmpfs|RAM partition]] under ''/tmp/opkg-lists/snapshots''. Currently this occupies about 1,3 MiB of space. OPKG needs the content of this file in order to install or upgrade packages or to print info about them. And the content of the file needs to represent the current available packages in the repository. You can safely delete this file anytime to free up some RAM, just don't forget to fetch a new one, before trying to install a package.  | | ''**update**''  | Update list of available packages\\ This simply retrieves a file like this one: [[http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages|example]], for your OpenWrt installation and stores it on your [[wp>tmpfs|RAM partition]] under ''/tmp/opkg-lists/snapshots''. Currently this occupies about 1,3 MiB of space. OPKG needs the content of this file in order to install or upgrade packages or to print info about them. And the content of the file needs to represent the current available packages in the repository. You can safely delete this file anytime to free up some RAM, just don't forget to fetch a new one, before trying to install a package.  |
-| ''**upgrade** <pkgs>''  | Upgrade packages\\ To upgrade a group of packages, run ''opkg upgrade //packagename1// //packagename2//''.\\ A list of upgradeable packages can be obtained with the ''opkg list-upgradable'' command.\\ Upgrading packages is generally **not** recommended for most users, because a typical OpenWrt system stores the base system in a read-only SquashFS partition. And while the upgrade process works just fine, it uses far more space than a default installation as the base packages are duplicated in the base SquashFS partition and the user JFFS2 partition.\\ Thus, instead of upgrading, reflashing OpenWrt with a newer firmware image is recommended. |+| ''**upgrade** <pkgs>''  | Upgrade packages\\ To upgrade a group of packages, run ''opkg upgrade //packagename1// //packagename2//''.\\ A list of upgradeable packages can be obtained with the ''opkg list-upgradable'' command.\\ Upgrading packages is generally **not** recommended for most users, because a typical OpenWrt system stores the base system in a read-only SquashFS partition. And while the upgrade process works just fine, it uses far more space than a default installation as the base packages are duplicated in the base SquashFS partition and the user JFFS2 partition.\\ Thus, instead of upgrading, reflashing OpenWrt with a newer firmware image is recommended. Of course, upgrading packages installed afterwards does not have this drawback. Keep in mind though that for OpenWrt releases upgrading is for the most part not possible, since there is nothing to upgrade without changing the package repository. This is because the package repositories for OpenWrt's releases are generally not updated. However, the package repository in the trunk snapshots are updated by the build bots to new versions very often, as this is where the packages are updated, like the OpenWrt builds themselves. Note however that for kernel packages updating can be a risky business as it may brick the device if the trunk build kernel is incompatible with the new upgraded kernel package. You should therefore only upgrade non-kernel packages. |
| ''**install** <pkgs|FQDN>'' | Install package(s)\\ Examples: <code>opkg install hiawatha</code> <code>opkg install http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/hiawatha_7.7-2_ar71xx.ipk</code> <code>opkg install /tmp/hiawatha_7.7-2_ar71xx.ipk</code>  | | ''**install** <pkgs|FQDN>'' | Install package(s)\\ Examples: <code>opkg install hiawatha</code> <code>opkg install http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/hiawatha_7.7-2_ar71xx.ipk</code> <code>opkg install /tmp/hiawatha_7.7-2_ar71xx.ipk</code>  |
| ''**configure** <pkgs>'' | Configure unpacked package(s)  | | ''**configure** <pkgs>'' | Configure unpacked package(s)  |
-| ''**remove** <pkgs|regexp>'' | Remove package(s)  |+| ''**remove** <pkgs|globp>'' | Remove package(s)  |
| ''**flag** <flag> <pkgs>'' | Flag one or multiple package(s). Only one flag per invocation is allowed. Available flags:\\ hold • noprune • user • ok • installed • unpacked  | | ''**flag** <flag> <pkgs>'' | Flag one or multiple package(s). Only one flag per invocation is allowed. Available flags:\\ hold • noprune • user • ok • installed • unpacked  |
==== Informational Commands ==== ==== Informational Commands ====
-| ''**list** [pkg|regexp]''      | List available packages\\ <code>Package name - Version - Description</code> The Description can contain line breaks, so using merely grep is inapt since grep is line-based.  |+| ''**list** [pkg|globp]''      | List available packages\\ <code>Package name - Version - Description</code> The Description can contain line breaks, so using merely grep is inapt since grep is line-based.  |
| ''**list-installed**''        | List installed packages  | | ''**list-installed**''        | List installed packages  |
| ''**list-upgradable**''        | List installed and upgradable packages  | | ''**list-upgradable**''        | List installed and upgradable packages  |
Line 67: Line 67:
/usr/lib/asterisk/modules/func_logic.so /usr/lib/asterisk/modules/func_logic.so
</code>  | </code>  |
-| ''**search** <file|regexp>''  | List package providing <file>  | +| ''**search** <file|globp>''  | List package providing <file>  | 
-| ''**info** [pkg|regexp]''      | Display all info for <pkg>\\ <code>+| ''**info** [pkg|globp]''      | Display all info for <pkg>\\ <code>
Package: horst Package: horst
Version: 2.0-rc1-2 Version: 2.0-rc1-2
Line 83: Line 83:
Description: [horst] is a scanning and analysis tool for 802.11 wireless networks and Description: [horst] is a scanning and analysis tool for 802.11 wireless networks and
especially IBSS (ad-hoc) mode and mesh networks (OLSR).</code> **''Note1:''** The <color red>size</color> is the size of the gzip compressed tar archive. At installation package gets un-tared and decompressed, but then again JFFS2 uses compression itself.\\ **''Note2:''** Since the compression of JFFS2 is transparent, commands like ''ls'' will always report the size of the uncompressed file. | especially IBSS (ad-hoc) mode and mesh networks (OLSR).</code> **''Note1:''** The <color red>size</color> is the size of the gzip compressed tar archive. At installation package gets un-tared and decompressed, but then again JFFS2 uses compression itself.\\ **''Note2:''** Since the compression of JFFS2 is transparent, commands like ''ls'' will always report the size of the uncompressed file. |
-| ''**status** [pkg|regexp]''  | Display all status for <pkg>  |+| ''**status** [pkg|globp]''  | Display all status for <pkg>  |
| ''**download** <pkg>''      | Download <pkg> to current directory  | | ''**download** <pkg>''      | Download <pkg> to current directory  |
| ''**compare-versions** <v1> <op> <v2>''  | Compare versions ''v1'' and ''v2'' using the operators ''%%<=%%'', ''<'', ''>'', ''>='', ''='', ''%%<<%%'' or ''%%>>%%''  | | ''**compare-versions** <v1> <op> <v2>''  | Compare versions ''v1'' and ''v2'' using the operators ''%%<=%%'', ''<'', ''>'', ''>='', ''='', ''%%<<%%'' or ''%%>>%%''  |
Line 132: Line 132:
  * ''opkg info'' will display all available information.   * ''opkg info'' will display all available information.
-You can make use of [[wp>Regular_expression]]s and also write a little  [[doc:howto:commandlineinterpreter|shell script]] to gather information. Use a pipe (''|'') and ''grep'' or ''awk'' or ''sed'' to filter that output:+You can make use of [[wp>Glob_(programming)|glob pattern]]s directly and also write a little  [[doc:howto:commandlineinterpreter|shell script]] to use [[wp>Regular expression]]s and otherwise further process information. Use a pipe (''|'') and ''grep'' or ''awk'' or ''sed'' to filter that output:
  * ''opkg list | grep pattern''   * ''opkg list | grep pattern''
Line 138: Line 138:
  * ''opkg info kmod-ipt-* | awk '/length/ {print $0}'''   * ''opkg info kmod-ipt-* | awk '/length/ {print $0}'''
  * ''opkg list-installed | awk '{print $1}' | sed ':M;N;$!bM;s#\n# #g'''   * ''opkg list-installed | awk '{print $1}' | sed ':M;N;$!bM;s#\n# #g'''
-  * ''var="packagename1 packagename2 packagename2"; for i in $variable; do opkg info $i; done;''+  * ''var="packagename1 packagename2 packagename2"; for i in $var; do opkg info $i; done;''
  * ''opkg depends dropbear'' doesn't work either.   * ''opkg depends dropbear'' doesn't work either.
Line 259: Line 259:
== Kernel Modules == == Kernel Modules ==
-Kernel modules that are installed to a non-standard location may not be properly automagically inserted into the kernel when required, and manual insertion may be necessary.  For example, after installing libdevmapper under /mnt, insert the modules thus:+Kernel modules that are installed to a non-standard location may not be properly automatically inserted into the kernel when required, and manual insertion may be necessary.  For example, after installing libdevmapper under /mnt, insert the modules thus:
''insmod /mnt/lib/modules/2.6.36.4/dm-mod.ko'' ''insmod /mnt/lib/modules/2.6.36.4/dm-mod.ko''
Line 274: Line 274:
More information on installing and using ''ldconfig'' can be found in [[https://forum.openwrt.org/viewtopic.php?pid=117496#p117496|this article]]. More information on installing and using ''ldconfig'' can be found in [[https://forum.openwrt.org/viewtopic.php?pid=117496#p117496|this article]].
 +
 +== Example Creating Links to Files from the Root File System to Make Programs Work ==
 +Some programs need additional config files to run, and you will have to create soft links between the root filesystem and the external storage one (e.g. USB). As an example, to successfully run Midnight Commander after installing it on a USB stick, you must run:<code>
 +ln -s $USB/usr/share/terminfo/ /usb/share/
 +ln -s $USB/etc/mc /etc/mc</code>
===== Troubleshooting ===== ===== Troubleshooting =====

Back to top

doc/techref/opkg.1356481433.txt.bz2 · Last modified: 2012/12/26 01:23 by valentt