尝试更新和升级 Ubuntu 16.04 LTS 时出错

尝试更新和升级 Ubuntu 16.04 LTS 时出错

尝试使用更新后sudo apt update我得到

Hit:1 http://gb.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://gb.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]                                                                                                
Hit:3 http://archive.canonical.com/ubuntu xenial InRelease                                                                                                                 
Hit:4 http://ppa.launchpad.net/maarten-baert/simplescreenrecorder/ubuntu xenial InRelease                                                                                  
Ign:5 http://archive.canonical.com/ubuntu trusty InRelease                                                                                                                                                 
Hit:6 http://archive.canonical.com/ubuntu trusty Release                                                                                                                                                   
Hit:7 http://repository.spotify.com stable InRelease                                                                                                                                                       
Hit:8 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease                                                                                                                                    
Get:9 http://gb.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Ign:11 http://download.ebz.epson.net/dsc/op/stable/debian lsb3.2 InRelease                                           
Hit:12 http://download.ebz.epson.net/dsc/op/stable/debian lsb3.2 Release
Fetched 306 kB in 2s (129 kB/s)                    
Reading package lists... Error!
W: http://download.ebz.epson.net/dsc/op/stable/debian/dists/lsb3.2/Release.gpg: Signature by key E5220FB7014D0FBDA50DFC2BE5E86C008AA65D56 uses weak digest algorithm (SHA1)
E: Read error - read (5: Input/output error)
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted

再次运行这个我得到

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

我运行sudo dpkg --configure -a并且没有出现任何错误

然后sudo apt upgrade结束于

....
....
Get:91 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 unity-control-center-faces all 15.04.0+16.04.20170214-0ubuntu2 [180 kB]                                                               
Get:92 http://gb.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 va-driver-all amd64 1.7.0-1ubuntu0.1 [4,534 B]                                                                                    
Get:93 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 xul-ext-ubufox all 3.4-0ubuntu0.16.04.2 [3,302 B]                                                                                     
Fetched 255 MB in 19s (12.8 MB/s)                                                                                                                                                                          
Extract templates from packages: 100%
Preconfiguring packages ...
dpkg: unrecoverable fatal error, aborting:
 reading files list for package 'libsm6:i386': Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)

有一些重大修复,例如但如果没有进一步的建议,我不会尝试删除系统文件。

答案1

sudo apt get update幸运的是,这不是更换硬盘的问题,有些人建议更换硬盘。首先删除导致错误的步骤

E: Read error - read (5: Input/output error)
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted

被找到这里并包括运行

sudo rm /var/lib/apt/lists/* -vf
sudo apt-get clean
sudo apt-get update

sudo apt-get upgrade然后删除运行时显示的错误

dpkg: unrecoverable fatal error, aborting:
 reading files list for package 'libsm6:i386': Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)

听从建议这里即备份该文件并对其进行编辑,以删除与该包/var/lib/dpkg/status相关的块。libsm6:i386请注意,有一个与 amd64 版本相关的块不应被删除。 所以

sudo cp /var/lib/dpkg/status{,.backup}
sudo vim /var/lib/dpkg/status

删除此块

Package: libsm6
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 66
Maintainer: Ubuntu Developers <[email protected]>
Architecture: i386
Multi-Arch: same
Source: libsm
Version: 2:1.2.2-1
Depends: libc6 (>= 2.4), libice6 (>= 1:1.0.0), libuuid1 (>= 2.16)
Pre-Depends: multiarch-support
Description: X11 Session Management library
 This package provides the main interface to the X11 Session Management
 library, which allows for applications to both manage sessions, and make use
 of session managers to save and restore their state for later use.
 .
 More information about X.Org can be found at:
 <URL:http://www.X.org>
 .
 This module can be found at
 git://anongit.freedesktop.org/git/xorg/lib/libSM
 Original-Maintainer: Debian X Strike Force <[email protected]>

保存并重新运行

sudo apt-get -f install
sudo apt-get update 
sudo apt-get upgrade

相关内容