14

Ubuntu doesn't boot up and it goes into initramfs. I am writing from a live CD trial session. what should I do?

I understand that the boot flow is broken and that when the files from root are going to be loaded into the ram, it does not find the files in the root directory. Please correct me if I'm wrong.

The following is the output from ashell as I input the "exit" command:

(initramfs) exit
/dev/mapper/ubuntu--vg-root contains a file system with errors, check forced.
Inodes that were part of a corrupted orphan linked list found.

/dev/mapper/ubuntu-vg-root: UNEXPECTED INCONSISTENCY; Run fsck MANUALLY.
    (i.e., without -a or -p options)

fsck exited with status code 4.
The root file system on /dev/mapper/ubuntu--vg-root requires manual fsck
3
  • 1
    Try what it says — fsck /dev/mapper/ubuntu-vg-root. If it fails, try sudo fsck /dev/mapper/ubuntu-vg-root
    – user423626
    Jun 3, 2016 at 12:55
  • @BharadwajRaju!! it worked, it did what I knew it had to be done, I just didn't know what/how to do it. Thanks! How does the file system gets damaged/corrupted? Also, how does the fcsk command knows what the file system looks like? Jun 3, 2016 at 13:28
  • 1
    I'm not exactly sure about how it got damaged, but I can explain fsck's rather interesting name — it stands for File System Check. It doesn't know how it should look like, it just recovers any lost data and updates the filesystem's record.
    – user423626
    Jun 3, 2016 at 14:06

3 Answers 3

32

execute:

(initramfs) fsck /dev/mapper/ubuntu--vg-root

select 'y' to all 'Fix?' prompts

Note, your root partition maybe something other than /dev/mapper/ubuntu--vg-root - modify this part appropriate to the location of your boot partition

4
  • I really could boot my laptop after doing your command above. Thank you! Feb 22, 2017 at 15:29
  • I also got a few clear inode requests and said y to all. After it ended I entered the command exit to go to the login screen and everything appears to be there.
    – Daniel
    May 25, 2017 at 20:29
  • Note, your root partition maybe something other than "/dev/mapper/ubuntu--vg-root" - modify this part appropriate to the location of your boot partition
    – Reinsbrain
    Jul 4, 2017 at 22:35
  • saved my life, thank you very much. beer?
    – iWizard
    Sep 23, 2018 at 21:41
6

It seems that you have a bad superblock. To fix this just follow the following steps:

Step 1: boot into a live CD or USB and select try ubuntu without installing options

Step 2: Press ctrl+alt+t or open your terminal

Setp 3:

Find out your partition number by using

sudo fdisk -l|grep Linux|grep -Ev 'swap'

Then, list all superblocks by using the command:

sudo dumpe2fs /dev/sda7 | grep superblock

Replace sda7 to your drive number

You should get a similar output like this

Primary superblock at 0, Group descriptors at 1-6
  Backup superblock at 32768, Group descriptors at 32769-32774
  Backup superblock at 98304, Group descriptors at 98305-98310
  Backup superblock at 163840, Group descriptors at 163841-163846
  Backup superblock at 229376, Group descriptors at 229377-229382
  Backup superblock at 294912, Group descriptors at 294913-294918
  Backup superblock at 819200, Group descriptors at 819201-819206
  Backup superblock at 884736, Group descriptors at 884737-884742
  Backup superblock at 1605632, Group descriptors at 1605633-1605638
  Backup superblock at 2654208, Group descriptors at 2654209-2654214
  Backup superblock at 4096000, Group descriptors at 4096001-4096006
  Backup superblock at 7962624, Group descriptors at 7962625-7962630
  Backup superblock at 11239424, Group descriptors at 11239425-11239430
  Backup superblock at 20480000, Group descriptors at 20480001-20480006
  Backup superblock at 23887872, Group descriptors at 23887873-23887878

Choose an alternate superblock from this list, for this case alternate superblock # 32768

Now, to check and repair a Linux file system using alternate superblock # 32768:

sudo fsck -b 32768 /dev/sda7 -y

The -y flag is used to skip all the Fix? questions and to answer them all with a yes automatically

You should get similar output like this:

fsck 1.40.2 (12-Jul-2007)
e2fsck 1.40.2 (12-Jul-2007)
/dev/sda2 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #241 (32254, counted=32253).
Fix? yes
Free blocks count wrong for group #362 (32254, counted=32248).
Fix? yes
Free blocks count wrong for group #368 (32254, counted=27774).
Fix? yes
..........
/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda2: 59586/30539776 files (0.6% non-contiguous), 3604682/61059048 blocks

Now try mounting the partition

sudo mount /dev/sda7 /mnt

Now, try to browse the filesystem with the following commands

cd /mnt
sudo mkdir test
ls -l

If you are able to perform the above commands, you have most probably fixed your problem.

Now, restart you computer and you should be able to boot normally.

(Source)

4
  • what if sudo fdisk -l|grep Linux|grep -Ev 'swap' returns 2 lines? /dev/sda2 and /dev/sda5 for me
    – knocte
    Oct 2, 2016 at 8:41
  • 3
    There are no need to boot into live Ubuntu. Just run the fsck at the prompt where you are. No need to complicate at task unnecessary.
    – Soren A
    Jan 20, 2017 at 10:48
  • What makes this look like a "bad superblock" problem? Probably just running fsck is what fixes the problem in most cases.
    – mwfearnley
    Jan 12, 2019 at 14:33
  • Your solution was the only one worked for me! Feb 24, 2020 at 3:55
0

It's simple! Something changed your FS since last time, then it must be checked and corrected, do the following:

  1. First you need to know the partition your system is installed: e.g. /dev/sda1
  2. When you got into initramfs screen, input the following:

    e2fsck -f -y -v -C 0 /dev/sdaX
    

Remember that /dev/sdaX must be changed as your system installed partition

1
  • The filesystem is mounted. If you continue you WILL cause *** SEVERE*** filesystem damage. you know about this?
    – Smile
    Jan 17, 2018 at 11:47

You must log in to answer this question.

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