128

Whenever I switch on Ubuntu I always see the following message.

(Initramfs): /dev/sda1 contains a file system with errors, check forced.
  Inodes that were a part of a corrupted orphan linked lost found.
  /dev/sda1 : UNEXPECTED INCONSISTENCY; RUN fsck manually.(I.e .,
  without -a or -p options). fsck exited with status code 4. The root
  filesystem on /dev/sda1 requires a manual fsck
  • This shouldn't occur repeatedly. What do you to shut down Ubuntu? – David Foerster Feb 19 '17 at 17:44
  • Do you dual-boot with Windows? If so, do you have a driver installed in Windows that allows it to read/view Ubuntu EXT4 files/partitions? Please start comments directed at me with @heynnema or I may miss them. – heynnema Feb 19 '17 at 18:20
  • No i did not dual-boot windows @heynnema – Abhishek Barman Feb 19 '17 at 18:26
  • I don't know but the message occurs repeatedly whenever I shutdown and then restart it again. @David Foerster – Abhishek Barman Feb 19 '17 at 18:29
  • @AbhishekBarman: Again, how exactly do you shut down Ubuntu? – David Foerster Feb 19 '17 at 20:01
  • from the shutdown options.But my Ubuntu is getting hanging. every time I open. @David Foerster – Abhishek Barman Feb 19 '17 at 20:23
  • Ah, so the system hangs during shutdown. Does it hang when you shutdown via sudo shutdown? If yes, what about sudo reboot? – David Foerster Feb 19 '17 at 20:44
  • @heynnema Hi, I have a similar problem, quite often I get my Ubuntu staled and when I restart I get a fail and a message to "RUN fsck MANUALLY". My system is dual-boot Windows10 and Ubuntu. Do Windows have anything to do with this? Please have in mind that I haven't been starting Windows for months. – Danijel Nov 04 '22 at 08:16
  • @Danijel Windows should have nothing to do with Linux file system corruption (unless you've installed a Windows driver to read ext2/3/4 file systems). Have you run the fsck as per my answer? You should run fsck after every crash/hang. – heynnema Nov 04 '22 at 13:12
  • OK. I did run fsck, and it fixed the problem. But constantly running fsck every few weeks doesn't seem to be the solution. – Danijel Nov 04 '22 at 13:50

2 Answers2

218

From there, you should be able to drop to some maintenance shell (if not already opened), where you may run fsck -yf /dev/sda1.

If there are any errors rerun fsck -yf /dev/sda1

To login as usual simply run exit and proceed normally.

SYN
  • 2,831
  • 13
    Here y in -yf is for yes wherever the system asks for y/n choice – Rahul Gaur Jan 20 '20 at 04:45
  • 1
    I'm very grateful to mathguy for his comment, because remotely supporting someone who is using Linux for development but isn't intimately familiar with grub or working in the CLI makes complicated boot sequences almost impossible, but your comment and his mention that it should work at initramfs was invaluable. https://askubuntu.com/questions/885062/root-file-system-requires-manual-fsck/885066#comment1657117_885085 – dragon788 Jul 06 '20 at 15:25
  • 2
    What does the -f mean? It's not documented on Debian 10 (neither is -y, explained by Rahul above). – Rodrigo Jul 13 '20 at 15:16
  • 3
    The -f is to force check a filesystem, even if it is seen as clean. More of a reflex, might not be required when your system refuses to boot on that partition. – SYN Jul 14 '20 at 21:28
  • wow. Amazing!!! – nirala Aug 03 '21 at 16:37
  • Thanks this saved my installation. It wasn't booting and it wasn't showing my home folder. – RandomGuy May 28 '22 at 18:31
  • lifesaver! Was able to fix the error and reboot. – allanvc Aug 05 '22 at 15:15
  • Replace sda1 with the sda with issue – Anga Jan 12 '23 at 01:58
  • Thanks (+1), this made my system (22.04) starting again. No clue why it happened, I did a normal reboot by GUI. Before that I already had some weird read-only-errors, that was why I rebooted, but then this error showed up and I had only a busybox console where I could fix it with fsck on /dev/sdc1 :) – franc May 08 '23 at 08:19
  • Um... why does my screen now look like The Matrix? – Spencer Williams Aug 19 '23 at 21:56
43

Lets first check your file system for errors.

For 17.10 or older...

  • boot to the GRUB menu
  • choose Advanced Options
  • choose Recovery mode
  • choose Root access
  • at the # prompt, type sudo fsck -f /
  • repeat the fsck command if there were errors
  • type reboot

For 18.04 or newer... (or if the above steps don't work for you)...

  • boot to a Ubuntu Live DVD/USB in “Try Ubuntu” mode
  • open a terminal window by pressing Ctrl+Alt+T
  • type sudo fdisk -l
  • identify the /dev/sdXX device name for your "Linux Filesystem"
  • type sudo fsck -f /dev/sdXX, replacing sdXX with the number you found earlier
  • repeat the fsck command if there were errors
  • type reboot
heynnema
  • 70,711
  • 28
    Why not just do the fsck -fy /dev/sda1 directly on the prompt ? – Soren A Feb 19 '17 at 20:07
  • @SorenA at which prompt? I'm doing it at the root shell prompt, or in terminal with sudo. The file system isn't mounted there, and the fsck will run. – heynnema Feb 19 '17 at 20:10
  • 3
    At the prompt he gets just after the message. I have never seen this message without a following 'minimal grub' prompt. – Soren A Feb 19 '17 at 20:14
  • @SorenA fsck is not a grub command. – heynnema Feb 19 '17 at 20:27
  • 3
    Belive me, it works !! – Soren A Feb 19 '17 at 20:33
  • @SorenA at the grub prompt, grub rescue prompt, or the Initramfs prompt? – heynnema Feb 19 '17 at 20:38
  • 3
    At the prompt he gets below the error message .. whatever it is. – Soren A Feb 19 '17 at 20:46
  • "/bin/sh: sudo: not found" What should I do? – Smile Jan 12 '18 at 00:21
  • @Smile exactly what command did you type? – heynnema Jan 12 '18 at 00:48
  • I went back to the last kernel version that was working fine. Maybe next time I'll use the newest kernel when it is working with no issue. – Smile Jan 13 '18 at 01:52
  • OK, it's more than a year later... Seeing the same problem as the OP reported, on one of my older machines (trying to start it up again after not using it for almost a year). Ubuntu 16.04 on it, dual boot with Windows 10. Windows starts OK; when trying to start Ubuntu (from GRUB menu) I get the same error at the OP. I found your answer here. Here's the issue: Once I select Advanced Options > Recovery Mode, there is no ROOT prompt. The system starts a check automatically, it finds problems with the root filesystem, and it gives a (initramfs) prompt, which does not recognize "sudo". – mathguy Mar 30 '18 at 17:33
  • 5
    ... At the (initramfs) prompt I was able to run fsck directly (no need for sudo). The system fixed a whole bunch of filesystem errors, and I was able to restart Ubuntu normally. Your answer was almost correct. – mathguy Mar 30 '18 at 17:41
  • @SorenA it worked for me like magic ! – ruben May 02 '19 at 18:57
  • 1
    I do not see how it can work and indeed it does not work for me: sudo fsck -f / fails because / is mounted, and naturally I cannot unmount it because the partition is busy. There must be some missing step, like getting into initramfs etc. – xealits Dec 23 '19 at 21:53
  • 1
    @xealits Please use the second part of my answer, which now applies to all systems 18.04 and newer. – heynnema Dec 23 '19 at 23:51
  • I would like to thanks, this solution resolve my ubuntu 1804 VM error issues...i just used sudo fsck -f /....it worked! – chenoi Aug 26 '20 at 12:17
  • fsck -yf /dev/sda2 gives another error end kernal panic not syncing fatal exception in interrupt – Yogesh Kushwaha Jan 21 '21 at 17:29
  • @YogeshKushwaha Please start a new question, and give as much detail as you can. – heynnema Jan 21 '21 at 18:09
  • @heynnema, thumbs up for a very very very useful answer! – pebox11 Sep 07 '21 at 18:05