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?

3
  • The answer to your question is here (how-can-i-make-fsck-run-non-interactively-at-boot-time)[askubuntu.com/questions/151025/…. 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. Aug 30, 2016 at 23:46
  • Thank you. I didn't realize it was fsck. Sometimes half the battle is knowing what to search.
    – nbroeking
    Sep 1, 2016 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. Sep 1, 2016 at 23:07

1 Answer 1

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

4
  • This only works with SysV init, not Systemd which is now used by default on newer versions of Ubuntu & Debian.
    – radj307
    Nov 24, 2023 at 4:33
  • 1
    @radj307 Does this solve the issue for you? Nov 25, 2023 at 20:16
  • Yes, adding fsck.mode=force fsck.repair=yes to the GRUB_CMDLINE_LINUX_DEFAULT works with Systemd, and fixed the problem in my case.
    – radj307
    Nov 25, 2023 at 20:37
  • 1
    @radj307 Thank you for confirming. I've updated the answer with your issue. Nov 25, 2023 at 22:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .