Handling Debian packages
Here are a few not-quite-so-basics for dealing with Debian packages including some pointers on how to put packages on hold or how to setup a local repository.
Putting a package on hold
There are reasons for not wanting to automatically upgrade a package, for instance if you know that the new version is buggy. In that situation you want to put this package on hold:
echo packagename hold | dpkg --set-selections
An apt-get dist-upgrade now won't update this package anymore. To release a package from hold again:
echo packagename install | dpkg --set-selections
To learn about the packages that are on hold:
dpkg --get-selections
Local Repository
Individual packages can be installed via dpkg -i package.deb. This won't, however, take care of dependencies. If you have lots of those packages you might want to have a local repository that you can add to sources.list and use in conjunction with commands as apt-get dist-upgrade.
First, create a directory repository (change the name to your liking) together with two subdirectories binary and source (optional):
mkdir -p repository/binary repository/source
Now, you can copy your .deb packages to repository/binary and your source files such as .dsc, .orig.gz, .diff.gz to repository/source. Next, you need to generate information about these files:
cd repository dpkg-scanpackages binary /dev/null \ | gzip -9c > binary/Packages.gz dpkg-scansources source /dev/null \ | gzip -9c > source/Sources.gz
Finally, to make the freshly created repository available to e.g. apt-get add the following to /etc/apt/sources.list:
deb file:///data/repository binary/ deb-src file:///data/repository source/
Downgrading a package
To install a particular version of a package:
sudo apt-get install packagename=version
Older versions of packages can be found for example at http://snapshot.debian.net.
Typical errors
When you use packages from third-parties that are not official part of a distribution it's likely that you run into errors. For instance:
sudo apt-get install … … dpkg: error processing packageX.deb (--unpack): trying to overwrite …, which is also in package … dpkg-deb: subprocess paste killed by signal (Broken pipe) Errors were encountered while processing: packageX.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
If you know what you're doing (ie. that this isn't a serious issue) you can work around as:
dpkg -i --force-overwrite packageX.deb
Comments
Post new comment