For a system connected to internet, Apt works great in handling an application and its dependencies. However updating an application on a system disconnected to internet is kinda difficult. In this article, we will see how to update Debian offline using terminal and GUI.
Internet is easily available and cheap these days. However, sometimes we do get into a situation where an offline system needs to be updated. Sometimes your secondary system is too old to be connected to your Wi-Fi like my 8 years old Lenovo running on a 1GB of RAM and with 80GB storage.
Although you can always download the software, transfer it on the disconnected system and use dpkg to install it, it would be a pain to manually create the list of applications and finding out which of them really needs an update! Even if you manage to do so, handling dependencies is another pain.
Apt-offline does just exactly this for you. It creates a APT database for the system/application which requires upgrade/update. You can then use a system connected to internet to download these along with dependencies and later install on the disconnected system. To update Debian offline, we can call apt-offline an apt solution! This works for any other Debian based system equally well.
In this article, we will see how you can install apt-offline on a connected and disconnected system and how to update a Debian based system offline using apt-offline.
Before we begin, I must tell you apt-offline is available in both terminal and GUI format. We are discussing both of them to update Debian offline, choose whichever suits you better. It’s always better to back up your Linux system before any major upgrades.
Terminal Way to update Debian offline
Installation
For the system connected to internet, use the below command to install apt-offline.
sudo apt-get install apt-offline
For the offline system, download a .deb package from https://pkgs.org/download/apt-offline and install it via any package manger or below terminal commands.
sudo dpkg -i apt-offline_1.
X.X_all.deb
Replace X.X with the downloaded version.
How to use it
The steps include generating a signature on your disconnected device and then using the signature file on a online system to download the updates / upgrades and dependencies.
Generating a signature file on the disconnected system
Navigate to /tmp (not mandatory, any directory will do) and use below command to generate the signature file.
sudo apt-offline set /tmp/apt-offline.sig
This will generate the required information which apt needs to update the system. If no arguments passed, it generated the information for both update and upgrade. You can individually pass the below arguments if you wish so.
--upgrade
--update
Downloading packages on a connected device
Once you have the signature file, you can copy it using a removable media or USB onto a system which is connected to internet.
Let us suppose you have put it under /tmp directory. Use below command to download the packages on the online system.
sudo apt-offline get /tmp/apt-offline.sig --threads 5
Updating offline system
Now connect back the USB device to the offline system and use below command
sudo apt-offline install /media/USB/apt-offline.zip
This will update the APT database.
Using apt-offline GUI to update your Debian system
Installation
If you are not a fan of command line, you can use this GUI method. You would have to install the GUI in both the connected and offline system.
sudo apt-get install apt-offline-gui
And download the copy from https://pkgs.org/download/apt-offline-gui to install it on the disconnected device using any package manager or use below command.
sudo dpkg -i apt-offline-gui_1.
X.X_all.deb
Replace X.X with the downloaded version.
You can launch it from the terminal or search it under installed applications.
How to use it
On the offline system, launch the application and click on Generate Signature . Once it’s generated, copy the file to a system connected to internet using USB drive.
Launch the application again and click on Download Packages or Updates. It will ask you to select the signature file and give the filename to save data as. One done, click on Download and let it complete.
Now, move the file to disconnected system and click on Install Packages or Updates. It would ask you to browse the file which we created during the download. Select it and continue with Install.
This will update and install all the Apt database applications on your offline system.
Wrapping up
Apt-offline is a great tool for those who either cannot afford a fast internet or has limited bandwidth and can use friends / workplace internet or has a very old system which is difficult to connect to internet.
You can use the above method to update your system and the dependencies. Let us know what you think about it in the comments.
zanrek
apt-offline seems very… buggy… or deprecated.
I used it the entire last week to update a full offline machine using Ubuntu focal, and this is a real pain! 2 identical machines : same hardware, same OS, one with internet, one with not. Impossible to make it work. How can something that simple becomes so hard?
Forums do not really help. Lots of cryptic errors, difficulties to update the sources.list, lots of bad URLs. I am afraid linux is now for internet connected machines only. When you are going to ask about “offline” problems, no one seems to know (or even understand) that internet is not available on every machine… The best example is… installing apt-offline wich does not come standalone and requires dependancies… How ironic!
Ambarish Kumar
Hi Zanrek
Yes, it’s old and having an internet connection is considered a default these days. I will revisit this article!
jayson
The hard part is the dependency hell you get into when you find that apt-offline depends on packages that depend on other packages which requires a hackish script to find them all.
Shirisha
I have a Ubuntu machine without a network connection. When I am trying to install the apt-offline.deb package it is complaining that python is not available.
Do I need to connect the machine to the at least once the internet to install the dependencies of apt-offline? Can’t we perform the apt-offline package installation without connecting to the internet at all?
My problem is that my offline machine user doesn’t want to connect to the internet and need few packages to be installed without the internet.
Any help would be great.
Thanks.