Score:1

Can't install any package: "package linux-image-5.4.0-42-generic is missing final newline"?

cx flag

I tried to install some package updates on my Ubuntu 20.04.5, but everything fails with:

dpkg: unrecoverable fatal error, aborting:
 files list file for package 'linux-image-5.4.0-42-generic' is missing final newline

How would I resolve this?

Here is the example I tried:

> sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
Try Ubuntu Pro beta with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro
The following NEW packages will be installed:
  linux-headers-5.15.0-52-generic linux-hwe-5.15-headers-5.15.0-52 linux-image-5.15.0-52-generic linux-modules-5.15.0-52-generic linux-modules-extra-5.15.0-52-generic
The following packages will be upgraded:
  code docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin git git-man gitk gthumb gthumb-data libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal
  libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libkrb5-26-heimdal libksba8 libroken18-heimdal libwind0-heimdal linux-generic-hwe-20.04
  linux-headers-generic-hwe-20.04 linux-image-generic-hwe-20.04 linux-libc-dev unzip zlib1g zlib1g:i386 zlib1g-dev
28 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
23 standard LTS security updates
Need to get 0 B/286 MB of archives.
After this operation, 606 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Extracting templates from packages: 100%
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'linux-image-5.4.0-42-generic' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
(base)  ~

David avatar
cn flag
What is Ubuntu 22. There are 3 different versions that could be. Ubuntu Core 22, Ubuntu 22.04 and Ubuntu 22.10 You need an accurate version number in your question.
cx flag
David, it's 20.04.5, updated the question.
Terrance avatar
id flag
Have you tried to just reinstall the kernel package that it is asking for? `sudo apt install --reinstall linux-image-5.4.0-42-generic`
cx flag
Yes, I tried, but got the same error.
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.