Warning at boot about root filesystem not being read-write

I updated my system last night using stable.

When I boot, I briefly see a message at the console after fsck runs on my root partition:

The root device is not configured to be mounted read-write! It may be fsck’d again later.

As I looked deeper, I found using dumpe2fs that my root partition had not actually been checked since I first installed the system. Searching around, I found and followed the advice in

https://forum.manjaro.org/t/how-to-enforce-boot-time-file-system-check/28363

among others. I used tune2fs to turn on periodic checking and made sure that GRUB_ROOT_FS_RO is set in /etc/default/grub but I still see that warning.

In that GRUB file, I see this little nugget:

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
GRUB_ROOT_FS_RO=true

If I look at mkinitcipo.conf, I see that fsck is still in the HOOKS list:

HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)

As I understand it, Manjaro’s choice is to not use the mkinitcpio hook method, so is the line above a bug in the mkinitcpio package?

Thankfully, it looks like my root partition is actually getting checked after my configuration tweaks, as reported by journalctl -u systemd-fsck* and dumpe2fs.

So why is fsck still referenced in /etc/mkinitcpio.conf?

1 Like

I’m a beginner user also looking into this, because I recently added the fsck hook in my mkinitcipo.conf, since according to the wiki it is highly recommended and is now normally a default hook.

Now, to help you out, if you look at fsck - ArchWiki, as suggested by the comment in /etc/default/grub regarding filesystem check, you will probably understand that Arch and Manjaro use fsck (via HOOKS in mkinitcipo.conf) by default and not systemd-fsck. Manjaro says that they use fsck by default because it is faster.
Initially this comment in the GRUB file confused me too, but the wiki page clears this up.

In order for mkinitcpio's fsck to work, root must be mounted read-write rw.
In order for systemd's fsck to work, root must be mounted read-only ro initially and afterwards remounted read-write rw.

To go along with the default way (fsck by mkinitcpio), try the following:

Ensure that fsck is still written in the HOOKS list in mkinitcipo.conf.

If by any chance you need to modify the mkinitcipo.conf file, to add the fsck HOOK, then you should run

sudo mkinitcpio --allpresets

Following that, run

sudo nano etc/default/grub

Add a hashtag # right before the line GRUB_ROOT_FS_RO=true without leaving a space. The line should be:
#GRUB_ROOT_FS_RO=true
To add a hashtag is to comment (to remove a hashtag is to uncomment). The # disables the command that follows it, so that root is not mounted ro initially (systemd-fsck will not run automatically).

Ctrl+O, Enter and Ctrl+X to save and exit.

Immediately (after any modification to the GRUB file), run

sudo update-grub

Reboot.

Assuming you haven’t made any other configuration changes, these steps should allow your root to be filesystemcheck’ed at boot time only once by mkinitcpio.

I don’t know whether you need all the other extra stuff.

Even though now I see the

dev/sda7: clean …/… files …/… blocks

message at every boot and it also hangs there for a minute before the cursor appears, out of curiosity I went to see what the frequency of filesystem check is (between boots) and when the last filesystem check was for my computer.

sudo dumpe2fs -h /dev/sdXY | grep -i 'maximum mount count'

(where X is a letter and Y is a number that correspond to where the filesystem is, e.g. root at sda1)

dumpe2fs 1.46.2 (28-Feb-2021)
Maximum mount count: -1

To my surprise, for me the frequency of performing a (full) filesystem check is set to -1, which might mean that my computer never performs a full filesystem check regularly. I don’t know how this came to be, maybe fsck wasn’t a default thing previously. Currently, Arch wiki says the default number is 30. I have to assume that fsck is not actually performing full filesystem checks due to this configuration, but rather the message at boot-time is a quick check (1-2 minutes).

Therefore, you should check the frequency rate of fsck by running the above command if you want fsck to be doing full filesystem checks periodically (note that a full check might take hours depending on the size of the file system and the amount of files).

To see when the last full filesystem check was, run

sudo dumpe2fs -h /dev/sdXY | grep -i 'last checked'

If you wish to change the frequency rate, so that fsck fully checks a filesystem every 30 boots (this is the default per the Arch wiki), run

sudo tune2fs -c 30 /dev/sdXY

EDIT: Also note that GRUB already uses the rw kernel parameter as default for boot-time (you don’t need to add the rw parameter yourself, you can see that it already is written as a parameter at boot-time in /boot/grub/grub.cfg), unless the line GRUB_ROOT_FS_RO=true in /etc/default/grub is uncommented, which makes the filesystem read-only ro at boot-time.

1 Like