apt-offline get : IndexError: 列表索引超出範圍

apt-offline get : IndexError: 列表索引超出範圍

我正在嘗試從 Ubuntu 18 下的另一台電腦在沒有網路的情況下升級 Ubuntu 16 下的電腦。

$ 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

所以刪除最後幾行就可以了。

相關內容