6

I have an old problem (since a week) with apt-get which prevents me from installing and upgrading packages. I have Ubuntu 16.04.

I am receiving this message on the top bar:

Error: opening the cache (E: Read error - read (5: Input/output error))

When I type on the terminal: sudo apt-get update, nothing goes wrong and it was completed successfully.

However, when I type sudo apt-get upgrade or sudo apt get install , I get this output:

Reading package lists...    
Done Building dependency tree           
Reading state information... Error! E: Read error - read (5: Input/output error)

I have tried to delete the /var/lib/dpkg/status file and then update, but nothing change!

Byte Commander
  • 107,489

2 Answers2

10

Try this please as a last possible solution. Open a terminal and type these commands:

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

If this doesn't work either, then the hard disk problem is the most probable cause for this message unfortunately.

Stormlord
  • 6,317
  • These commands are harmless, so no need to call them "last possible solution". But the error message does not suggest anything which could be fixed this way. – Byte Commander Jul 24 '16 at 17:13
  • Yes, you're right. It just eliminates the possibility of file corruption. Nothing else. – Stormlord Jul 24 '16 at 17:22
  • Corrupt file content would produce a different error. If this method magically solved the issue, it would probably be because the file which causes read errors got recreated in a different, not defect sector on the disk. That way you do not fix the root cause though but only hide it and wait for it to bite you more severely. – Byte Commander Jul 24 '16 at 17:27
  • The main reason why I proposed these commands was the fact that the guy does not state anywhere that he gets similar error messages from other apps too or that their system gives errors while starting etc. They gave me the impression that only apt-get produces error messages. – Stormlord Jul 24 '16 at 18:05
  • Worked for me! No issues afterwards. – GTodorov Oct 30 '17 at 21:47
  • it worked for me! but i'm worried about the question answer serious disk failure.. do i still need to change my hard drive? as byte commander pointed.. – Ali Aref Jul 05 '21 at 05:00
7

This read/input-output error indicates serious disk failure!

Back up all important data immediately and look for a new hard disk.


You can find out more details about your disk health by checking its S.M.A.R.T. status.

Open gnome-disks, select your HDD in the device list on the left and click the hamburger menu in the top right corner. Chose SMART Data & Self-Tests to view the information.

Byte Commander
  • 107,489
  • Actually it is a new laptop (just 4 weeks of using) which I have bought and then I replaced Its windows OS with ubuntu 16 :( – mohammed Jul 24 '16 at 16:30
  • As mentioned, check its SMART status and maybe run some of the offered self-tests. That will assure you whether it is a disk failure (very likely) or not. – Byte Commander Jul 24 '16 at 18:07
  • I have opened the Disk app, and the assessment tells that: Disk is OK, 125 bad sectors. – mohammed Jul 24 '16 at 18:11
  • Then you should run the self-tests. They're in the lower right corner of the SMART results window. – Byte Commander Jul 24 '16 at 18:20
  • +1 from me; I got this after copying all data from a known-failing disk to a new one. Together with the other answer and a bit of DIY file fixing I got it to a state where it now seems to work fine again. – dascandy Aug 25 '19 at 22:09