Ubuntu – Strange errors, including all files are read-only

hard drivepermissions

My Ubuntu 14.04.2 computer has suddenly started displaying various serious errors.

It started when I was working on my Ruby on Rails app, left it for a while, came back, and tried to restart my server with rails s. In response, I got back this error:

Rails Error: Unable to access log file. Please ensure that /home/user/app/log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

I tried to run chmod 0666 /home/user/app/log/development.log and then various other chmod commands, like chmod 0664 and chmod 777. Each time I got back:

chmod: changing permissions of ‘/home/user/app/log/development.log’: Read-only file system

I tried other Rails apps and got the same error with them. Then I tried to save the file I was working on with Komodo IDE and quit, but Komodo told me the file was read-only and couldn't be saved.

Then, I noticed that my Skype had signed itself out, and when I tried to sign back in, it told me that I was already signed in.

So I restarted my computer. On the login screen, I got an error message, something like Errors were found when searching directory /. Press f to fix, I to ignore, and M to run a manual reboot.

I pressed I to ignore and signed in. Now I can't open Skype or Komodo at all. When I click on the icons they flash a few times like they are about to open, but then they just stop flashing and nothing happens.

Also, rails s, no longer returns an error, it literally just closes my terminal window.

When I run mount, half the time the terminal just closes, and half the time I get this message:

$ mount
/dev/sda2 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
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 /sys/firmware/efi/efivars type efivarfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda1 on /boot/efi type vfat (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=greg)

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.

I also just noticed that all my files have a lock icon over them. I assume this means all my files are read-only.

The output of:

sudo smartctl --all --tolerance=verypermissive /dev/sda

can be found here

What could be going on??

Best Answer

This looks a lot like your file system is mounted read-only prior to a drive failure...

So please stop using the computer, shut it down completely and:

  1. Open your computer and check the hard disk. If it is not attached to its controller board, then buy a new external hard drive bigger then your current hard drive. It it is attached to its controller board, then buy a new internal hard drive with the same connector type.
  2. Insert it in your computer (If it is a laptop, buy an external USB HDD in the step above)
  3. Boot an Ubuntu Live DVD and choose Try Ubuntu
  4. Press Ctrl+Alt+T to go to a terminal and type:

    sudo apt-get install gddrescue
    sudo ddrescue --binary-prefixes --cluster-size=64 --sparse --timeout=20s /dev/WdX /dev/YdZ

    Note : W and X are the drive letters of your nearly broken hard drive and Y and Z are the drive letters of your new hard drive.

  5. If that works fine without any errors, we'll be testing whether my gut feeling is right:

    sudo apt-get install smartmontools
    sudo smartclt --scan
  6. Then perform :

    sudo smartctl /--test:short dev/XdY

for all devices that came up during the scan.

Then give feed back please!

Edit: I'm very sorry to have to tell you that your drive is dead.

Please swap the external drive with the internal drive and re-install Ubuntu on the new drive without attaching the old drive. Then hook up the old drive through the USB enclosure and try again... Maybe (extremely unlikely) you can recover some more data off it that way.

Related Question