# initramfs: why is newroot mounted read-only?

## D-LINC

Now that I've quit genkernel cold turkey (tried to puff but not inhale, but it didn't work for me...  :Wink:  I'm building all my own initramfs. However, on my last system I followed the tutorial instructions, and mounted newroot as read only; but after switch root and passing control to Gentoo init, then Gentoo complained about the root file system being read only, and eventually it died after not being able to create file locks and so forth. So, I set the initramfs init script to just mount normally, and now things are working fine.

Anyway, why is it that the tutorials say to mount newroot as read only? Also, is my Gentoo box supposed to have some kind of remount command somewhere that remounts read-only to read-write?

In case it makes a difference, I'll mention that I am using initramfs because my root file system is sitting on top of RAID1 + Luks + LVM layers. (That's right, all three baby!)

----------

## frostschutz

 *D-LINC wrote:*   

> Anyway, why is it that the tutorials say to mount newroot as read only? Also, is my Gentoo box supposed to have some kind of remount command somewhere that remounts read-only to read-write?

 

Various reasons, one of them is that there could've been a power outage or similar before boot and the main system may want to do a fsck of sorts before continuing the boot process. And in such a case depending on the file system doing a read-write mount before the filesystem is checked could be destructive. When the main system boots it will switch to read write mode on its own.

 *D-LINC wrote:*   

> In case it makes a difference, I'll mention that I am using initramfs because my root file system is sitting on top of RAID1 + Luks + LVM layers. (That's right, all three baby!)

 

Same here, but it works just fine for me.

You seem to be having a configuration issue of some kind, are your fstab entries correct?

----------

## Pryoidain

I'm getting the same thing after rebuilding my initramfs. The first time around it worked fine, but now it's complaining about read-only mounted root and eventually crashes. Since this system is supposed to be extremely HA (battery backups and the like) I also have all the filesystems tuned to fsck every few mounts (normally the filesystems should never be unmounted), so mounting rw root is not an option, at least not in the long run.

Here is my init: http://pastebin.com/mtv3ECyR

(Edit: Just to clarify, all I did when updating it was modify the files in the initramfs (Included a web browser and nano), the init script itself wasn't touched.)

And my fstab and disk layout (fstab is at the bottom): http://pastebin.com/iFVkjNVb

I've tried tweaking mount options and the like, but the system always complains about a read only root and eventually bails. I'm still playing around with it to try and get it to come up in ro.

Edit: Just in case it may matter, I earlier had experienced a switch_root hang, which I mention here: https://forums.gentoo.org/viewtopic-t-911242.html

----------

## Pryoidain

On a whim, I copied all the devices in my initramfs' /dev directory (Includes the bare hard drives and their partitions, and the md drive arrays) into the /dev on the root partition. Everything seems to work now, Neddy mentioned here: https://forums.gentoo.org/viewtopic-t-880149-postdays-0-postorder-asc-start-25.html that sometimes additional devices may be necessary for non-standard layouts.

----------

## frostschutz

There were some broken stage3 tarballs in the past that had essential /dev nodes missing. There should be a rather complete set in there by default (hardly takes any space and is hidden once udev comes up). People also tend to forget to copy this when transfering old installs onto a new disk or filesystem... which in turn leads to funny and hard to trace errors.

----------

