sudo: unable to open /var/lib/sudo/username/7: No such file or directory
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.

I can't use gedit and sudo. I'm was trying to edit the status file under /var/lib/dpkg but i failed to do so since it's a read-only file. And having gedit as root doesn't work. Since i was trying to fix the problems because i can't upgrade. I badly need help. Thanks in advance!!

  • Use nano instead. login as root and then do a nano /path/to/file Have you tried that? – Zuko Sep 10 '14 at 4:53
  • 1
    But from that error, Are you sure the file exists at all.? – Zuko Sep 10 '14 at 4:54
  • Please do not ever use [Solved] in a title. Instead, check the box by the solving answer. – Kaz Wolfe Sep 10 '14 at 5:57

You can solve it by booting to a LiveCD and running:

sudo fdisk -l
sudo fsck /dev/sda1

You will be prompted to answer a few questions. yes or y will suffice.

  • If this fixed your problem, you had a corrupted filesystem. Either you shut off incorrectly your PC and have been really unlucky, or your disk is failing. You should check it and have a backup ready. – Rmano Sep 10 '14 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.