Re: "Run fsck manually"..?
On Wed 03 Feb 2021 at 11:24:38 (-0500), Greg Wooledge wrote:
> On Wed, Feb 03, 2021 at 10:02:42AM -0600, David Wright wrote:
> > T'other way, I think, but no matter. For the record, there are
> > two different "strengths" for fsck:
> >
> > fastboot|fsck.mode=skip)
> > fastboot=y
> > ;;
> > forcefsck|fsck.mode=force)
> > forcefsck=y
> > ;;
> > fsckfix|fsck.repair=yes)
> > fsckfix=y
> > ;;
> > fsck.repair=no)
> > fsckfix=n
> > ;;
>
> Where is this coming from?
>From foo/main/init where foo is
$ unmkinitramfs /boot/initrd.img foo/
> > If you have a separate /boot that is not on a filesystem needing
> > fscking, then you can use the normal mechanism supported by grub¹.
>
> > ¹ It writes to the file /boot/grub/grubenv, hence the caution.
>
> What is the "normal mechanism"? Where is it documented?
https://www.gnu.org/software/grub/manual/grub/grub.html
> There are no man pages for "grub" or for "grubenv" on my system.
> There is a /boot/grub/grubenv file but it consists of one comment line,
> ending in a newline, and then enough # characters to make the file size
> exactly 1024 bytes. Incomprehensible.
I'm guessing the comment is a signature. §15.2 outlines the grubenv
method. As Stefan mentioned, grubenv is designed to remain static,
and grub-editenv carefully alters its contents. Configuring Grub
uses /etc/grub.d/00_header and the variables in /etc/default/grub to
write the code at the top of /boot/grub/grub.cfg for juggling the
boot selection.
You start all this off by editing /etc/default/grub: GRUB_DEFAULT=0 →
GRUB_DEFAULT=saved and running grub-set-default 0. Then:
$ head -c 72 /boot/grub/grubenv ; echo
# GRUB Environment Block
saved_entry=0
#################################
$
# grub-reboot 'fsck>fsck'
#
$ head -c 72 /boot/grub/grubenv ; echo
# GRUB Environment Block
saved_entry=0
next_entry=fsck>fsck
############
$
I'm doing the next bit now to restore normality, but this would also
be done automatically if you boot with a next_entry set, so that
the altered boot is a one-off.
# grub-set-default 0
#
$ head -c 72 /boot/grub/grubenv ; echo
# GRUB Environment Block
saved_entry=0
#################################
$
Cheers,
David.
Reply to: