E: sub process / usr / bin / dpkg returned an error code (2) solution under Ubuntu

It has been roughly two or three years with ubuntu, and this is the first time I have encountered this problem, so I wrote down
. Thank you very much for letting me solve the code[2] error

This error occurred

dpkg: unrecoverable fatal error, aborting:
 files list file for package 'linux-libc-dev:amd64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

Linux-libc-dev: AMD64 cannot be found, we need to fix this problem.
The solution

Find the damaged package and remove its status.

sudo gedit /var/lib/dpkg/status

If a Linux-LIBc-dev error is reported, delete the following:

Package: linux-libc-dev
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 5077
Maintainer: Ubuntu Kernel Team <[email protected]>
Architecture: amd64
Multi-Arch: same
Source: linux
Version: 4.15.0-46.49
Replaces: linux-kernel-headers
Provides: aufs-dev, linux-kernel-headers
Conflicts: linux-kernel-headers
Description: Linux Kernel Headers for development
 This package provides headers from the Linux kernel.  These headers
 are used by the installed headers for GNU glibc and other system
 libraries. They are NOT meant to be used to build third-party modules for
 your kernel. Use linux-headers-* packages for that.
    rename, backup the original info directory
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old

Create an empty Info directory

sudo mkdir /var/lib/dpkg/info

Use apt – get updated

sudo apt-get update

Reinstall the package

sudo apt-get -f install

Code [1] Error resolution

Read More: