0

I downloaded the ubuntu repository using apt-mirror in a system, which I copied to another system to create a repository. Reference 1 - Download a mirror | Reference 2 - Use the repository offline

Although, I omitted step 4 at the time and manually created it at the end to run it which worked fine.

I have an air-gapped system and I cannot use internet on target system.


In the new system, when I do apt get update I receive following output:

Get:1 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:1 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:2 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1,019 kB]
Ign:3 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Get:4 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]
Ign:4 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main Translation-en
Get:5 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata [477 kB]
Ign:5 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata
Get:6 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Ign:6 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons
Get:7 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 64x64 Icons [245 kB]
Ign:7 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 64x64 Icons
Get:8 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [9,184 B]
Ign:8 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages
Get:9 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/restricted Translation-en [3,584 B]
Ign:9 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/restricted Translation-en
Get:10 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
Ign:10 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Get:11 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe Translation-en [4,941 kB]
Ign:11 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe Translation-en
Get:12 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe amd64 DEP-11 Metadata [3,287 kB]
Ign:12 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe amd64 DEP-11 Metadata
Get:13 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe DEP-11 48x48 Icons [2,151 kB]
Ign:13 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe DEP-11 48x48 Icons
Get:14 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe DEP-11 64x64 Icons [8,420 kB]
Ign:14 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/universe DEP-11 64x64 Icons
Get:15 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Ign:15 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
Get:16 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Ign:16 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse Translation-en
Get:17 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse amd64 DEP-11 Metadata [49.7 kB]
Ign:17 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse amd64 DEP-11 Metadata
Get:18 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 48x48 Icons [8,931 B]
Ign:18 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 48x48 Icons
Get:19 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 64x64 Icons [225 kB]
Ign:19 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 64x64 Icons
Get:3 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1,019 kB]
Ign:3 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Get:4 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]
Ign:4 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main Translation-en
Get:5 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata [477 kB]
Ign:5 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata
Get:6 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Err:6 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:118319 [weak]
   - SHA256:72a445c7d354db04d1ffca6f52f7ab66953a3fa889bb66bf6d3210d3ab100f14
   - SHA1:176f580a423a2fcf3e257f0d9a00713e05545a35 [weak]
   - MD5Sum:bdfd4c6a690b2f9d0790443956b327fd [weak]
  Hashes of received file:
  Release file created at: Thu, 26 Apr 2018 23:37:48 +0000
Get:7 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 64x64 Icons [245 kB]
Get:20 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [632 kB]
Ign:20 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
Get:21 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main Translation-en [207 kB]
Ign:21 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main Translation-en
Get:22 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]
Ign:22 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata
Get:23 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]
Ign:23 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons
Get:24 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]
Ign:24 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons
Get:25 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [20.6 kB]
Ign:25 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages
Get:26 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/restricted Translation-en [5,872 B]
Ign:26 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/restricted Translation-en
Get:27 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [643 kB]
Ign:27 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
Get:28 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [216 kB]
Ign:28 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe Translation-en
Get:29 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.1 kB]
Ign:29 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata
Get:30 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]
Ign:30 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons
Get:31 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [116 kB]
Ign:31 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons
Get:32 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [6,328 B]
Ign:32 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages
Get:33 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [2,640 B]
Ign:33 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse Translation-en
Get:34 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Ign:34 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata
Get:35 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse DEP-11 48x48 Icons [29 B]
Ign:35 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse DEP-11 48x48 Icons
Get:36 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse DEP-11 64x64 Icons [2,638 B]
Ign:36 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/multiverse DEP-11 64x64 Icons
Get:20 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [632 kB]
Ign:20 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
Get:21 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main Translation-en [207 kB]
Ign:21 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main Translation-en
Get:22 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]
Ign:22 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata
Get:23 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]
Err:23 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:17563 [weak]
   - SHA256:6099f6c0bf173272db80335785f3b2e92c32f68c983becdac5ca8aa0525a372a
   - SHA1:faee265e503abfc8b5ec9375ec0ab3a1c62291d8 [weak]
   - MD5Sum:a82fe81202d4495e51491800d1d8cbde [weak]
  Hashes of received file:
  Release file created at: Mon, 10 Feb 2020 09:54:14 +0000
Get:24 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]
Reading package lists... Done      
N: Download is performed unsandboxed as root as file '/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu/dists/bionic/InRelease' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
E: Failed to fetch file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu/dists/bionic/main/dep11/icons-48x48.tar.gz  Hash Sum mismatch
   Hashes of expected file:
    - Filesize:118319 [weak]
    - SHA256:72a445c7d354db04d1ffca6f52f7ab66953a3fa889bb66bf6d3210d3ab100f14
    - SHA1:176f580a423a2fcf3e257f0d9a00713e05545a35 [weak]
    - MD5Sum:bdfd4c6a690b2f9d0790443956b327fd [weak]
   Hashes of received file:
   Release file created at: Thu, 26 Apr 2018 23:37:48 +0000
E: Failed to fetch file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu/dists/bionic-security/main/dep11/icons-48x48.tar.gz  Hash Sum mismatch
   Hashes of expected file:
    - Filesize:17563 [weak]
    - SHA256:6099f6c0bf173272db80335785f3b2e92c32f68c983becdac5ca8aa0525a372a
    - SHA1:faee265e503abfc8b5ec9375ec0ab3a1c62291d8 [weak]
    - MD5Sum:a82fe81202d4495e51491800d1d8cbde [weak]
   Hashes of received file:
   Release file created at: Mon, 10 Feb 2020 09:54:14 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.

My sources.list has line like this

deb [ arch=amd64 ] file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic universe multiverse main restricted

The path is not on the same drive as OS is.

I did chown -Rv _apt:root /var/cache/apt/lists and /var/apt/archives/partial I also did chmod -Rv 700 /var/apt/archives/partial


Before this error, there was not Icon-48x48.tar file, rather Icon-48x48.tar.gz which I gunzipped

Error:6 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:118319 [weak]
   - SHA256:72a445c7d354db04d1ffca6f52f7ab66953a3fa889bb66bf6d3210d3ab100f14
   - SHA1:176f580a423a2fcf3e257f0d9a00713e05545a35 [weak]
   - MD5Sum:bdfd4c6a690b2f9d0790443956b327fd [weak]
  Hashes of received file:
  Release file created at: Thu, 26 Apr 2018 23:37:48 +0000

The postmirror.sh script was this -

#!/bin/bash

## anything in this file gets run AFTER the mirror has been run
## put your custom post mirror operations in here ( like rsyncing the installer files and running clean.sh automatically )

## Example of grabbing the extra translations and installer files from ubuntu ( note rsync needs to be installed
## and in the path for this example to work correctly )

# NOTE: This script should be run as root

#set -x

DISTS="bionic bionic-security bionic-updates"
TAGS="restricted multiverse universe main"

SOURCE_ROOT=gb.archive.ubuntu.com/ubuntu/dists
TARGET_ROOT=/media/touseef/Seagate1/Tarun/offline_repo/mirror/${SOURCE_ROOT}

for DIST in ${DISTS}
do
  for TAG in ${TAGS}
    do
        echo "Removing ${TARGET_ROOT}/${DIST}/${TAG}/i18n"
        rm -rf ${TARGET_ROOT}/${DIST}/${TAG}/i18n
            echo "Getting i18n folder from http://${SOURCE_ROOT}/${DIST}/${TAG}/i18n/"
            umask o+r,u+rw,g+rw
                wget -P${TARGET_ROOT}/${DIST}/${TAG}  -nH --cut-dirs=4 -r --reject "index.html*" --no-parent http://${SOURCE_ROOT}/${DIST}/${TAG}/i18n/
              done
              done

1
  • I have a local mirror but not the airgap. I occasionally get the hash sum mismatch and when I do, I just rerun sudo apt-mirror 99% of the time that has fixed it. One time I had to wait an hour or so before a rerun fixed it. I suspect it is caused by the non-local mirror being in the process of an update when my script runs. Commented Feb 12, 2020 at 4:53

1 Answer 1

0

Notice the error description promped while processing the update:

Hash Sum mismatch

This means the calculated hash sums of the selected files do not match the hash sums at the Release or Package files at the dist.

By changing one or more files like you mentioned above, the true file hash also changes its value. Therefore you must also edit the relevant lists with the new hash values.

Release files can be found under dist directory (i.e dists/bionic), and package lists (if not manually changed) under repo type (i.e dists/bionic/main/binary-amd64).

Some packages/lists are usually ignored if were not changed comparing to what the OS currently holds (such as main), outdated, irrelevant, or do not actually exist.

A wider explanation about dist hashing: When creating an online and offline repository (web, disk, DoK) - every dist contains those files to specify which packages are availavle and where they exist. Package managers (such as debian-installer) need those values to verify file integrity to avoide damaged/changed files, and to defer them from other files with similar names and locations. The package manager also validates file sizes (including the package list itself).

8
  • What about the case where packages are hit and ignored? Commented Feb 12, 2020 at 10:13
  • There was no proper icon-48x48.tar files but icon-48x48.tar.gz files. So, I gunzipped them. That might explain Hash Sum mismatch. But the case where Get:3 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1,019 kB] Ign:3 file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages happens, I cannot understand. Commented Feb 12, 2020 at 10:15
  • Some packages/lists are usually ignored if were not changed comparing to what the OS currently holds (such as main), outdated, irrelevant, or do not actually exist. [Updated my answer accordingly] By the way: did you know you can wireshark your repo and analyse all the requests / responses while performing an update? This may help with understanding many failures during the process (such as missing files).
    – Pizza
    Commented Feb 12, 2020 at 10:31
  • Everything is being ignored. So, you're saying, I downloaded an irrelevant one? Commented Feb 12, 2020 at 10:35
  • It is hard for me to indicate a specific problem based only by this prompt, and without knowing much about the client itself. one solution might actually be that it was installed with the latest release and updates, or an update was already made post install resulting main packages and translations ignored. Other reason might be a mismatch between actual file locations / details and the content of the release files. Are you able to apt-get a universe deb that does not currently exist on the client?
    – Pizza
    Commented Feb 12, 2020 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .