When the /etc/fstab option "failok" is configured for a UFS device which may, at times, be missing, boot still fails (drops into single-user mode). This is because fsck also runs against /etc/fstab, and considers the missing device to be a failure condition. fsck should be patched to also continue, possibly returning a different return code. Bug 163668 fixed the missing device issue in mount, but fsck was never taken into account (that I can see).
I concur that fsck_ffs should honor the /etc/fstab option "failok". It should exit(0) when a device open fails for a "failok" entry. I will look at getting that added.
(In reply to Kirk McKusick from comment #1) Hi Kirk, Isn't this better solved in fsck(8)? If you address this in fsck_ffs(8), the problem will still exist for other file systems. Also, suppose the device open succeeds but the fsck fails (e.g. because the device is flaky), this would still send the system back to single user mode. I expect "failok" to mean "do not interrupt boot if there is a problem with this fstab entry under any circumstances."
(In reply to Robert Clausecker from comment #2) You are right, I do have an fsck_ffs-centric view of fsck :-) It should be handled in fsck.
Proposed fix is in https://reviews.freebsd.org/D33424
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c72372c693b36058b58a525981e833515ce8e441 commit c72372c693b36058b58a525981e833515ce8e441 Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2021-12-16 00:51:55 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2021-12-16 00:53:46 +0000 Update fsck(8) to ignore failures from a check program for a filesystem when the fstab(5) entry for the filesystem has the "failok" attribute. Reviewed by: kib PR: 246201 MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33424 sbin/fsck/fsck.c | 3 +++ sbin/fsck/fsutil.c | 39 +++++++++++++++++++++++++++++++++++++++ sbin/fsck/fsutil.h | 7 +++---- sbin/fsck/preen.c | 24 +++++++++++++++--------- 4 files changed, 60 insertions(+), 13 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fe7121ec5b8b1c98c2933902be7aef1850030154 commit fe7121ec5b8b1c98c2933902be7aef1850030154 Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2021-12-16 00:51:55 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2022-01-02 22:12:14 +0000 Update fsck(8) to ignore failures from a check program for a filesystem when the fstab(5) entry for the filesystem has the "failok" attribute. PR: 246201 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33424 (cherry picked from commit c72372c693b36058b58a525981e833515ce8e441) sbin/fsck/fsck.c | 3 +++ sbin/fsck/fsutil.c | 39 +++++++++++++++++++++++++++++++++++++++ sbin/fsck/fsutil.h | 7 +++---- sbin/fsck/preen.c | 24 +++++++++++++++--------- 4 files changed, 60 insertions(+), 13 deletions(-)
The fix has been MFC'ed to 13-STABLE.