Recent mid-boot fsck/mount change

Hi,

Have been configuring some filesystems to run fsck during every boot…

tune2fs -c 1 -i 1d /dev/sdb1

…so that if anything is wrong with it, it’ll be fixed sooner by proactive fsck, instead of risking further corruption.

Some such filesystems are of considerable size and thus might take awhile for fsck to finish. This would prolong the boot time while the system waits for its completion, but that’s fine and not a disruption.
However, about six weeks ago, the behavior suddenly changed, probably after a system update, and now the boot process does not wait for the fsck/mounting to finish, and so the boot completes and the filesystem is not mounted for a little while longer.
This is a problem, as there are some things that expect the filesystem to be mounted and available almost right upon initial login.

Have tried looking at various service/unit files to see if their configuration might shed light on this, but haven’t found anything telling so far.
What’s the easiest way to determine the change that’s causing this, so can restore the prior behavior?

openSUSE Tumbleweed 20240509

Thanks

You could start with showing your /etc/fstab and explaining what lines there have this issue.

Naturally, the root filesystem is not subject to the problem since it must be mounted in order for booting to complete. Home is perhaps also not subject to the problem for similar reason, and also that it is on a device that’s faster than the external, problem filesystem.
The last line is the one with the issue. Nothing of this was changed leading up to the problem first occurring.

UUID=213f877e-7758-4fa6-9858-ad583ceb533c  /      ext4  acl,user_xattr      0  1
/dev/mapper/home-map /home ext4 defaults,nosuid,nodev 0 2
/dev/mapper/cr_swap                        swap   swap  defaults      0  0
/dev/mapper/extern-map /mnt/extern ext4 defaults,noexec,nosuid,nodev,nofail 0 2

As user does not care whether this filesystem is available or not, systemd does not attempt to wait for this filesystem to become available. Either remove nofail or explicitly order services that needs it after this mount point (e.g. using RequiresMountsFor).

2 Likes

Would not have figured that removing the nofail fstab option would help, since man fstab describes it only as…

do not report errors for this device if it does not exist

Yet it does solve the issue. Thanks.

This is a simple solution. Also, from discussion on the web, nofail supposedly thwarts failure in situations beyond just device absence, thereby proceeding on arbitrary errors and resulting in filesystem risk. So, decided to abolish all use of it indefinitely. However, doing without it leaves the caveat that absence of the pertaining storage device will disrupt the boot process, since it now is expected to be present. Tried the nobootwait option in place of nofail, but it had no discerned effect, and is perhaps only for other distros. Checked man fstab mount ext4 for something to alleviate this caveat, but didn’t see anything pertinent.
Although it’s not a critical matter, do you have any recommendations?

That is what automount is for.

1 Like

As usual, it depends. If you can guarantee that device is either present on power on or not and do not consider hot plugging after initial boot - you can simply write a trivial generator that adds mount unit when device is present. After all, that is exactly what happens with /etc/fstab - on systemd start it invokes generator that creates (transient) mount units using /etc/fstab as input.

2 Likes

Ok. Haven’t looked much at automount yet, nor creating a generator, but will perhaps get to one or both later on.

Thanks for your help.

Systemd creates the units for you. The Forerunner® 735XT smart watch uses the following entry in /etc/fstab:

erlangen:/Backup # grep /FR735 /etc/fstab 
LABEL=FR735                                /FR735                  vfat   user,x-systemd.automount,x-systemd.idle-timeout=10 0  0
erlangen:/Backup # 
erlangen:/Backup # systemctl cat FR735.automount 
# /run/systemd/generator/FR735.automount
# Automatically generated by systemd-fstab-generator

[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)

[Automount]
Where=/FR735
TimeoutIdleSec=10s
erlangen:/Backup # 
erlangen:/Backup # systemctl cat FR735.mount 
# /run/systemd/generator/FR735.mount
# Automatically generated by systemd-fstab-generator

[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
Before=local-fs.target
After=blockdev@dev-disk-by\x2dlabel-FR735.target

[Mount]
What=/dev/disk/by-label/FR735
Where=/FR735
Type=vfat
Options=user,x-systemd.automount,x-systemd.idle-timeout=10
erlangen:/Backup # 
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.