I was reading through all the things that are run during bootup and have seen that after mounting the rootfs, /sbin/fsck.ext4
is run and after that systemd is run. I was wondering where or how fsck
is run, because I was searching for it in the kernel source code and couldn't find it and its not part of the init scripts. So what runs fsck
? The distro I am using is mint.
EDIT: In this image it is shown that fsck is run after mounting the root file sytem
Best Answer
Edit 2: checked sources
I've found the ubuntu initramfs-tools sources. Here you can see clearly, the
Begin: "Mounting root file system"
message is printed first, but in themount_root
functionfsck
is run before the actual mounting. I have ommited some non-relevant code, just to indicate the order. (If you would inspect the linked sources you will find also the other reported scripts from the screenshot)./init
line 256/scripts/local
@line 244/scripts/local
@line 131Original answer, retained for historical reasons
Two options:
fsck
. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply./sbin/fsck.ext4
is run in the "early user space", set up by an initramfs. Which is most probably the case in your system.Systemd
Even if you noticed that
/sbin/fsck.ext4
was run beforesystemd
, I want tot elaborate a bit. Systemd is perfectly capable of runningfsck
itself, on a read-only mounted filesystem. See systemd-fsck@.service documentation. Most probably this service is not enabled by default in mint, since it will be redundant with the early user space one.Initramfs
I don't know which implementation of an initramfs mint is running, but I will use
dracut
as an example. (used in Debian, openSuse and more) It states the following in its mount preperation documentation:And maintenance tasks includes
fsck
. Further evidence, there is a possibility in dracut cmdline options to switch offfsck
:Implementations of initramfs
An dynamic (udev based) and flexible initramfs can be implemented using the systemd infrastructure. Dracut is such an implementation and probably there are distro's out there that want to write their own.
Another option would be a script based initramfs. In such a case
busybox ash
is used as a scripting shell and maybe even replacingudev
withmdev
, or maybe just completely static. I found some people being dropped to abusybox
shell due to some fsck error int mint, so this implementation could apply to mint.If you really want to know for sure, try to decompress the initramfs file in
/boot
and see what's in there. It might also be possible to see it mounted under/initramfs
.