When running a Debian system (Debian, Ubuntu, Cumulus, …) without internet connection, it cannot receive upgrades with apt update && apt upgrade -y
But with any Debian based system that is online, it is possible to download the required packages and dependencies (!).
Maybe the source for the latest required repository changed. Therefore, it might be needed to update /etc/apt/sources.list
apt-get dist-upgrade
is adding and removing packages if necessary - that doesn't matter on the online system when creating the repository, but it might be important on the offline system:
try on a non-production system first. Using apt-get upgrade
on the offline system will not add nor remove packages but “hold back” (not update) packages that require to add or remove not installed packages.
Create the required directory structure on the online and offline system
mkdir /var/spool/repo-offline mkdir /var/spool/repo-offline/archives mkdir /var/spool/repo-offline/archives/partial mkdir /var/spool/repo-offline/lists mkdir /var/spool/repo-offline/lists/partial mkdir /var/spool/repo-offline/<preferences.d> mkdir /var/spool/repo-offline/<apt.conf.d>
Copy following files from the offline system to /var/spool/repo-offline/ on the online system (note /etc/apt/trusted.gpg.d/ is the whole directory)
/etc/apt/trusted.gpg.d/ /etc/apt/sources.list /etc/apt/trusted.gpg /var/lib/dpkg/status
On the offline system create the file /var/spool/repo-offline/apt.conf
cat > /var/spool/repo-offline/apt.conf APT { Get::Download-Only "false"; }; Dir { /* point to the file containing the current versions */ State "/var/lib/dpkg/"; State::status "status"; /* set cache location */ Cache::archives "/var/spool/repo-offline/archives/"; /* point to the configuration directory */ Etc "/var/spool/repo-offline/"; };
Close cat with <CTRL-d>
On the online system create a similar file /var/local/repo-offline/apt.conf
cat > /var/spool/repo-offline/apt.conf APT { Get::Download-Only "true"; }; Dir { /* point to the file containing the current versions */ State "/var/spool/repo-offline/"; State::status "status"; /* set cache location */ Cache::archives "/var/spool/repo-offline/archives/"; /* point to the configuration directory */ Etc "/var/spool/repo-offline/"; };
Close cat with <CTRL-d>
export APT_CONFIG="</var/spool/repo-offline/apt.conf>" apt-get update apt-get --no-download dist-upgrade
When apt is finished downloading, copy the whole directory /var/local/repo-offline/, except the files apt.conf
and status
to the offline system
export APT_CONFIG="</var/spool/repo-offline/apt.conf>" apt-get check apt-get dist-upgrade