Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] udev-extraconf: Allow optionally skipping systemd-fsck
@ 2025-05-09  9:44 mark.jonas
  2025-05-12 16:43 ` Joshua Watt
  0 siblings, 1 reply; 7+ messages in thread
From: mark.jonas @ 2025-05-09  9:44 UTC (permalink / raw)
  To: openembedded-core; +Cc: raj.khem, JPEWhacker, Ricardo Simoes, Mark Jonas

From: Ricardo Simoes <ricardo.simoes@pt.bosch.com>

When the fsck backend does not respect the exit codes predefined by
fsck, systemd-fsck might not work as expected.

This is the case for fsck.fat from dosfstools [1]. When a FAT formatted
and write protected partition is checked with fsck.fat it will terminate
with exit code '6' [2]. What fsck.fat wants to signal is that a write
protected device cannot be checked. However, that code is interpreted by
systemd-fsck as a bit mask:

- 2: System should be rebooted
- 4: Filesystem errors left uncorrected

As a practical example, a write-protected, FAT formatted SD-card will
not be mounted in this case.

This patch introduces the environment variable SKIP_SYSTEMD_MOUNT_FSCK.
When SKIP_SYSTEMD_MOUNT_FSCK exists systemd-mount will be called with
the --fsck=no option. Thus, the partition will be mounted without
running systemd-fsck.

In general, this new feature is useful when the filesystem is known to
be clean and the fsck backend does not respect the exit codes.

Finally, one way to use this new feature would be to add
ENV{SKIP_SYSTEMD_MOUNT_FSCK}="1" to the udev rule calling the mount
script.

[1] https://github.com/dosfstools/dosfstools/issues/89
[2] https://github.com/dosfstools/dosfstools/blob/v4.2/src/io.c#L63

Signed-off-by: Ricardo Simoes <ricardo.simoes@pt.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 0cbae48729..d6de05f0b6 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -83,6 +83,10 @@ automount_systemd() {
 
     MOUNT="$MOUNT -o silent"
 
+    if [ -n "${SKIP_SYSTEMD_MOUNT_FSCK+isset}" ]; then
+        MOUNT="$MOUNT --fsck=no"
+    fi
+
     # If filesystemtype is vfat, change the ownership group to mount group, and
     # grant it with  w/r/x permissions.
     case $ID_FS_TYPE in
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-05-14 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09  9:44 [PATCH] udev-extraconf: Allow optionally skipping systemd-fsck mark.jonas
2025-05-12 16:43 ` Joshua Watt
2025-05-12 18:16   ` AW: " Jonas Mark (BT-FS/ENG1-Mue)
2025-05-13  8:46     ` [OE-core] " Richard Purdie
2025-05-14 15:20       ` AW: " Jonas Mark (BT-FS/ENG1-Mue)
2025-05-14 15:34         ` Richard Purdie
2025-05-14 16:44           ` AW: " Jonas Mark (BT-FS/ENG1-Mue)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox