Feedback

type to search

Not able to lock /var/lib/dpkg/lock (read only)

Asked by

I was trying to install ruby on my remote server(this is a vm machine(debian) in a esxi server . ) I got this error:

The Command:

sudo apt-get install ruby1.8

Error :

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.

then I tried :

sudo dpkg --configure -a 

Output:

dpkg: unable to access dpkg status area: Read-only file system 

UPDATE:

output of mount

/dev/sda3 on / type ext4 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/sda1 on /boot type ext4 (rw)
/dev/sdb1 on /home type ext4 (rw)

mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).
       It's possible that information reported by mount(8) is not
       up to date. For actual information about system mount points
       check the /proc/mounts file.

What should I do ?

NN comments
lorinweilenmann
-

It seems like your /dev/sda3 has had an error and has been remounted with ro. you can verify this by looking at 


cat /proc/mounts

dmesg | grep sda3 might hold information on what went wrong with your filesystem.

lastly, you can execute 
tune2fs -c 0 -i 0d /dev/sda3`
and reboot the system. this should force a fsck on your / partition. The alternative touch /forcefsck won’t work in your case as the filesystem is ro.
lorinweilenmann
-

It seems like your /dev/sda3 has had an error and has been remounted with ro. you can verify this by looking at 


cat /proc/mounts

dmesg | grep sda3 might hold information on what went wrong with your filesystem.

lastly, you can execute 
tune2fs -c 0 -i 0d /dev/sda3`
and reboot the system. this should force a fsck on your / partition. The alternative touch /forcefsck won’t work in your case as the filesystem is ro.
or Cancel

Your answer

You need to join Debian to complete this action, click here to do so.