debmirror 在尝试下载软件包时一直挂起

debmirror 在尝试下载软件包时一直挂起

我有一个本地发行版镜像,我已将其设置为受支持的 Ubuntu LTS 版本(18.04、20.04 和 22.04)。但是当我运行 debmirror 与 gb.archive.ubuntu.com 同步时,它总是停在一个包上,不再继续。如果我停止并重新启动 debmirror,它会再次停在同一个包上。如果我手动下载该包并重新启动 debmirror,它会继续前进,但然后停在另一个包上。我看不出有问题的包有什么特别之处。它们不一定特别大。但它让我很头疼!近一周来,我一直在尝试获取全套软件包。到目前为止,它一直运行良好,但从我放弃 16.04 并添加 22.04 时开始出现这种情况。

答案1

查看https://help.ubuntu.com/community/Debmirror

它有一个脚本,我经常使用它来维护我工作场所使用 debmirror 的 ubuntu 镜像。您使用的是 gb.archive.ubuntu.com,但那里的脚本只指定 archive.ubuntu.com,它就可以工作(已经使用了 2 年)。我仅使用 http 下载 amd64 的软件包(大约需要一天左右),然后我使用 rsync 来纠正使用 http 下载时出现的任何故障。

为了您的方便,我已将上述链接中的脚本复制粘贴到下面:

#### Start script to automate building of Ubuntu mirror #####
## THE NEXT LINE IS NEEDED THE REST OF THE LINES STARTING WITH A # CAN BE DELETED

#!/bin/bash

## Setting variables with explanations.

#
# Don't touch the user's keyring, have our own instead
#
export GNUPGHOME=/opt/UbuntuMirror/mirrorkeyring

# Arch=         -a      # Architecture. For Ubuntu can be i386, powerpc or amd64.
# sparc, only starts in dapper, it is only the later models of sparc.
# For multiple  architecture, use ",". like "i386,amd64"

arch=amd64

# Minimum Ubuntu system requires main, restricted
# Section=      -s      # Section (One of the following - main/restricted/universe/multiverse).
# You can add extra file with $Section/debian-installer. ex: main/debian-installer,universe/debian-installer,multiverse/debian-installer,restricted/debian-installer
#
section=main,restricted,universe,multiverse

# Release=      -d      # Release of the system (, focal ), and the -updates and -security ( -backports can be added if desired)
# List of updated releases in: https://wiki.ubuntu.com/Releases
# List of sort codenames used: http://archive.ubuntu.com/ubuntu/dists/

release=focal,focal-security,focal-updates

# Server=       -h      # Server name, minus the protocol and the path at the end
# CHANGE "*" to equal the mirror you want to create your mirror from. au. in Australia  ca. in Canada.
# This can be found in your own /etc/apt/sources.list file, assuming you have Ubuntu installed.
#
server=archive.ubuntu.com

# Dir=          -r      # Path from the main server, so http://my.web.server/$dir, Server dependant
#
inPath=/ubuntu

# Proto=        --method=       # Protocol to use for transfer (http, ftp, hftp, rsync)
# Choose one - http is most usual the service, and the service must be available on the server you point at.
# For some "rsync" may be faster.
proto=http

# Outpath=              # Directory to store the mirror in
# Make this a full path to where you want to mirror the material.
#
outPath=/opt/UbuntuMirror/ubuntu-mirror

# The --nosource option only downloads debs and not deb-src's
# The --progress option shows files as they are downloaded
# --source \ in the place of --no-source \ if you want sources also.
# --nocleanup  Do not clean up the local mirror after mirroring is complete. Use this option to keep older repository
# Start script
#
debmirror       -a $arch \
                --no-source \
                -s $section \
                -h $server \
                -d $release \
                -r $inPath \
                --progress \
                --method=$proto \
                $outPath


#### End script to automate building of Ubuntu mirror ####

相关内容