Getting rid of “will be checked for errors at next reboot”

Some of my virtual servers running Ubuntu 16.04.4 showed a hint whenever logging in:

*** /dev/vda1 will be checked for errors at next reboot ***

This issue persisted already for quite a while. Rebooting seems not to help, and also the tips from the blog post “When “disk will be checked for errors at next reboot” won’t go away in Ubuntu” did not help in my case.

Further exploration showed that “Last checked” as shown when using sudo tune2fs -l /dev/vda1 indeed had a very old date. Is the file system check actually executed? Closely observing the reboot process showed that fsck.ext4 is executed:

Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... 
Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Will now check root file system ... fsck from util-linux 2.27.1
[/sbin/fsck.ext4 (1) -- /dev/vda1] fsck.ext4 -a -C0 /dev/vda1

However, the execution returns with a notice that the file system is “clean”. It seems that this does not lead to the date being updated. The man page documents the -f (force) flag to force a check. Digging in the scripts run at boot time (/usr/share/initramfs-tools/scripts/) unveiled that the scripts do add the -f flag in case the kernel parameter forcefsck is used.


So I added the flag in /etc/default/grub to the default Linux kernel arguments:

GRUB_CMDLINE_LINUX_DEFAULT="quiet forcefsck"

And updated grub

sudo update-grub

On the next reboot fsck.ext4 got called with the -f flag and did a proper file system check. And with that, the message on login disappeared.

Note: With forcefsck a full file system check is getting executed on every reboot. This might be not ideal for every environment. It seems that fsck.ext4 and the initramfs scripts do not agree on when a check is actually necessary.

Note 2: All machines also have been upgraded from previous Ubuntu LTS versions so it might be related to that.