ipkg - the Itsy Package Management System
iPKG is a very lightweight package management system. It was designed for Linux installations with severe storage limitations such as handheld computers. iPKG is more than just an embedded Linux flash image builder, (although it does that fairly well). It also allows for dynamic installation/removal of packages on a running system.
note: see BuildingIpkgs for details on creating your own ipkg files.
iPKG is itsy in several ways:
-
The control programs themselves are small, (currently about 13kB)
-
The installed meta-data tries to be only what is absolutely essential, (currently about 38kB for a 16MB compressed flash iPAQ distribution)
-
The available packages are small. (The idea is that the package tree should be as fine-grain as possible. Much of this still needs some work)
Development
See the IpkgTodo page
News
ipkg 0.99
-
now supports .deb format and ar-wrapped .ipk files
-
fully implemented in C
-
supports Provides, Conflicts and Replaces
ipkg 0.9 adds the following features
-
Fetching packages from multiple packages repositories, (via "src" options in /etc/ipkg.conf)
-
Installing packages to different destination directories, (via "dest" option in /etc/ipkg.conf). This is handy for installing packages to external storage such as a compact flash card or a microdrive.
-
ipkg is now being used by
OpenWRT, a firmware replacement for the Linksys WRT54G.
Where can I get it?
iPKG has been incorporated into the FamiliarDistribution for the Compaq iPAQ.
How about the source?
Older versions of ipkg are all shell scripts, so you've got the source if you've got one of those
Recent versions, however, are compiled executables. But seriously, look at handhelds.org CVS (instructions at http://www.handhelds.org/sources.html ) and checkout the familiar/dist/ipkg module. The sh subdirectory contains the scripts used on the iPAQ. The util subdirectory contains scripts that are useful if you want to build a .ipk, use ipkg on a machine to create custom images, or maintain a repository of .ipk packages. All these scripts need documentation.
iPKG is available from CVS: checkout familiar/dist/ipkg from the HandheldsCvsRepository.
Snapshot tarballs are also available at http://www.handhelds.org/download/packages/ipkg/
How do I use it?
The ipkg program has many different sub-commands, (provided by the first command-line argument in a manner similar to cvs).
Here is a current snapshot of the available commands:
usage: ipkg [options...] sub-command [arguments...]
where sub-command is one of:
Package Manipulation:
update Update list of available packages
upgrade Upgrade all installed packages to
latest version
install <pkg> Download and install <pkg>
(and dependencies)
install <file.ipk> Install package <file.ipk>
configure [<pkg>] Configure unpacked packages
remove <pkg> Remove package <pkg>
flag <flags> <pkg> ... Flag package(s) <pkg>
(<flag>=hold|noprune|user|ok|installed|unpacked (one per invocation))
Informational Commands:
list List available packages and descriptions
files <pkg> List all files belonging to <pkg>
search <file> Search for a package providing <file>
info [pkg [<field>]] Display all/some info fields for <pkg> or all
status [pkg [<field>]] Display all/some status fields for <pkg> or all
download <pkg> Download <pkg> to current directory.
compare_versions <v1> <op> <v2> (compare versions using <= < > >= = << >>)
print_architecture prints the architecture.
print_installation_architecture
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 with whatdepends,
whatprovides, whatreplaces, whatconflicts
-V <level> Set verbosity level to <level>. If no value is
--verbosity <level> provided increase verbosity by one. Verbosity levels:
0 errors only
1 normal messages (default)
2 informative messages
3 debug output
-f <conf_file> Use <conf_file> as the ipkg configuration file
-conf <conf_file> Default configuration file location
is /etc/ipkg.conf
-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 <offline_root> Use <offline_root> as the root directory for
-offline <offline_root> offline installation of packages.
-verbose_wget more wget messages
Force Options (use when ipkg is too smart for its own good):
-force-depends Make dependency checks warnings instead of
errors and install/remove package in spite of
failed dependences
-force-defaults Use default options for questions asked by
ipkg. (no prompts). Note that this will not
prevent package installation scripts from
prompting.
-force-reinstall Allow ipkg to reinstall a package.
-force-overwrite Allow ipkg to overwrite files from another
package during an install.
-force-removal-of-dependent-packages
-force_space Install even if there does not seem to be
enough space.
-noaction No action -- test only
-nodeps Do not follow dependences
-recursive Allow ipkg to remove package and all that
depend on it.
-test No action -- test only
-t Specify tmp-dir.
--tmp-dir Specify tmp-dir.
Examples:
Install the ftp program:
ipkg install ftp
Install from an url (ipkg version >=0.9):
ipkg install http://url/to/some/package.ipk
Perform a limited local "ipkgfind" (assuming you've already run ipkg update):
ipkg list|grep searchstring
Configuration Files
The /etc/ipkg.conf file controls the server from which ipkg-update and ipkg-get will pull package information and packages. As of Familiar v0.7 (ipkg 0.99.87) the configuration files are as follows:
-
/etc/ipkg.conf Defines destination locations and proxy settings (e.g. dest root /)
-
/etc/ipkg/familiar-ipaqsa.conf - Architectures listing.
-
/etc/ipkg/<feed>.conf Defines individual feed locations. See the IpkgFeeds wiki for locations.
See the comments in ipkg.conf for more details.
Questions
Why a new packaging system?
I really like Debian and Debian/arm is a great distribution, but it doesn't fit well, (yet! see http://www.emdebian.org), on a system like a base iPAQ for several reasons:
-
The control programs are several hundred kB.
-
The meta-data, (/var/lib/dpkg), is several MB.
-
The package granularity is rather coarse, (eg. many packages include documentation)
That said, I didn't want to invent a new packaging system. Debian is well-maintained and it represents an enormous amount of maintainer effort that I do not want to duplicate. I want to be able to easily use any/all of Debian/arm. So iPKG tries to be like Debian, as much as possible. In fact, the philosophy in the development has been something like, "Do it like Debian unless there is a strong reason not to". The majority of the packages in the current repository come more or less straight out of Debian/arm unstable, (with documentation removed). I hope to automate this process of making .ipk packages from .debs, (and I would even like ipkg to be able to point straight at Debian/arm).
So how is it different than Debian?
First, I've written all the control programs from scratch. I looked at the dpkg source and decided that it would be easier to build up something new from scratch rather than to trim that beast down. Currently the ipkg programs are implemented as shell scripts and are still very limited compared to their Debian counterparts. Both of these facts will change as I build up ipkg. The idea is to adhere to Debian policy as much as possible without incurring a large space penalty. I wouldn't mind getting ipkg to the point where it could be a reasonable replacement for dpkg in a full Debian system, (as long as ipkg remains lighter). Another take on this would be to trim dpkg down, this is already being done with udpkg which is being dewveloped for Debian boot-floppies, (see http://www.debianplanet.org/debianplanet/article.php?sid=124). I should learn more about udpkg.
Second, the collection of packages making up the ipkg repository have a finer granularity than standard Debian packages. The Debian boot-floppies developers are doing something similar with udebs, (see debianplanet URL above). I'd like to coordinate these efforts, and eventually migrate this fine level of granularity into Debian proper.
What is the .ipk format?
In keeping with the "Just like Debian" philosphy laid out above, I first made the .ipk format equivalent to .deb, (but renamed to avoid frustration and confusion). However, I recently changed it to be a tar.gz file rather than an ar archive so that ar would not have to be installed to use ipkg. (But with 0.99 we changed it back because gzipping compressed data is a waste of CPU and battery).
So, a .ipk file is an archive (either tar or gzipped tar) containing 3 members:
-
./data.tar.gz contains the actual files belonging to this package. The contents of this directory will be extracted to / by ipkg. So it should contain entries such as ./usr and ./etc as top-level directory entries.
-
./control.tar.gz contains meta-data and scripts for the package. It must contain a file named control. It also may contain the following files: conffiles, preinst, postinst, prerm, postrm. Heck, it may contain anything else for that matter, but it wouldn't be useful.
-
./debian-binary This file is currently ignored by ipkg. However, in all current ipkgs it is a text file with a single line: 2.0
If you wish to view a .ipk file using WinZip, you can rename it (or copy it) as ....ipk.tar.gz, and then carefully open the contents.
Can I make my own .ipk packages?
Yes, please do. See BuildingIpkgs.
Can I submit my .ipk packages?
Yes, see http://handhelds.org/contributing.html
Can I maintain my own feed of .ipk packages?
Yes. See MaintainingIpkgFeeds.
Is there a list of known feeds?
See IpkgFeeds (and list your feeds there)
Is there an index of feeds and packages?
See http://ipkgfind.handhelds.org/
Any bugs?
Bugs are plentiful. Here is an incomplete list:
-
"ipkg remove" doesn't complain if you remove an essential package
-
This is ( hopefully ) fixed in 0.99.118 Pigi
-
"ipkg remove" doesn't track dependency links that will be broken
-
This is fixed in ipkg 0.99
-
ipkg does not yet support versioned dependencies
-
This is fixed in ipkg 0.99
-
the Pre-Depends package control field is not properly respected, (it is treated the same as Depends)
-
none of the following package control fields are implemented: Suggests, Recommends, Provides, Conflicts, Replaces. I expect some of these to be handled only in frontends.
-
0.99 supports Provides, Conflicts and Replaces
-
Some others I can't think of right now...
-
the default ipkg.conf doesn't use the *correct* options for proxy user/passwd:
-
ie proxy_user and proxy_passwd. And the busybox wget doesn't accept them anyway.
What's on the iPKG TODO list?
This is sorted more or less in the order I intend to tackle things:
-
ipkg remove needs to complain about broken dependencies
-
Orphan Control: ipkg will remember what packages were specifically requested by the user, and which were pulled in by dependencies. Then when a package that was not requested by a user becomes orphaned, (ie. there is no longer any package depending on it), ipkg will prompt to remove the orphaned package.
-
This is supported in 0.99
-
Virtual packages (ie. implement the "Provides:" field)
-
This is supported in 0.99
-
Think about supporting the fancy arguments and error unwinding that Debian does for control scripts.
-
Support for "Conflicts:" and "Replaces:"
-
This is supported in 0.99
-
deb2ipk
-
No longer needed
Feature Requests
-
Be able to search for dependencies on a specified package. KenCausey
-
Why are the gzipped data and control files gzipped again? This is a waste of time, processing power, and will lead to a larger file than if the data and control files were just tarred, and then the whole thing was gzipped. Ian Clarke.
-
Agreed. We now use ar-wrapped deb-style .ipk files.
-
TimRiker adds: Better yet, unpack the tarballs and pack up the whole thing at once. control/ would have what was in control.tar.gz, data/ would have what was in data.tar.gz and debian-binary would move to the top of control as "Control: 2.0" or similar. Unpacking would probably symlink data -> / so that extraction was fast.
-
TimRiker adds: Support deleting all package info except the package names and versions from the embedded device. meta info would be reloaded as needed from the central package trees. Note: this would require that the central trees kept old packages around for a while and that ipkg would offer to use scripts from available new versions of packages if the old ones could not be found.
-
TimRiker notes: debian package tools build smaller gzipped tars than I seem to be able to create. hmm. I wonder what options they use by default?
-
Optional support for iPkg 'digital signature' for embedded systems that require assurance that the iPkg is pukka. MikEw.
-
John Light jjlight@ibeam.intel.com wants to use ipkg in a cross-build environment, where the preinst and postinst scripts fail. I put an option to ignore them into the script. Now I need to modify the c code.
-
Ran Talbott adds: ipkg and ipkg-build should print a version message if passed a -V switch. (Use --version)
-
Ran Talbott adds: Require a "Builtby:" field, with program name and version, in CONTROL/control, so automated tools can know what file format to expect, and whether they can trust information like dependencies.
Troubleshooting
If It All Goes Pear Shaped
If ipkg stops working then: (from Carl Worth):
-
If you are using the shell-script ipkg, try editing /usr/bin/ipkg and
putting the following near the top of the script:
set -x
then see what comes from ipkg when you run it.
If you are using the compiled ipkg, try installing strace then running:
strace ipkgand see what you get.
Also try the -V option (e.g. ipkg -V 3 install <pkg>) which may give some additional clues as to the point of failure.
When It Still Won't Work
Working around (a presumably non-working) ipkg: (from critta):
-
For versions >=0.99.110, ipkg also requires libipkg; Be sure to pay attention to the dependencies listed and obtain maching versions of ipkg and libipkg. In the samples below, I will refer to the files from current unstable as of this writing - v0.99.116, you can find the latest version and location of these files using iPkgFind:
#Get ready. mkdir /tmp/newipk cd /tmp/newipk #Retrieve libipkg wget -O libipkg.ipk http://familiar.handhelds.org/familiar/feeds/unstable/packages/armv4l/libipkg_0.99.117_arm.ipk #Unpack the ipk wrapper. ar -x libipkg.ipk #In general, when manually installing an ipk, you #should probably check the contents of control.tar.gz. #For the version used as an example, there are no #scripts that had to be run for the library portion, #but there's always the possibility this will change. #If there are scripts (preinst or postinst), be sure #you know the appropriate actions to take before and #after the next step. #Unroll the tarball in the root directory. tar -zxvC / -f data.tar.gz #Clean up - this isn't strictly necessary, but if #you are checking out the files as you extract them #(as you probably should) this makes the things #easier. Type this command carefully. rm -R /tmp/newipk/* #Now, get the latest ipkg.ipk. (If you skipped the above #steps because you are installing an older version, do #the initial "Get Ready" mkdir and cd commands first). wget -O ipkg.ipk http://familiar.handhelds.org/familiar/feeds/unstable/packages/armv4l/ipkg_0.99.117_arm.ipk #Unpack the ipk wrapper. ar -x ipkg.ipk #Check the control file. tar zxvf control.tar.gz #Look for scripts such as preinst and postinst. I will #only cover the postinst here, but if a preinst exists #you should probably run that before unpacking the tarball #(i.e. ./preinst) ls -l #When upgrading from a version older than 0.99.110 #[Not sure of version this changed], you will likely have #to remove the ipkg executable because it is not included #in the data.tar (it becomes a link to ipkg-cl instead #during postinst). If this file is already a link, just #leave it alone [I think - you might have to run the prerm #for the current version first]. rm /usr/bin/ipkg #Unroll the tarball. tar -zxvC / -f data.tar.gz #Run the postinst script. If you get an error regarding #linking on this step, be sure you removed the original #binary ipkg and then try again. ./postinst #To cleanup the temporary files, you can reboot or: cd / rm -R /tmp/newipk #Check your version ipkg --version
Hopefully it matches what you downloaded
- Chris Thompson (critta), Carl Worth, Jonathan Chetwynd.
- Previous content by ColinMarquardt (stale items removed)