3

I had ubuntu 12.04, so try to upgrade it, after the upgrading, i got a black screen, and when restarting the following errors are reported:

Filesystem check or mount failed. A maintenance shell will now be
started. CONTROL-D will terminate this shell and continue booting
after re-trying filesystems. Any further errors will be ignored
root@ptp:~#

I googled the error and tried following commands:

sudo mount -o remount,rw /
sudo  dpkg --configure -a
sudo mount -o remount,ro /
sudo sync
sudo reboot

from Ubuntu 13.04 to 13.10: Filesystem check or mount failed

It seems it worked for others, but not for me after inserting the second line, it was aborted by following error:

processing was halted because there were too many errors.

Also I tried other commands too, but after i inserted the "reboot" command it wouldn't work and also I can't write any other commands anymore on it.

any help?

2 Answers 2

6

Please do not cargo-cult stuff you found on the Internet, but try to understand what a command does before your enter it.

Your use of sudo is unnecessary -- you are already logged in as the root user, and have full access.

The error message you were given indicates that the automatic file system check failed. With ext2, that happened often after a power outage, but with ext3 and ext4, one of which you are likely to be using if your system is newer than ten years, this generally does not happen unless there is faulty hardware involved.

The first command, mount -o rw,remount / essentially tells the system "It is fine, there are no errors on this disk, and you can assume the file system to be consistent enough to write files." This is a bold statement, especially right after you received an error message stating that a file system check found problems that are so bad that the automated repairs would probably have to delete files in order to get the file system back into working shape.

The second command, dpkg --configure -a then attempted to run the post-installation scripts for packages that are marked in the dpkg database as having their files unpacked, but the scripts not run yet. If this command attempted to do anything, this means that you will need to do that later on, but now is not the proper time. The dpkg tool exists all file systems to be mounted and error-free, you only have a root file system with errors, and all others are missing.

The way to resolve your situation is:

  1. Go back to read-only mode using mount -o ro,remount /. You do not want the kernel to change anything in the file system while the repair is under way.

  2. Repair the root file system, using the fsck utility, which will then use the fsck.ext3 utility internally: fsck -f /.

    You can add the option -C0 to get a progress indicator.

    If you get messages about fsck being unable to read blocks because of I/O errors, you can interrupt with Ctrl-C and add the -c option to scan for bad blocks beforehand. This will take ages, but the repair operation then does not attempt to rescue any files spread over defective sectors.

    Most likely you will be asked if you agree to certain problems being fixed. Look up the error messages using your search engine of choice, there is ample documentation on the Internet. Most of these are about deleting files that are beyond repair, or moving them to the lost+found directory.

  3. After that is complete, you will most likely be asked to reboot, in capital letters. This is a good idea, just enter sync first, give the disks a few seconds to write out the remaining data and then press Ctrl-Alt-Del. The reboot will be immediate, without unmounting file systems, but that is fine because the only file system mounted is read-only.

  4. If after the reboot you are dropped back into the same prompt, another file system but the root file system is in need of repairs as well. Use the fsck -A command to attempt an automated repair of all non-root file systems, and manually repair those that need it. This time around, you should not be asked to reboot, as this is only needed for file systems that are mounted while being checked.

14
  • 1
    Dear Simon, many thanks for your answer. I did as you said but the Ctrl-Alt-Del didn't reboot the system. i reboot it by power bottom and so it is still same the before
    – sima
    Sep 16, 2014 at 11:02
  • That is strange. Did fsck really run (it should print Pass 1 to Pass 5, followed by /: clean)? Sep 16, 2014 at 11:14
  • "fsck -f" printed "pass 1" to "pass 5" and then it finished by "/dev/sda6: 414375/8216576 files (0.7% non-contiguous) 28790054/32838656 blocks" then i tried "fsck -f -c" too, in the end it asked me to "REBOOT LINUX" as you said, so I typed sync then pressed "Ctrl-Alt-Del"
    – sima
    Sep 16, 2014 at 11:21
  • That sounds good, your root file system should be fine then. If you can boot normally now, the next step is rerunning dpkg, if you get dropped into the maintenance shell again, try step 4 to check all other file systems. The root file system is special in that you reboot after fsck repaired it. Sep 16, 2014 at 11:30
  • I rebooted the system the "dpkg --configure -a" failed with the same error and then I tried "fsck -A" it failed also by "e2fsck: cannot continue, aborting"
    – sima
    Sep 16, 2014 at 11:35
1

For those who are still in trouble :

fsck -f

did not resolve my problem bescause all fs where no mounted. After fsck I did :

mountall

And then I had a prompt login ! I used my loal user to log in, and then :

startx

to have a graphical environement, and then :

unity --replace

to have unity.

Then, I performed an upgrade of Ubuntu, the upgrade fixed my boot recors. Since then, all is working perfectly !

Hope this helps...

You must log in to answer this question.

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