How can I make fsck run non-interactively at boot time?
The setting I am looking for is in /etc/default/rcS, FSCKFIX=yes
. This means "automatically repair filesystems with inconsistencies during boot" and causes fsck to run with the -y
flag. It was set to no
in both of my Ubuntu systems.
Even when set to no
, the boot time fsck is still somewhat noninteractive. mountall runs fsck with -a
, a synonym for -p
, which means "automatically fix any filesystem problems that can be safely fixed without human intervention". Apparently -p
drops to interactive mode if there are unsafe fixes to be made. To run fully automatically, you need -y
or FSCKFIX=yes
.
Here's the relevant bit of code from mountall.c
if (fsck_fix || mnt->fsck_fix) {
NIH_MUST (nih_str_array_add (&args, NULL, &args_len, "-y"));
} else {
NIH_MUST (nih_str_array_add (&args, NULL, &args_len, "-a"));
}
For Ubuntu 15,16,17+ the FSCKFIX value setting is located in lib/init/vars.sh
Can use command grep -r FSCKFIX * 2>/dev/null
to fin it.