0

I have a small board that I am trying to use as a headless IOT device. The problem is every once in a while during the boot process it shows the following error.

Errors were found while checking the disk drive for /.   
Press F to attempt to fix the errors, I to ignore, S to skip mounting or M for manual recovery...

Because the device is headless I would really like for the board to automatically "press f" so the user does not have to move the device to a monitor and keyboard just to press f. How can I accomplish this?

nbroeking
  • 145
  • 2
  • 9

1 Answers1

3

Ubuntu 16.04 and later with systemd

You do an fsck at every boot with some kernel parameters...

sudo nano /etc/default/grub

find the line that says

GRUB_CMDLINE_LINUX_DEFAULT

and add

fsck.mode=force  fsck.repair=yes

to the existing things there.

Credit:

Ubuntu 16.04 and earlier without systemd

The answer to your question is here [How can I make fsck run non-interactively at boot time?1

File System Check (fsck) isn't run every boot so your "once in a while" could mean errors are always there but fsck isn't run when no errors are reported.

Finding the source of file system errors is important. I would take a look at the error messages in /var/log/boot.log and post a new question of what errors there you need help with. Fsck error messages can be in other locations depending on whether upstart or systemd is used for init at boot time.

To force Ubuntu to fix all disk errors at boot you need to add FSCKFIX=yes to the file /etc/default/rcS. This tells fsck to run with the -y flag. 1