无法恢复的致命错误,中止:包“tzdata”的文件列表文件缺少最后的换行符

无法恢复的致命错误,中止:包“tzdata”的文件列表文件缺少最后的换行符

我从昨天开始就想到了这个问题

我已经检查了一些现有的帖子,并从中进行了以下操作:

sudo mv /var/lib/dpkg/info/linux* /tmp/mcrose/
sudo dpkg --configure -a
sudo apt-get update
sudo apt-get upgrade

我又遇到了一些问题,所以我跑了

sudo apt-get clean
dpkg --configure -a
sudo apt-get update
sudo apt-get upgrade

然后我收到了这些错误:

mcrose@home:~$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  adobe-flash-properties-gtk adobe-flashplugin budgie-welcome chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg-extra
  gnome-software gnome-software-common gnome-software-plugin-snap libssl1.0.0 libxml2 openssl python-libxml2 ubuntu-fan vivaldi-stable
15 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 147 MB of archives.
After this operation, 47,7 MB of additional disk space will be used.
Get:1 http://py.archive.ubuntu.com/ubuntu zesty-updates/universe amd64 chromium-browser-l10n all 63.0.3239.84-0ubuntu0.17.04.1 [2.640 kB]
Get:2 http://repo.vivaldi.com/stable/deb stable/main amd64 vivaldi-stable amd64 1.13.1008.36-1 [49,3 MB]                                
Get:3 http://archive.canonical.com/ubuntu zesty/partner amd64 adobe-flash-properties-gtk amd64 1:20171212.1-0ubuntu0.17.04.1 [143 kB]
Get:4 http://ppa.launchpad.net/ubuntubudgie/backports/ubuntu zesty/main amd64 budgie-welcome all 0.5.8 [5.084 kB]                       
Get:5 http://archive.canonical.com/ubuntu zesty/partner amd64 adobe-flashplugin amd64 1:20171212.1-0ubuntu0.17.04.1 [9.781 kB]          
Get:6 http://py.archive.ubuntu.com/ubuntu zesty-updates/universe amd64 chromium-browser amd64 63.0.3239.84-0ubuntu0.17.04.1 [73,7 MB]   
Get:2 http://repo.vivaldi.com/stable/deb stable/main amd64 vivaldi-stable amd64 1.13.1008.36-1 [49,3 MB]                                
Get:7 http://py.archive.ubuntu.com/ubuntu zesty-updates/universe amd64 chromium-codecs-ffmpeg-extra amd64 63.0.3239.84-0ubuntu0.17.04.1 [1.010 kB]
Get:8 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 libssl1.0.0 amd64 1.0.2g-1ubuntu11.4 [1.080 kB]                      
Get:9 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 libxml2 amd64 2.9.4+dfsg1-2.2ubuntu0.3 [698 kB]                      
Get:10 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 openssl amd64 1.0.2g-1ubuntu11.4 [491 kB]                           
Get:11 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 gnome-software-plugin-snap amd64 3.22.7-0ubuntu3.17.04.8 [27,5 kB]  
Get:12 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 gnome-software amd64 3.22.7-0ubuntu3.17.04.8 [305 kB]               
Get:13 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 gnome-software-common all 3.22.7-0ubuntu3.17.04.8 [2.481 kB]        
Get:14 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 python-libxml2 amd64 2.9.4+dfsg1-2.2ubuntu0.3 [140 kB]              
Get:15 http://py.archive.ubuntu.com/ubuntu zesty-updates/main amd64 ubuntu-fan all 0.12.8~17.04.1 [34,7 kB]                             
Fetched 134 MB in 18min 22s (121 kB/s)                                                                                                  
Preconfiguring packages ...
dpkg: warning: files list file for package 'linux-sound-base' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-image-extra-4.10.0-42-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-4.10.0-40' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-4.10.0-40' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-base' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-libc-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-4.10.0-19' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-4.10.0-19-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-4.10.0-42-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-4.10.0-42' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-image-extra-4.10.0-40-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-image-4.10.0-42-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-common' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-4.10.0-42-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-4.10.0-40-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-image-4.10.0-40-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-4.10.0-42' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-4.10.0-40-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-tools-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-image-generic' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-firmware' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-headers-generic' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'tzdata' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

我正在使用 Ubuntu Budgie

mcrose@home:~$ cat /etc/issue
Ubuntu 17.04 \n \l
mcrose@home:~$ uname -a
Linux home 4.10.0-42-generic #46-Ubuntu SMP Mon Dec 4 14:38:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
mcrose@home:~$ 

答案1

此命令(重新)删除包元数据,这是一个坏主意:

mv /var/lib/dpkg/info/linux* /tmp/mcrose/

这些文件/var/lib/dpkg是 Debian 包管理器内部状态的一部分,应该被操作dpkg应用程序或库一起使用。通常,不要触碰/var/lib/dpkg 直接地除非你知道真的真的你在做什么呢?


由于包元数据已被删除或损坏,您应该重新安装这些包:

dpkg-query -Wf '${Status;1} ${Package}:${Architecture}\n' 'linux*' tzdata |
sed -ne 's/^i //p' |
xargs -rd '\n' -- sudo apt-get install -f --reinstall

仍有可能dpkg抱怨文件列表格式不正确,tzdata在这种情况下您可以将其完全删除并重试重新安装:

sudo rm /var/lib/dpkg/info/tzdata.*list

我怀疑可能还有更多软件包被损坏。您可以按照以下说明验证其完整性Ubuntu 有健全性检查吗?使用以下命令:

sudo apt-get install debsums
sudo debsums_init
sudo debsums --changed --silent

然后使用以下方法手动重新安装提到的软件包

sudo apt-get -f install

相关内容