Apt-offline Parsing Error E: Lzma_read Read Error (7) package lists or status file could not be parsed or opened

aptlinuxUbuntuubuntu 18.04updates

Context

I have a old laptop running on Kubuntu 18.04 that I didn't use for a while and want to update using apt-offline. The Laptop cannot be connected to internet.

apt-offline is already installed on the laptop, and functional.

Using the classical process:

# On laptop
apt-offline set update.sig

# On Internet PC
apt-offline get --bundle updates.zip update.sig

# On laptop
apt-offline install updates.zip

Problem

Until here everything seems fine. But ! If I try any apt command after this, I have a Read Error:

# On Offline Laptop
sudo apt-offline set --upgrade upgrade.zip
# Gathering details for the 'upgrade' operation
# E: Lzma_read Read Error (7) 
# E: The package lists or status file could not be parsed or opened.
# ERROR: FATAL: Something is wrong with the APT system

Almost all APT commands give the same result. (the two E: lines)

I tried to not --bundle in a zip but save packages in a directory, but same problems.

Source of the Problem

After some digging, it seems that files are correctly formatted, but my guts told me to check the change-log of apt-offline. And… what I didn't find… See below:

> 1.8.2-1
> Superseded in sid-release on 2020-04-30
# (...) skip to line 30
  * Switch to 3.0 (quilt) source format
  * Update debian/gbp.conf about switch to 3.0 (quilt) source format

So my guess, is that they changed the format of the apt sources files. Unfortunately, I didn't see any backward compatibility in the man.

Foreseen Solutions

I see a few options here :

  1. Use a converter to convert the new file format to the old one
  2. Manually install a new version of apt on the offline laptop so its supports the new syntax
  3. Find a way to tell apt-offline to save as old file format
  4. Install a old version of apt-offline on my internet PC

Questions

I would like to know what you think about it.

  • A) Do you think my hypothesis (See 'Source of the problem') seems correct ?
    • Any other explanations you think possible ?
  • B) What option would be the safest / fastest ?

Best Answer

Solution #4

Protocol

So I have tried to following protocol :

  1. Download old version of apt-offline (v.1.8.1) Here
  2. sudo apt remove apt-offline
  3. sudo dpkg -i apt-offline_1.8.1_all.deb
  4. Repeat the process of updating
    1. Online PC: apt-offline get update.sig --bundle updates.zip
    2. Offline: sudo apt-offline install updates.zip
  5. Install upgrades
    1. Offline: sudo apt-offline set upgrade.sig --upgrade
    2. Online PC: apt-offline get upgrade.sig --bundle upgrades.zip
    3. Offline: sudo apt-offline install upgrades.zip
    4. Offline: sudo apt upgrade --no-download

Result

No errors where displayed while doing the apt-offline set --upgrade.

One Error, non-fatal, occured during the apt-offline get related to the Thread. See below.

Conclusion : I consider the solution #4 successful, as the download of the updates was succesful.

Traceback (most recent call last):
  File "/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 1360, in fetcher
    ConnectThread.stopQueue(0.2)
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineLib.py", line 674, in stopQueue
    if not thread.isAlive():
AttributeError: 'Thread' object has no attribute 'isAlive'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 13, in <module>
    import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
  File "/usr/lib/python3.9/imp.py", line 31, in <module>
    warnings.warn("the imp module is deprecated in favour of importlib; "
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

Original exception was:
Traceback (most recent call last):
  File "/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 1360, in fetcher
    ConnectThread.stopQueue(0.2)
  File "/usr/lib/python3/dist-packages/apt_offline_core/AptOfflineLib.py", line 674, in stopQueue
    if not thread.isAlive():
AttributeError: 'Thread' object has no attribute 'isAlive'
Related Question