Score:0

Recovering from a failed update

sa flag

strong textI have been running a stable installation of 18.04.02 Desktop for about 30 months. The server wasn't powered on for about 2 weeks so when powered on this morning it went through its automatic security updates. After they had finished I ran the update manager and got these error messages

Evidently the packages are inconsistent. I have checked by running "sudo nano /etc/apt /sources.list" that I haven't got any third party repositories. At least I think so.

Is there anyway I can revert to a consistent set of packages. No I do not have a recent backup. I have of course followed the suggestions in the error message

EDITED in response to comment. Output from apt-get install -f

Your Hardware Enablement Stack (HWE) is supported until April 2023.
Last login: Mon Sep 27 15:38:50 2021 from 192.168.1.96
stephen@leia:~$
stephen@leia:~$ sudo apt-get install -f
[sudo] password for stephen:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  linux-hwe-5.4-headers-5.4.0-77
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libwebkit2gtk-4.0-37
Suggested packages:
  libwebkit2gtk-4.0-37-gtk2
The following packages will be upgraded:
  libwebkit2gtk-4.0-37
1 to upgrade, 0 to newly install, 0 to remove and 24 not to upgrade.
1 not fully installed or removed.
Need to get 0 B/13.4 MB of archives.
After this operation, 81.9 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 264170 files and directories currently installed.)
Preparing to unpack .../libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb ...
Unpacking libwebkit2gtk-4.0-37:amd64 (2.32.4-0ubuntu0.18.04.1) over (2.32.3-0ubuntu0.18.04.1) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5' to '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
 /var/cache/apt/archives/libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
stephen@leia:~$

The machine appears to be stable but now cannot updated. Is it a hopeless cause?

Thanks for any help

Error message

ChanganAuto avatar
us flag
Run `sudo apt update && sudo apt full-upgrade`
user535733 avatar
cn flag
If that set of commands does not fix the problem, then [edit your question](https://askubuntu.com/posts/1366066/edit) to show us the complete output of those commands.
pLumo avatar
in flag
Seems you have a corrupt download. Try running: `sudo apt clean && sudo apt update && sudo apt install -f`. See also [here](https://askubuntu.com/questions/519867/upgrading-firefox-fails-lzma-error-compressed-data-is-corrupt).
Score:4
cn flag

Your output has the information you need to solve the problem:

cannot copy extracted data for './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5' to '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5.dpkg-new':unexpected end of file or stream

Let's abstract that a little for easier understanding...

cannot copy extracted data for X to Y:unexpected end of file or stream

X = './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5'
Y = '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5.dpkg-new'

What does it mean?

"unexpected end of file or stream" means exactly what it says - the package is incomplete or corrupt. You must trash it from your local cache and let apt download a new, fresh, complete copy of the package.

Which package?

Let's ask apt that question, using the path provided by X:

  • The package name is on the second line: libwebkit2gtk-4.0-37
$ dpkg -S /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37
libwebkit2gtk-4.0-37:amd64: /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37

How do I delete the corrupt local package and download a fresh new copy?

$ sudo apt clean libwebkit2gtk-4.0-37                 // Delete local
$ sudo apt update
$ sudo apt install --reinstall libwebkit2gtk-4.0-37   // Download fresh
TalkingCatPhotos avatar
sa flag
I'd like to thank everyone who helped me. The problem is now resolved. The solution that worked for me was executing sudo apt full-upgrade which had the effected downloading the fresh copy of the corrupted package followed by sudo apt upgrade. Thanks particularly to user535733 who explained the theory of it
Score:1
sa flag

The solution that worked for me was executing sudo apt full-upgrade which had the effect of downloading the fresh copy of the corrupted package followed by sudo apt upgrade

ChanganAuto avatar
us flag
There's no point in running `apt upgrade` after `apt full-upgrade`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.