# Read only root filesystem

## rolypoly

I've just installed gentoo into a VM on VMware Workstation 7.1.4 hosted on gentoo amd64.

The install went ok and I've included all the correct drivers for the scsi controller etc.

However, when I reboot, the root file system is mounted read only, so most services fail to start and although I can login, I can't really do anything.

The filesystem is EXT4 (compiled into kernel, not modules), the kernel is 2.6.39-gentoo-r3 (x86).

Looking through dmesg output, there are a couple of lines as below:

```
EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)

VFS: Mounted root (ext4 filesystem) readonly on device 8:3.
```

/etc/fstab looks ok, basically the same as the install handbook example, but with ext4 for the filesystems (including boot) and the updated partitions /dev/sda1 - boot, /dev/sda2 - swap and /dev/sda3 - root.

The VM specs are:

1 CPU

512 MB RAM

20GB SCSI hard drive

CD/DVD

Soundcard

USB

Network adapter.

Can anyone offer suggestions why this is happening? Anything else I can provide to help?

Thanks,

Roland.

----------

## NeddySeagoon

rolypoly,

The root filesystem is mounted read only to allow fsck to be run on it before its changed to read/write.

Its OK to allow fsck to modify a read only filesystem.  I suspect the issue is in /etc/fstab somewhere as that file is consulted to know where the root fs is and what type it is so the right fsck can be run.

You can edit the file.  boot and log into your read only system

Run 

```
/bin/mount -o remount,rw /
```

 to get read/write access.

You may need to give the full path name to nano to get it to run 

```
/bin/nano -w /etc/fstab
```

will allow you to fix /etc/fstab.

Shutdown with

```
 /sbin/shutdown -h now
```

----------

## rolypoly

Hi NeddySeagoon,

Thanks for the response, but when I try to change the root filesystem to rw using your command, I get this:

```
/bin/mount -o remount,rw /

mount: cannot remount block device /dev/sda3 read-write, is write-protected
```

Is there a kernel option that makes a filesystem read-only, like the kernel ntfs driver?

The last line of dmesg output is:

```
EXT4-fs (sda3): Filesystem with huge files cannot be mounted RDWR without CONFIG_LBDAF
```

Ring any bells? I'm not sure it's related, but it kind of sounds like there is a kernel option I'm missing. However, I don't have any 'huge' files that I'm aware of. By huge, I assuming 2TB or larger.

Here is my fstab:

```

/dev/sda1               /boot            ext4            noauto,noatime   1 2

/dev/sda3               /                ext4            noatime          0 1

/dev/sda2               none             swap            sw               0 0

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

# NOTE: The next line is critical for boot!

proc                    /proc            proc           defaults           0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for 

# POSIX shared memory (shm_open, shm_unlink).

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

```

Roland.

----------

## rolypoly

Success! However, I changed 2 things so am not sure which made the difference.

I added the CONFIG_LBDAF to my kernel and rebuilt it.

I also added an extra option to /etc/fstab which I took from the host system, so it now reads:

```
/dev/sda3               /               ext4            noatime,user_xattr              0 1
```

Can anyone tell me what user_xattr is for?

The VM now boots successfully and is read-write  :Smile: 

----------

## Hu

The change to LBDAF made the difference.  This is only required for 32-bit kernels.  Could you explain why you are using a 32-bit guest on a 64-bit host, when both of them are Gentoo?

----------

## rolypoly

I'm going to be taking the guest VM to another laptop which is running VMware Workstation 7.1.4 on a 32bit Windows machine  :Smile: 

----------

## wcg

You can get a brief description of mount options like user_xattr

from the mount man page: "man mount" and search for the term.

(Often it will be repeated for different filesystems that support that

option.)

For more details, see "man 5 attr".

----------

