我正在尝试从 Ubuntu 18 下的另一台计算机在没有互联网的情况下升级 Ubuntu 16 下的计算机。在 Ubuntu16 计算机下我做了:
$ sudo apt-offline set ~/offline-data.sig
然后我使用 .sig 文件切换到 Ubuntu18 并尝试使用 apt-offline 但在尝试下载软件包时出现此错误:
$ apt-offline get -d ./OfflineUpgrade/ offline-data.sig
Fetching APT Data
Traceback (most recent call last):
File "/usr/bin/apt-offline", line 28, in <module>
main()
File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 2211, in main
args.func(args)
File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 1135, in fetcher
(ItemURL, ItemFile, ItemSize, ItemChecksum) = stripper(item)
File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineCoreLib.py", line 814, in stripper
item1 = ''.join(item[1])
IndexError: list index out of range
我的离线数据.sig 如下所示:
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/InRelease' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_InRelease 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/binary-amd64/Packages.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_binary-amd64_Packages 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/binary-i386/Packages.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_binary-i386_Packages 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/binary-all/Packages.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_binary-all_Packages 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/i18n/Translation-fr_FR.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_i18n_Translation-fr%5fFR 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/i18n/Translation-fr.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_i18n_Translation-fr 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/i18n/Translation-en.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_i18n_Translation-en 0
'https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/main/dep11/Components-amd64.yml.xz' esm.ubuntu.com_infra_ubuntu_dists_xenial-infra-security_main_dep11_Components-amd64.yml 0
我该如何解决这个问题?
答案1
所以,问题来自于 apt-offline 对 .sig 文件的不同写入。在我编写的 Ubuntu 16 中,该文件以几行空白文本结尾:
'http://fr.archive.ubuntu.com/ubuntu/dists/xenial-backports/multiverse/dep11/icons-64x64.tar.xz' fr.archive.ubuntu.com_ubuntu_dists_xenial-backports_multiverse_dep11_icons-64x64.tar 0
Enable UA Infra: ESM to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo ua status
而读取它的 Ubuntu 18 则以整行结束:
'http://at.archive.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/initramfs-tools-bin_0.130ubuntu3.12_amd64.deb' initramfs-tools-bin_0.130ubuntu3.12_amd64.deb 11156 MD5Sum:43c52cbf0447849d6997b454b4fc8d8d
所以删除最后几行就可以了。