Skip to main content
Revised answer, based on question screenshot
Source Link
Tim
  • 1.1k
  • 5
  • 22

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 the mount_root function fsck 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

log_begin_msg "Mounting root file system"
# Always load local and nfs (since these might be needed for /etc or
# /usr, irrespective of the boot script used to mount the rootfs).
. /scripts/local
. /scripts/nfs
. /scripts/${BOOT}
parse_numeric ${ROOT}
maybe_break mountroot
mount_top
mount_premount
mountroot
log_end_msg

/scripts/local @line 244

mountroot()
{
    local_mount_root
}

/scripts/local @line 131

local_mount_root()
{
# Some code ommited
    # FIXME This has no error checking
    [ -n "${FSTYPE}" ] && modprobe ${FSTYPE}

    checkfs ${ROOT} root "${FSTYPE}"

    # FIXME This has no error checking
    # Mount root
    mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
    mountroot_status="$?"
    if [ "$LOOP" ]; then
        if [ "$mountroot_status" != 0 ]; then
            if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then
                panic "<Error message ommited>"
            fi
        fi
    
        mkdir -p /host
        mount -o move ${rootmnt} /host
# Some code ommitted
}

Original answer, retained for historical reasons

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 the mount_root function fsck 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

log_begin_msg "Mounting root file system"
# Always load local and nfs (since these might be needed for /etc or
# /usr, irrespective of the boot script used to mount the rootfs).
. /scripts/local
. /scripts/nfs
. /scripts/${BOOT}
parse_numeric ${ROOT}
maybe_break mountroot
mount_top
mount_premount
mountroot
log_end_msg

/scripts/local @line 244

mountroot()
{
    local_mount_root
}

/scripts/local @line 131

local_mount_root()
{
# Some code ommited
    # FIXME This has no error checking
    [ -n "${FSTYPE}" ] && modprobe ${FSTYPE}

    checkfs ${ROOT} root "${FSTYPE}"

    # FIXME This has no error checking
    # Mount root
    mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt}
    mountroot_status="$?"
    if [ "$LOOP" ]; then
        if [ "$mountroot_status" != 0 ]; then
            if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then
                panic "<Error message ommited>"
            fi
        fi
    
        mkdir -p /host
        mount -o move ${rootmnt} /host
# Some code ommitted
}

Original answer, retained for historical reasons

More info on initrafms implementations, since it is not clear what is used in mint linux
Source Link
Tim
  • 1.1k
  • 5
  • 22

Two options:

  1. Root is mounted read-only during boot and the init implementation is running fsck. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply.
  2. /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

Systemd

Even if you noticed that /sbin/fsck.ext4 was run before systemd, I want tot elaborate a bit. Systemd is perfectly capable of running fsck itself, on a read-only mounted filesystem. See [email protected] documentation. Most probably this service is not enabled by default in mint, since it will be redundant with the early user space one.

Initramfs

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:

When the root file system finally becomes visible:

  • Any maintenance tasks which cannot run on a mounted root file system are done.
  • The root file system is mounted read-only.
  • Any processes which must continue running (such as the rd.splash screen helper and its command FIFO) are hoisted into the newly-mounted root file system.

And maintenance tasks includes fsck. Further evidence, there is a possibility in dracut cmdline options to switch off fsck:

rd.skipfsck

skip fsck for rootfs and /usr. If you’re mounting /usr read-only and the init system performs fsck before remount, you might want to use this option to avoid duplication

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 replacing udev with mdev, or maybe just completely static. I found some people being dropped to a busybox 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.

Two options:

  1. Root is mounted read-only during boot and the init implementation is running fsck. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply.
  2. /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 before systemd, I want tot elaborate a bit. Systemd is perfectly capable of running fsck itself, on a read-only mounted filesystem. See [email protected] 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:

When the root file system finally becomes visible:

  • Any maintenance tasks which cannot run on a mounted root file system are done.
  • The root file system is mounted read-only.
  • Any processes which must continue running (such as the rd.splash screen helper and its command FIFO) are hoisted into the newly-mounted root file system.

And maintenance tasks includes fsck. Further evidence, there is a possibility in dracut cmdline options to switch off fsck:

rd.skipfsck

skip fsck for rootfs and /usr. If you’re mounting /usr read-only and the init system performs fsck before remount, you might want to use this option to avoid duplication

Two options:

  1. Root is mounted read-only during boot and the init implementation is running fsck. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply.
  2. /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 before systemd, I want tot elaborate a bit. Systemd is perfectly capable of running fsck itself, on a read-only mounted filesystem. See [email protected] 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:

When the root file system finally becomes visible:

  • Any maintenance tasks which cannot run on a mounted root file system are done.
  • The root file system is mounted read-only.
  • Any processes which must continue running (such as the rd.splash screen helper and its command FIFO) are hoisted into the newly-mounted root file system.

And maintenance tasks includes fsck. Further evidence, there is a possibility in dracut cmdline options to switch off fsck:

rd.skipfsck

skip fsck for rootfs and /usr. If you’re mounting /usr read-only and the init system performs fsck before remount, you might want to use this option to avoid duplication

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 replacing udev with mdev, or maybe just completely static. I found some people being dropped to a busybox 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.

Extra info on systemd fsck service
Source Link
Tim
  • 1.1k
  • 5
  • 22

Two options:

  1. Root is mounted read-only during boot and the init implementation is running fsck. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply.
  2. /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 before systemd, I want tot elaborate a bit. Systemd is perfectly capable of running fsck itself, on a read-only mounted filesystem. See [email protected] 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:

When the root file system finally becomes visible:

  • Any maintenance tasks which cannot run on a mounted root file system are done.
  • The root file system is mounted read-only.
  • Any processes which must continue running (such as the rd.splash screen helper and its command FIFO) are hoisted into the newly-mounted root file system.

And maintenance tasks includes fsck, if needed. Further evidence, there is a possibility in dracut cmdline options to switch off fsck:

rd.skipfsck

skip fsck for rootfs and /usr. If you’re mounting /usr read-only and the init system performs fsck before remount, you might want to use this option to avoid duplication

Two options:

  1. Root is mounted read-only during boot and the init implementation is running fsck. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply.
  2. /sbin/fsck.ext4 is run in the "early user space", set up by an initramfs. Which is most probably the case in your system.

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:

When the root file system finally becomes visible:

  • Any maintenance tasks which cannot run on a mounted root file system are done.
  • The root file system is mounted read-only.
  • Any processes which must continue running (such as the rd.splash screen helper and its command FIFO) are hoisted into the newly-mounted root file system.

And maintenance tasks includes fsck, if needed. Further evidence, there is a possibility in dracut cmdline options to switch off fsck:

rd.skipfsck

skip fsck for rootfs and /usr. If you’re mounting /usr read-only and the init system performs fsck before remount, you might want to use this option to avoid duplication

Two options:

  1. Root is mounted read-only during boot and the init implementation is running fsck. Systemd is the init implementation on mint, and since you already checked if it exists there, this option does not apply.
  2. /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 before systemd, I want tot elaborate a bit. Systemd is perfectly capable of running fsck itself, on a read-only mounted filesystem. See [email protected] 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:

When the root file system finally becomes visible:

  • Any maintenance tasks which cannot run on a mounted root file system are done.
  • The root file system is mounted read-only.
  • Any processes which must continue running (such as the rd.splash screen helper and its command FIFO) are hoisted into the newly-mounted root file system.

And maintenance tasks includes fsck. Further evidence, there is a possibility in dracut cmdline options to switch off fsck:

rd.skipfsck

skip fsck for rootfs and /usr. If you’re mounting /usr read-only and the init system performs fsck before remount, you might want to use this option to avoid duplication

Source Link
Tim
  • 1.1k
  • 5
  • 22
Loading