0

If I run "sudo apt-get update" I get following error messages

E: Could not open lock file /var/lib/dpkg/lock - open (5: Input/output error)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

here a similar aks-ubuntu:unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process was solved by deleting the lock file (after checking that the problem was not caused by another process "locking" the lock file)

I checked that no other process is having a lock and tried to remove the lock file which gives me

osmc@osmc:/var/lib/dpkg$ sudo rm lock
rm: cannot remove 'lock': Input/output error

also I tried to list all files and permissions:

osmc@osmc:/var/lib/dpkg$ ls -la
ls: cannot access available: Input/output error
ls: cannot access lock: Input/output error
ls: cannot access diversions: Input/output error
ls: cannot access info: Input/output error
ls: cannot access updates: Input/output error
total 680
drwxr-xr-x  7 root root   4096 May 25 17:13 .
drwxr-xr-x 24 root root   4096 May 23 23:46 ..
drwxr-xr-x  2 root root   4096 May 23 23:48 alternatives
-?????????  ? ?    ?         ?            ? available
-rw-r--r--  1 root root      8 May 19 20:25 cmethopt
-?????????  ? ?    ?         ?            ? diversions
-rw-r--r--  1 root root    943 May 19 20:31 diversions-old
d?????????  ? ?    ?         ?            ? info
-?????????  ? ?    ?         ?            ? lock
drwxr-xr-x  2 root root   4096 Apr 15 10:23 parts
-rw-r--r--  1 root root     65 May 19 20:29 statoverride
-rw-r--r--  1 root root      0 May 19 20:24 statoverride-old
-rw-r--r--  1 root root 330290 May 25 17:13 status
-rw-r--r--  1 root root 330290 May 25 17:13 status-old
drwxr-xr-x  2 root root   4096 May 23 23:48 triggers
d?????????  ? ?    ?         ?            ? updates

I thought that maybe the files with question marks are not executable so I tried to make all files in dpkg executable:

osmc@osmc:/var/lib$ sudo chmod -R a+rX dpkg
chmod: cannot access 'dpkg/available': Input/output error
chmod: cannot access 'dpkg/lock': Input/output error
chmod: cannot access 'dpkg/diversions': Input/output error
chmod: cannot access 'dpkg/info': Input/output error
chmod: cannot access 'dpkg/alternatives/rcp': Input/output error
chmod: cannot access 'dpkg/alternatives/mt': Input/output error
chmod: cannot access 'dpkg/alternatives/editor': Input/output error
chmod: cannot access 'dpkg/alternatives/w': Input/output error
chmod: cannot access 'dpkg/alternatives/awk': Input/output error
chmod: cannot access 'dpkg/alternatives/rsh': Input/output error
chmod: cannot access 'dpkg/alternatives/pico': Input/output error
chmod: cannot access 'dpkg/alternatives/lzma': Input/output error
chmod: cannot access 'dpkg/alternatives/builtins.7.gz': Input/output error
chmod: cannot access 'dpkg/alternatives/pager': Input/output error
chmod: cannot access 'dpkg/updates': Input/output error

I also created a test file in that directory to test if there is a general problem of writing to the disk. It worked however...

dmesg gives

  osmc@osmc:~$ dmesg | tail -n 30
[  313.069081] EXT4-fs error (device mmcblk0p2): ext4_iget:3921: inode #136661: comm gmain: bad extra_isize (23520 != 256)
[  317.069236] EXT4-fs error (device mmcblk0p2): ext4_iget:3921: inode #136661: comm gmain: bad extra_isize (23520 != 256)
[  317.921020] EXT4-fs error (device mmcblk0p2): ext4_iget:3921: inode #130830: comm kodi.bin: bad extra_isize (52864 != 256)
[  321.068403] EXT4-fs error (device mmcblk0p2): ext4_iget:3921: inode #136661: comm gmain: bad extra_isize (23520 != 256)
[  325.069286] EXT4-fs error (device mmcblk0p2): ext4_iget:3921: inode #136661: comm gmain: bad extra_isize (23520 != 256)
[  329.069371] EXT4-fs error (device mmcblk0p2): ext4_iget:3921: inode #136661: comm gmain: bad extra_isize (23520 != 256)
.... (further similar errors)

Any ideas how to resolve the problem?

System: OSMC on a Raspberry Pi with an SD card

2
  • It looks like your SD card is dying... What does dmesg | tail -n 30 output? Jun 17, 2015 at 11:58
  • updated my question with dmesg output.
    – jannikb
    Jun 17, 2015 at 14:28

1 Answer 1

1

Before you shut the system down, write down or copy the output of:

cat /proc/version

You then need to shutdown properly, take that SD card out and run e2fsck on all the ext4 partitions -- I am not sure if OSMC uses more than one, but you can check with fdisk. You can cross your fingers while you are doing this because it is not a guaranteed fix.

With regard to why it happened, you may want to investigate this. The info you got from /proc/version should tell you whether you are using a kernel built with one of the affected gcc versions.

3
  • As I understand you I should check the SD card with another computer? Currently I have only one Ubuntu set up in a Windows VM... Couldn't I do e2fsck on reboot like here?
    – jannikb
    Jun 17, 2015 at 13:30
  • If you really can't access the SD card with the VM then you could try that, but you will not necessarily be making life easier for yourself.
    – goldilocks
    Jun 17, 2015 at 13:36
  • Thanks! I was able to run e2fsck from a live version and it fixed a lot of errors. Apt-get update works now
    – jannikb
    Jun 17, 2015 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .