fsck on boot 24.04 for root fs
Keith
keithw at caramail.com
Fri Nov 1 18:18:44 UTC 2024
On 11/1/24 12:20 PM, Jerry Geis wrote:
>
>
> On Fri, Nov 1, 2024 at 1:05 PM Keith via ubuntu-users <ubuntu-
> users at lists.ubuntu.com <mailto:ubuntu-users at lists.ubuntu.com>> wrote:
>
> On 11/1/24 9:44 AM, Jerry Geis wrote:
> > I tried adding this to /etc/default/grub
> > GRUB_CMDLINE_LINUX_DEFAULT="fsck.mode=force fsck.repair=yes"
> > then running update-grub
> > rebooted
> >
> > found this in /var/log/syslog
> >
> > systemd[1]: systemd-fsck-root.service - File System Check on Root
> Device
> > was skipped because of an unmet condition check
> (ConditionPathExists=!/
> > run/initramfs/fsck-root)
> >
> > IN fact that file is there :
> > ls /run/initramfs/
> > fsck-root fsck.log overlayroot.log
> >
> > How can I re-generate INITRAMFS so that file is not present - so
> fsck
> > happens on the root fs ?
> >
>
> Initrd usually runs fsck before mounting the actual root filesystem. It
> creates the /run/initramfs/fsck-root stampfile that tells
> systemd-fsck-root.service that the root filesystem has already been
> checked. The results of the check should be in the fsck.log file.
>
> --
> Keith
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com <mailto:ubuntu-users at lists.ubuntu.com>
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/
> listinfo/ubuntu-users <https://lists.ubuntu.com/mailman/listinfo/
> ubuntu-users>
>
>
> I can remote /run/initramfs/fsck-root and reboot - the file is re-
> generated. How do I disable this file ?
I wouldn't recommend it as it's not necessary. However, the manpage for
initramfs-tools will provide all the information about tweaking the
initramfs image.
>
> This is hte contents of the log:
> more /run/initramfs/fsck.log
> Log of fsck -C -f -y -V -t ext4 /dev/nvme0n1p2
> Fri Nov 1 17:16:11 2024
>
> fsck from util-linux 2.39.3
> [/usr/sbin/fsck.ext4 (1) -- /dev/nvme0n1p2] fsck.ext4 -f -y -C0 /dev/
> nvme0n1p2
> e2fsck 1.47.0 (5-Feb-2023)
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> /dev/nvme0n1p2: 252898/15196160 files (0.2% non-contiguous),
> 6418716/60773888 blocks
>
> Fri Nov 1 17:16:12 2024
This indicates that fsck was ran at boot which is what your wanting.
However the fsck command line from your fsck.log output is different
from what I have on my vm system
# cat /run/initramfs/fsck.log
Log of fsck -C -a -T -t ext4 /dev/nvme0n1p2
Fri Nov 1 15:56:18 2024
/dev/nvme0n1p2: clean, 264140/4128768 files, 4117485/16501248 blocks
Fri Nov 1 15:56:18 2024
By default, initrd calls fsck to run the "-a" option which means that it
will automatically fix any errors that do not require manual
intervention to address. I believe fsck is only called with the "-f" and
"-y" options if fsck.mode=force and fsck.repair=y are present in grub.
>
> However I dont see it doing it on the screen - and /var/log/syslog says
> it was actually SKIPPED
> kernel: systemd[1]: systemd-fsck-root.service - File System Check on
> Root Device was skipped because of an unmet condition check
> (ConditionPathExists=!/run/initramfs/fsck-root
>
Yes, the systemd-fsck-root.service skipped checking the root filesystem
because it was already checked from initrd. This is documented in the
systemd-fsck-root.service manpage:
systemd-fsck at .service, systemd-fsck-root.service, and
systemd-fsck-usr.service are services responsible for file
system checks. They are instantiated for each device that is
configured for file system checking.
systemd-fsck-root.service and systemd-fsck-usr.service are
responsible for file system checks on the root and /usr
file system, respectively, *but only if the root filesystem was
not checked in the initrd*.
You can add "debug" as a parameter on the kernel command-line in grub
and on the next boot there will be file called
/run/initramfs/initramfs.debug generated which will contain debug output
from initrd as it executes the initramfs scripts when booting. You
should see fsck being executed and its output listed there.
--
Keith
More information about the ubuntu-users
mailing list