web-dev-qa-db-ja.com

パッケージ 'package'のファイルリストファイルに最後の改行がありません

この問題を解決するには、次のコマンドを実行しました

Sudo mv /var/lib/dpkg/info/<package name>.* /var/www
Sudo apt-get install <package name>

しかし、以下のコマンドを使用して新しいパッケージをインストールまたはアップグレードしようとすると、他のパッケージでエラーが発生します。

この問題の原因は何でしたか、またどのように解決できますか?

$ Sudo apt-get dist-upgrade
dpkg: warning: files list file for package 'libexpat1:AMD64' missing;
 assuming package has no files currently installed
dpkg: warning: files list file for package 'base-passwd' missing;
 assuming package has no files currently installed
dpkg: warning: files list file for package 'bash' missing;
 assuming package has no files currently installed
dpkg: warning: files list file for package 'debconf' missing;
 assuming package has no files currently installed
dpkg: warning: files list file for package 'dash' missing;
 assuming package has no files currently installed   
dpkg: warning: files list file for package 'coreutils' missing;
 assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing;
 assuming package has no files currently installed
dpkg: warning: files list file for package 'software-properties-common' missing;
 assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting: 
 files list file for package 'libcap-ng0:AMD64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
$ Sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  lxd lxd-client open-iscsi openssl tmux tzdata unattended-upgrades
7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/9806 kB of archives.
After this operation, 604 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
dpkg: warning: files list file for package 'libexpat1:AMD64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'base-passwd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'bash' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'debconf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'dash' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'coreutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'base-files' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'diffutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'ncurses-bin' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'software-properties-common' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'libcap-ng0:AMD64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
$ Sudo apt-get install --reinstall base-passwd
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
Need to get 0 B/47.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Preconfiguring packages ...
dpkg: warning: files list file for package 'libexpat1:AMD64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'base-passwd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'bash' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'debconf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'dash' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'coreutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'base-files' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'diffutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'ncurses-bin' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'software-properties-common' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'libcap-ng0:AMD64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
$ Sudo chmod -R a+r /var/lib/dpkg/info
$ cd /var/lib/dpkg/info
/var/lib/dpkg/info$ Sudo mv libcap-ng0\:AMD64.
libcap-ng0:AMD64.list      libcap-ng0:AMD64.md5sums   libcap-ng0:AMD64.shlibs    libcap-ng0:AMD64.triggers
/var/lib/dpkg/info$ Sudo mv libcap-ng0\:AMD64.
libcap-ng0:AMD64.list      libcap-ng0:AMD64.md5sums   libcap-ng0:AMD64.shlibs    libcap-ng0:AMD64.triggers
/var/lib/dpkg/info$ Sudo mv libcap-ng0\:AMD64.* /var/www/html/
/var/lib/dpkg/info$ Sudo apt-get install --reinstall libcap-ng0:AMD64
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
Need to get 11.1 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu bionic/main AMD64 libcap-ng0 AMD64 0.7.7-3.1 [11.1 kB]
Fetched 11.1 kB in 0s (39.2 kB/s)
dpkg: warning: files list file for package 'libexpat1:AMD64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'base-passwd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'bash' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'debconf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'dash' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'coreutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'base-files' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'diffutils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libcap-ng0:AMD64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'ncurses-bin' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'software-properties-common' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'libcom-err2:AMD64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

/ var/lib/dpkg/infoフォルダーからlibcap-ng0:AMD64ファイルを削除し、後で再インストールしようとしましたが、他のパッケージにエラーが発生し、libcap-ng0に警告が表示されました。
残りのパッケージでも同じように発生しました

1
insoftservice

From: apt-get dpkg error:files list file ... missing final newline-LinuxQuestions.org

まあ、freenodeの#debianからの大きな助けを借りて、私は解決策を見つけました(justinに感謝します!!):

ファイル/ var/lib/dpkg/info/smbfs.listが壊れていました、それはすべてでしたバイナリクラップ。ダンノはこれがどのように起こり得るか、しかしそれはそうでした。ジャスティンはファイルを削除するようにアドバイスしました(実際には移動しました)-そして出来上がり、aptはsmbfsのファイルリストが見つからなかったと警告しましたが、少なくともapt-get remove smbfs --purgeを再インストールします(apt-get install smbfs)-それはビスケットを取りました!

2
Ben