我下载了一个系统中使用的 ubuntu 存储库apt-mirror
,然后将其复制到另一个系统以创建存储库。参考1-下载镜像|参考 2 - 离线使用存储库
虽然,我当时省略了步骤 4 并在最后手动创建它以运行它,效果很好。
我有一个空气间隙系统,我无法在目标系统上使用互联网。
在新系统中,当我执行 apt get update 时,我收到以下输出:
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.
我的 sources.list 有这样的行
deb [ arch=amd64 ] file:/media/tarun/Channel_2/offline_repo/mirror/in.archive.ubuntu.com/ubuntu bionic universe multiverse main restricted
该路径与操作系统不在同一驱动器上。
我做到了chown -Rv _apt:root /var/cache/apt/lists
,/var/apt/archives/partial
我也做到了chmod -Rv 700 /var/apt/archives/partial
在此错误之前,没有Icon-48x48.tar
文件,而是 Icon-48x48.tar.gz
我gunzip
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
postmirror.sh 脚本如下:
#!/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
请注意处理更新时提示的错误描述:
Hash Sum mismatch
这意味着所选文件的计算哈希值与发行版或软件包文件的哈希值不匹配。
通过更改一个或多个文件(如您上面提到的),真实文件哈希值也会改变。因此,您还必须使用新的哈希值编辑相关列表。
可以在 dist 目录(即 dists/bionic)下找到发布文件,并在 repo 类型(即 dists/bionic/main/binary-amd64)下找到包列表(如果没有手动更改)。
如果与操作系统当前包含的内容(例如主要内容)相比没有变化、过时、不相关或实际上不存在,则通常会忽略某些包/列表。
关于 dist 哈希的更广泛解释:创建在线和离线存储库(Web、磁盘、DoK)时 - 每个 dist 都包含这些文件来指定哪些包可用以及它们位于何处。包管理器(例如 debian-installer)需要这些值来验证文件完整性,以避免文件损坏/更改,并将它们与具有相似名称和位置的其他文件区分开来。包管理器还会验证文件大小(包括包列表本身)。