# Linux Kernel Module Cheat

#### 17.3.3. rw

By default, the Linux kernel mounts the root filesystem as readonly. TODO rationale?

This cannot be observed in the default BusyBox init, because by default our rootfs_overlay/etc/inittab does:

    /bin/mount -o remount,rw /

Analogously, Ubuntu 18.04 does in its fstab something like:

    UUID=/dev/sda1 / ext4 errors=remount-ro 0 1

which uses default mount `rw` flags.

We have however removed those setups init setups to keep things more minimal, and replaced them with the `rw` kernel boot parameter makes the root mounted as writable.

To observe the default readonly behaviour, hack the run script to remove replace init, and then run on a raw shell:

    ./run --kernel-cli 'init=/bin/sh'

Now try to do:

    touch a

which fails with:

    touch: a: Read-only file system

We can also observe the read-onlyness with:

    mount -t proc /proc
    mount

which contains:

    /dev/root on / type ext2 (ro,relatime,block_validity,barrier,user_xattr)

and so it is Read Only as shown by `ro`.