0

I'm trying to remove a lock file and it won't work:

ubuntu@ubuntu:/media/My Book/montao$ sudo rm -f .hg/wlock
rm: cannot remove `.hg/wlock': Read-only file system

I neither can commit files with hg since it says hg is waiting for a lock. Can you recommend how to proceed? Here's the output from mount

$ mount
aufs on / type aufs (rw)
none on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
/dev/sr1 on /cdrom type iso9660 (ro,noatime)
/dev/loop0 on /rofs type squashfs (ro,noatime)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
/dev/sdc1 on /media/My Book type vfat (rw,nosuid,nodev,uhelper=udisks,uid=999,gid=999,shortname=mixed,dmask=0077,utf8=1,flush)

Thank you

Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424

1 Answers1

1

One possible fix (albeit a kind of crappy one) might be:

$ mv .hg .hg-old
$ cp -r .hg-old .hg

Then see if you can remove the lock…

David Wolever
  • 148,955
  • 89
  • 346
  • 502
  • Thank you David. I get "Read Only File System" trying this: mv: cannot move `.hg' to `.hg-old': Read-only file system – Niklas Rosencrantz Dec 26 '10 at 18:16
  • Hrm, so is there any evidence that the filesystem is, actually, writeable? Have you tried unmounting/remounting? – David Wolever Dec 26 '10 at 18:18
  • It's a USB drive. Resetting it makes the filesystem writable and just after trying hg commit it goes into read-only. I'll try with a different computer to see if results are same. – Niklas Rosencrantz Dec 26 '10 at 18:44
  • 3
    I think the real question here is why the file system goes read-only, I think you should ask on Superuser about this. I seem to recall that this is an indication of a problem with the disk, that the OS puts the drive into read-only mode to avoid corrupting it. – Lasse V. Karlsen Dec 26 '10 at 19:31
  • Thanks for the advice. I cloned a new version and it seems ok now. I suspect there was a conflict somewhere. – Niklas Rosencrantz Dec 26 '10 at 19:47
  • 1
    Yea, +1 on asking on SuperUser. Running an fsck might not be a bad idea either. – David Wolever Dec 26 '10 at 19:55