Home Linux troubleshooting How To Fix “dpkg-deb: lzma error: compressed data is corrupt” Error In Debian 12 And Ubuntu Linux

How To Fix “dpkg-deb: lzma error: compressed data is corrupt” Error In Debian 12 And Ubuntu Linux

By sk
435 views

If you're running Debian 12 and come across the error related to dpkg-deb failing due to a corrupted package during an update, don't worry! This is a fairly common issue that can easily be fixed. In this blog post, we'll walk you through simple steps to resolve this error and get your system back on track.

The Problem

The error message might look something like this:

[...]
Unpacking libreoffice-common (4:24.8.2-1~bpo12+1) over (4:24.2.6-2~bpo12+1) ...
dpkg-deb (subprocess): decompressing archive '/var/cache/apt/archives/libreoffice-common_4%3a24.8.2-1~bpo12+1_all.deb' (size=19330668) member 'data.tar': lzma error: compressed data is corrupt
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_4%3a24.8.2-1~bpo12+1_all.deb (--unpack):
cannot copy extracted data for './usr/lib/libreoffice/share/template/common/presnt/Freshes.otp' to '/usr/lib/libreoffice/share/template/common/presnt/Freshes.otp.dpkg-new': unexpected end of file or stream
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
Errors were encountered while processing:
/var/cache/apt/archives/libreoffice-common_4%3a24.8.2-1~bpo12+1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
lzma error compressed data is corrupt
lzma error compressed data is corrupt

This occurs when the package manager (dpkg) encounters a corrupted .deb file. In this case, the problem is with the LibreOffice package, but the solution applies to other packages too.

Step-by-Step Guide to Fixing "dpkg-deb: lzma error: compressed data is corrupt"

1. Clean the APT Cache

The first step is to clean out the APT cache, where the corrupted package is stored. You can do this by running:

sudo apt clean

This command removes all .deb files from /var/cache/apt/archives, including any corrupted files that may have been downloaded.

2. Update the Package List

Once the cache is cleaned, you’ll want to make sure your system’s package list is up-to-date. This will ensure that you're working with the latest package information:

sudo apt update

3. Upgrade the Packages

After updating the package list, try upgrading your packages. This will attempt to download and install the latest versions:

sudo apt upgrade

If the corrupted package is still causing issues, don't worry—there’s one more step that should solve the problem.

4. Fix Broken Packages

If you still encounter errors after running the above commands, you can use the following command to fix broken dependencies:

sudo apt --fix-broken install

Or shortly:

sudo apt install -f

This command will re-download and reinstall the problematic package, fixing any issues with corrupted files or dependencies.

Conclusion

If you encounter the "dpkg-deb: lzma error: compressed data is corrupt" error on Debian 12 or any Ubuntu versions, following the above steps will help you fix it. Start by cleaning the cache and updating your package list, then upgrade your packages. If that doesn’t work, use the --fix-broken (-f) option to repair any corrupted files or broken dependencies.

Solutions to other common problems in Debian and Ubuntu:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More