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
  • The answer to your question is here (how-can-i-make-fsck-run-non-interactively-at-boot-time)[http://askubuntu.com/questions/151025/how-can-i-make-fsck-run-non-interactively-at-boot-time]. File System Check (fsck) isn't run every boot which means your "once in awhile" could mean errors are always there every boot but fsck isn't run that time you think you have no errors. This should be a greater concern. – WinEunuuchs2Unix Aug 30 '16 at 23:46
  • Thank you. I didn't realize it was fsck. Sometimes half the battle is knowing what to search. – nbroeking Sep 01 '16 at 22:00
  • 1
    I'll repost the comment as an answer. If everything works you can mark it as solved. If you have further comments they can be posted under the new answer. Thanks. – WinEunuuchs2Unix Sep 01 '16 at 23:07

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