# Recompiled kernel, now booting into ro

## zolom

I installed a new video card, so I recompiled a new kernel in a chroot, and then figured I would change make.conf to include nvidia instead of radeon, reboot and emerge world. Instead, when I reboot I found myself logging into "root@unknown" and unable to essentially do anything because it mounted the root as a read only filesystem. When I recompiled the kernel, I was only there to change the graphics settings so I wouldn't think I did anything to filesystem support, block devices, etc., and I can't seem to find anything wrong in the config myself. The boot drive has an ext2 /boot at /dev/sde2 and a ext4 root at /dev/sde4. 

I found this in /var/log/dmesg:

```

[    3.592478] EXT4-fs (sde4): couldn't mount as ext2 due to feature incompatibilities

[    3.626272] EXT4-fs (sde4): mounted filesystem with ordered data mode. Opts: (null)

[    3.626663] VFS: Mounted root (ext4 filesystem) readonly on device 8:68.

[    3.627678] Freeing unused kernel memory: 488k freed

[    3.627925] Write protecting the kernel read-only data: 10240k

```

This is my fstab. 

```

/dev/sde1      /boot      ext2      noauto,noatime,discard   1 2

/dev/sde3      none      swap      sw      0 0

/dev/sde4      /      ext4      noatime,discard      0 1

/dev/fileserver/fileserver      /mnt/fileserver      xfs      defaults,noatime   0 2

/dev/backup-fileserver/backup-fileserver   /mnt/backup-fileserver      ext4   defaults   0 2

/dev/cdrom      /mnt/cdrom   auto      noauto,ro      0 0

tmpfs          /tmp       tmpfs       defaults,noatime,mode=1777    0 0

```

I use GRUB2. This is the entry in grub2.cfg:

```

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3fab6b3d-7348-434d-9a67-0c7f5b6b4b60' {

   load_video

   insmod gzio

   insmod part_gpt

   insmod ext2

   set root='hd4,gpt1'

   if [ x$feature_platform_search_hint = xy ]; then

     search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt1 --hint-efi=hd4,gpt1 --hint-baremetal=ahci4,gpt1  280ce1d0-9a0d-4bb6-abd3-415cd6068267

   else

     search --no-floppy --fs-uuid --set=root 280ce1d0-9a0d-4bb6-abd3-415cd6068267

   fi

   echo   'Loading Linux 3.2.6-ck ...'

   linux   /kernel-3.2.6-ck root=/dev/sde4 ro  

}

```

So what gives? Why is it trying to mount the filesystem as ext2, or into read only mode at all? Let me know if there's anything else that I can share that anyone would need to see, and thanks for any advice!

----------

## Logicien

Hi,

I think it would be more advise to specifiy defaults at the beginning of the options or rw in /etc/fstab to mount a filesystem as read/write. You have to check in the defaults mount options of the metadatas of a filesystem if there something incompatible with the mount options you give in /etc/fstab or manually. Basically, mounting an ext4 filesystem as ext2 must not use options reserved to ext4 or if an option do not apply to a filesystem it can make the mount fail.

----------

## zolom

Hey Paul, 

I tried appending defaults to the root mount, which is a good anyways, but she still loads the drive as read only and I see the same error in dmesg. I don't understand why it's trying to mount it as ext2 at all; seems a bit inconsiderate after I went through the trouble of installing ext4 and all. Ext4 and Ext2 are compiled into the kernel, so I don't understand it at all, unless that's part of a normal boot process that I'm not aware of. 

Thanks!

----------

## Hu

Ext filesystems are always mounted read-only first, then remounted later if needed.  You did not specify a rootfstype, so the kernel tries several.  It happens to try ext2 first, fail, then try ext4, and succeed.

----------

## zolom

That makes sense. But where am I supposed to set rootfstype? I defined them properly in the fstab, is it a kernel config option?

----------

## Hu

If you want to state it, specify it on the kernel command line.  However, the kernel evenutally guesses the right type on its own, so that is not why your system is not coming up all the way.  Specifying rootfstype would only serve to skip the incorrect initial guesses.

----------

## zolom

Alrighty, that makes sense. I'm not making much headway here, so I think I'll take advantage of not having done much with the system yet and reinstall. Thanks for the help!

----------

## Jaglover

As long as your /var/db/pkg is intact reinstall is a waste of time. Out of curiosity, why did you build your new kernel in chroot?

----------

## zolom

Hey Jag, 

Lord knows. I think it was because I've installed Gentoo on so many machines this week, and I'm so used to finding some silly mistake I made in the config somewhere making the first boot unbootable thus prompting me to reboot, chroot and recompile that it just felt natural. I understand that it's not necessary, and I think I realized that even while I was doing it. 

I'm looking at /var/db/pkg, and while I don't have anything to compare it against, yeah, this is what I've emerged. I haven't wiped anything yet, do you have any advice? If I can take avoid a four hour detour from installing and compiling tonight, I'm game  :Very Happy: 

----------

