Skip to main content
Topic: early-fs-fstab.target and fsck failed (Read 541 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

early-fs-fstab.target and fsck failed

Code: [Select]
sudo dinitctl list

Code: [Select]
...
[{+}     ] fsck-root
[     {X}] early-fs-fstab.target
[     {-}] fsck
[{+}     ] early-console.target
...

Code: [Select]
dinit 0.18.0-5
dinit-base 0.18.0-5
dinit-rc 0.4.7-1

Code: [Select]
sudo dinitctl status early-fs-fstab.target
Code: [Select]
Service: early-fs-fstab.target
    State: STOPPED (failed to start; exited - status 64)

All other services run just fine. Haven't notice any issues with it but wanted to report just in case.

Re: early-fs-fstab.target and fsck failed

Reply #1
TLDR: probably nothing to worry about as your important devices are still being mounted,
else you would be having further problems.



Just "solved" this on my machine so I will walk you through what I did and what might be the problem for you as well.

Looking inside early-fs-fstab.target, we have:

Code: [Select]
type       = scripted
command    = /usr/bin/mount -a -t nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs,nofuse.glusterfs -O no_netdev
restart    = false
depends-on = early-fs-pre.target
depends-ms = fsck
waits-for  = early-root-rw.target

Interpretation: when early-fs-fstab.target is called by dinit, it runs the following command once before finishing the service:

Code: [Select]
mount -a -t nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs,nofuse.glusterfs -O no_netdev
This command tries to mount all the devices listed at /etc/fstab, except for the drives with the
types that are explicitly excluded in the command  with the -t flag and the 'no' prefix (e.g. mount -t nonfs: ignore any drive that is of the nfs type. Same logic for the other drive types).
Knowing this, it is easy to infer that the problem is likely some badly declared entry at /etc/fstab.
In my case, the entries on the file that were causing errors were these two:

Code: [Select]
# /dev/sdc1 LABEL=ARTIX_202308
UUID=2023-08-13-15-59-29-00 /run/artix/bootmnt iso9660 ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8 0 0

# /dev/loop0
/dev/loop0          /run/artix/sfs/rootfs squashfs  ro,relatime,errors=continue,threads=single 0 0

As you can see the specified mount-points were /run/artix/bootmnt and /run/artix/sfs/rootfs respectively, but checking these locations i noticed /run/artix does not exist on my computer.
I'm not really sure what these mount points are supposed to be (maybe they are used for the first install of the OS?), and I don't remember setting them up myself either, but since they were causing the error (and weren't  getting mounted anyways), I just commented them out:

Code: [Select]
# /dev/sdc1 LABEL=ARTIX_202308
# UUID=2023-08-13-15-59-29-00 /run/artix/bootmnt iso9660 ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8 0 0

# /dev/loop0
# /dev/loop0          /run/artix/sfs/rootfs squashfs  ro,relatime,errors=continue,threads=single 0 0

And just like that, the error is gone! Well, at least it was gone for me. Note that this doesn't actually fix anything as the entries are still
not being mounted, though the system itself works fine without them. I chose to do this because as I said I'm not sure as to what those entries are for and thus would rather leave them commented out.


NOTE: I got all of this knowledge from just reading the relevant files and the man entry for dinit/mount, so if anyone  has any corrections and/or an explanation as to what these two fstab entries are (I also have a commented out 'overlay' entry that I don't understand), please respond!

Re: early-fs-fstab.target and fsck failed

Reply #2
@bizio thanks for such a detailed reply! I inspected my fstab can't spot anything. Got couple ntfs drives and btrfs subvolumes gonna be pain to debug. Last time I edited fstab on my debian server I wasn't able to ssh to it on next reboot and ended up reinstalling debian because I couldn't recover (even after chroot'ing and editing fstab back), so I'm little hesitant about touching it on my daily driver :D



Forgot to add this to original post:

Code: [Select]
sudo dinitctl status early-fs-fstab.target
Code: [Select]
Service: early-fs-fstab.target
    State: STOPPED (failed to start; exited - status 64)

Not sure where to see logs or something more then just status code



self-note:
Code: [Select]
/usr/lib/dinit.d/early-fs-fstab.target

Re: early-fs-fstab.target and fsck failed

Reply #3
Not sure where to see logs or something more then just status code

There isn't any logging for the service configured via the service description file, and mount doesn't do any logging of its own, so unfortunately, you can't.

However, the service description file settings are documented so you can easily add logging by editing the file. See the "log-type", "logfile", "log-buffer-size" settings in particular.

Re: early-fs-fstab.target and fsck failed

Reply #4
Code: [Select]
/usr/lib/dinit.d/easrly-fs-fstab.target

Code: [Select]
type       = scripted
command    = /usr/bin/mount -a -t nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs,nofuse.glusterfs -O no_netdev
restart    = false
depends-on = early-fs-pre.target
depends-ms = fsck
waits-for  = early-root-rw.target
log-type = file
logfile = /var/log/early-fs-fstab.log

Code: [Select]
sudo touch /var/log/early-fs-fstab.log

After reboot log file is empty, did I do something wrong?

Re: early-fs-fstab.target and fsck failed

Reply #5
I have even on a normal install (some tablet with buggy gpu which hangs once in a while), failure to boot with that service even if the volume repaired successfully from the unclean unmount.
It really shouldn't, i mean if fsck succeeded in repairing it doesn't exit with >1 is that right? Or it's 0 just if there's a clean filesystem with nothing to check?

Re: early-fs-fstab.target and fsck failed

Reply #6
I have even on a normal install (some tablet with buggy gpu which hangs once in a while), failure to boot with that service even if the volume repaired successfully from the unclean unmount.
It really shouldn't, i mean if fsck succeeded in repairing it doesn't exit with >1 is that right? Or it's 0 just if there's a clean filesystem with nothing to check?

via "man fsck":

Code: [Select]
       The exit status returned by fsck is the sum of the following
       conditions:

       0
           No errors

       1
           Filesystem errors corrected

       2
           System should be rebooted

       4
           Filesystem errors left uncorrected

The sample rootfscheck script included in the Dinit source distribution shows how 2/4 can be handled.

Re: early-fs-fstab.target and fsck failed

Reply #7
Thanks, so that is what's missing not working just right here, the /usr/lib/dinit/fsck script looks similar.
I think the case argument for code 1 works correctly on another pc i just tested an unclean unmount with, but i don't see the echo...
... and the case argument for 2 it seems it gets stuck, also saw no echod text and probably that command "reboot --use-passed-cfd -r" doesn't pass and exits the script itself with non 0 then? @konimex
Sorry but i don't have the energy to test further.

Code: [Select]
        # it's a bitwise-or, but we are only checking one filesystem
            case $? in
            0) ;; # nothing
            1) # fixed errors
                echo "WARNING: The root filesystem was repaired, continuing boot..."
                sleep 2
            ;;
            2) # system should be rebooted
                echo "WARNING: The root filesystem was repaired, rebooting..."
                sleep 5
                reboot --use-passed-cfd -r
            ;;
            4) # uncorrected errors
                echo "WARNING: The root filesystem has unrecoverable errors."
                echo "         A recovery shell will now be started for you."
                echo "         The system will be rebooted when you are done."
                sulogin
                reboot --use-passed-cfd -r
            ;;
            *) ;;
        esac

Re: early-fs-fstab.target and fsck failed

Reply #8
Thanks, so that is what's missing not working just right here, the /usr/lib/dinit/fsck script looks similar.

Right, looks like it's incorrectly assuming an exact return value of 1, 2, or 4, rather than a bitmask. I don't think you'll ever get 2 by itself, it would always be combined with 1 (at least).

Quote
I think the case argument for code 1 works correctly on another pc i just tested an unclean unmount with, but i don't see the echo...
... and the case argument for 2 it seems it gets stuck, also saw no echod text and probably that command "reboot --use-passed-cfd -r" doesn't pass and exits the script itself with non 0 then?

I suspect --use-pass-cfd won't work with bash (I think, from memory, bash closes "extra" file descriptors), so that's one potential cause of problems, but note that option is not needed if the control socket was already created (eg if /run has already been mounted with a tmpfs via the initial ram disk, which I think should normally be the case for Artix?)