Apt-offline
Jump to navigation
Jump to search
apt-offline is a tool to manage packages on a remote system that has no direct connection to the internet.
References
Install
First you need to install apt-offline on the offline and proxy systems.
sudo apt-get install apt-offline python-lzma
This usually requires an internet connection, but another solution is to first install the package on the proxy system, then copy the package .deb file from /var/cache/apt/archives into same directory on the offline system. Now install the package on the offline system using apt-get
as usual.
Upprade offline system
- On offline system, generate the reference signature file:
sudo apt-offline set --update --upgrade /path/to/apt.sig # ... OR ...
sudo apt-offline set --update --upgrade --upgrade-type dist-upgrade /path/to/apt.sig
- On proxy system, download the necessary packages:
apt-offline get -d /path/to/download/directory /path/to/apt.sig # ... OR ...
apt-offline get --bundle /download/path/bundle.zip /path/to/apt.sig
Note that apt-offline
will complain if bundle.zip exists already, so a better command to keep in shell history is:
apt-offline get --bundle /download/path/bundle.zip /path/to/apt.sig || rm /download/path/bundle.zip
- Back on offline system, install all the packages:
sudo apt-offline install /path/to/bundle.zip
sudo apt-get upgrade # ... OR ...
sudo apt-get dist-upgrade
Install a package on offline system
- On offline system, generate the reference signature file and request installation of package (here vlc):
sudo apt-offline set --install-package vlc -- /path/to/apt.sig
- On proxy system, download the necessary packages:
apt-offline get --bundle /download/path/bundle.zip /path/to/apt.sig
# ... or better:
apt-offline get --bundle /download/path/bundle.zip /path/to/apt.sig || rm /download/path/bundle.zip
- Back on offline system, install all the packages:
sudo apt-offline install /path/to/bundle.zip
sudo apt-get install vlc
Install build dependencies
This is equivalent of apt-get build-dep neovim/stretch
:
sudo apt-offline set --install-src-packages neovim/stretch --src-build-dep -- /path/to/apt.sig
Troubleshooting
Use --verbose
- Use
--verbose
to troubleshoot errors.
ERROR: FATAL: Something is wrong with the apt system.
- On
ERROR: FATAL: Something is wrong with the apt system.
- Check that given directory exists
- If getting many errors like
ERROR: Failed to unlink /var/lib/apt/lists/partial/...amd64_Packageapt-offline
, try installing package python-lzma [3]. - When downloading source packages, the source package are downloaded in /tmp folder. See console output:
sudo apt-offline install /smb/docs/minashare/MPeeters/apt/bundle.zip
# Proceeding with installation
# Installing src package file terminator_1.90+bzr-1705-1.dsc to /tmp/apt-offline-src-downloads-9342.
# Installing src package file terminator_1.90+bzr-1705.orig.tar.xz to /tmp/apt-offline-src-downloads-9342.
# Installing src package file terminator_1.90+bzr-1705-1.debian.tar.xz to /tmp/apt-offline-src-downloads-9342.
# ...
sudo cp /tmp/apt-offline-src-downloads-9342/* .
sudo apt source terminator
# Reading package lists... Done
# NOTICE: 'terminator' packaging is maintained in the 'Svn' version control system at:
# svn://anonscm.debian.org/python-apps/packages/terminator/trunk/
# Skipping already downloaded file 'terminator_1.90+bzr-1705-1.dsc'
# Skipping already downloaded file 'terminator_1.90+bzr-1705.orig.tar.xz'
# Skipping already downloaded file 'terminator_1.90+bzr-1705-1.debian.tar.xz'
E: Unable to correct problems, you have held broken packages
- If getting error
ERROR: Unable to correct problems, you have held broken packages
, try first to install withaptitude
. Doing so will indicate which packages have a conflict.
- Using
--verbose
, always gives which command failed:
Generating database of package ['clang-6.0'] and its dependencies. VERBOSE: Command is ['/usr/bin/apt-get', '-qq', '--print-uris', 'install', 'clang-6.0'] E: Unable to correct problems, you have held broken packages
- Repeating the last command,
apt-get install clang-6.0
reproduces the same error, and gives additional information.
ERROR: Path for keyring is invalid: /etc/apt/trusted.gpg
- On
ERROR: Path for keyring is invalid: /etc/apt/trusted.gpg
. Must create the missing file [4]:
sudo apt-key exportall | sudo gpg --no-default-keyring --import --keyring /etc/apt/trusted.gp