Ubuntu下E: Sub-process /usr/bin/dpkg returned an error code (2)解决办法

版权声明:本文为博主原创文章,转载请注明出处:https://blog.csdn.net/qq_31261509 https://blog.csdn.net/qq_31261509/article/details/88352065

前言

使用ubuntu粗略算起来已经两三年了,出现这种问题还是头一次遇到,于是记录下来
非常感谢此博主让我解决了code[2]错误

错误


  • 出现了这种错误
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找不到,需要我们解决这个问题。

解决办法


  • 查找损坏的包,并 status 里移除他的信息。
sudo gedit /var/lib/dpkg/status

假如报linux-libc-dev错误,则删除如下内容:

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.
    1. 重命名,备份原来的 info 目录
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
  • 建立一个空的 info 目录
sudo mkdir /var/lib/dpkg/info
  • 用 apt-get 更新
sudo apt-get update
  • 重新安装一下包
sudo apt-get -f install

code[1]错误解决方法

猜你喜欢

转载自blog.csdn.net/qq_31261509/article/details/88352065
今日推荐