Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 918962 - sys-boot/grub-2.06 etc. no longer supports f2fs reliably
Summary: sys-boot/grub-2.06 etc. no longer supports f2fs reliably
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-01 16:19 UTC by Paul Gover
Modified: 2024-04-03 02:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Gover 2023-12-01 16:19:26 UTC
grub 2.04 supported booting F2FS partitions, as did 2.06 at first.  However, at some point the grub guys "fixed" something, and it's all been a bit iffy.  I made the mistake of updating a working grub 2.04 system to 2.06, which was OK, but at some point it became somewhat unstable.

This is on amd64 hardware, UEFI and GPT disks.  EFI (vfat) and root (F2FS) partitions are on NVME.

Usually I can still boot with grub - UEFI finds grub64.efi and it works like it should.  But every so often, for no apparent reason, I get dumped into grub rescue mode, and it says, of all the partitions, "unsupported file system".

I tried reinstalling grub 2.06, but no matter what command line flags I give, says "unsupported file system" 100% of the time.

I believe the problem is one of the grub patches to "enhance" its handling of F2FS partitions needing fsck-ing, though AFAIK my partition doesn't need that.
It may be the patch "fs-f2fs-Do-not-read-past-the-end-of-nat-journal-entr.patch ".  See this debian report:
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021846
though that was closed back in February, so I'd expect we have the fix.

I would have tried grub 2.12 but that seems to be keyworded for no architectures, from which I presume it's not even ready for testing yet.

FWIW I boot with an initramfs.  F2FS support is built into the kernel.  The initramfs runs "fsck -a" against the F2FS partition, and also does some RAID stuff on other disks.



Currently, 

Reproducible: Sometimes

Steps to Reproduce:
1.Boot or reboot

Actual Results:  
No boot menu, instead the "Grub rescue" prompt appears, and nothing works.

I have a barely-usable old rEFInd setup that lets me boot with lots of error messages, and that seems to persuade grub to behave itself on the next boot.

Expected Results:  
Grub menu (my own custom, static menu appears)


Currently installed sys-boot/grub-2.06-r9:2/2.06-r9
That's to say, /boot/grub contains that.
However, what's on the EFI partition is dated 20th Oct, which I think means I updated to -r8 but not r9 ('cos grub-install doesn't work, as above).
Comment 1 Paul Gover 2023-12-01 16:20:54 UTC
emerge --info grub:

Portage 3.0.51 (python 3.11.5-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-13, glibc-2.37-r7, 6.6.3-git x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.6.3-git-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.37
KiB Mem:    32779368 total,  24140816 free
KiB Swap:  146483180 total, 146483180 free
Timestamp of repository gentoo: Wed, 29 Nov 2023 01:45:01 +0000
Head commit of repository gentoo: e20737182cd7ad513afad85237d891b4f945e6f8
Timestamp of repository Pauls: Thu, 04 Feb 2021 19:40:45 +0000
Timestamp of repository steam-overlay: Wed, 24 Feb 2021 15:55:35 +0000
sh dash 0.5.12
ld GNU ld (Gentoo 2.40 p7) 2.40.0
ccache version 4.8.2 [disabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-java/java-config:      2.3.1-r1::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.5::gentoo
dev-lang/rust-bin:         1.71.1::gentoo
dev-util/ccache:           4.8.2::gentoo
dev-util/cmake:            3.26.5-r2::gentoo
dev-util/meson:            1.0.1::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/openrc:           0.48::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r9::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo
sys-devel/gcc:             13.2.1_p20230826::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo
sys-devel/llvm:            16.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.uk.gentoo.org/gentoo-portage/
    priority: -1000
    volatile: False
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24

Pauls
    location: /usr/local/overlay
    masters: gentoo
    volatile: True

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: False

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo
    volatile: False

crossdev
    location: /var/db/repos/localrepo-crossdev
    masters: gentoo
    priority: 10
    volatile: False

Installed sets: @system
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-11.x"
AR="llvm-ar"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-march=native -O2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXX="clang++"
CXXFLAGS="-march=native -O2"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--ask --read-news --jobs 12 --load-average 31 --quiet-build y --quiet-fail y --usepkg"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo/ http://mirror.qubenet.net/mirror/gentoo/ http://www.mirrorservice.org/sites/distfiles.gentoo.org/"
LANG="en_GB.utf8"
LDFLAGS="-fuse-ld=mold -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed"
LEX="flex"
LINGUAS="en_GB en en_US"
MAKEOPTS="-j32 -l31"
NM="llvm-nm"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RANLIB="llvm-ranlib"
RUSTFLAGS="-C target-cpu=native"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities alsa amd64 bluetooth branding bzip2 cairo cdda cdr clang cleartype cli cmake corefonts crypt cups dbus declarative dri dts dvb dvd dvdr elogind encode exif ffmpeg flac fontconfig fortran gdbm gif glibc-omitfp gpm gstremer gtk gui iconv icu id3 id3tag ieee1394 ipv6 java joystick jpeg kde kwallet lcms libnotify libtirpc lm-sensors mad mdadm midi mmx mmxext mng mp3 mp4 mpeg multilib mysql ncurses nls nptl nsplugin ogg opencl opengl openh264 openmp orc pam pango pcre pdf pipewire plasma png policykit popcnt ppds printsupport pulseaudio qml qt5 readline reports sdl seccomp sndfile sound spell split-usr sql sse sse2 sse3 sse4a ssl startup-notification suid svg test-rust threads tiff truetype udev udisks unicode usb v4l vaapi vdpau vorbis vpx vulkan wallpapers wayland widgets wxwidgets x264 xattr xcb xcomposite xft xine xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="sony ptp2 directory" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 emu" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-GB en en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="wiki-publisher" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" SANE_BACKENDS="snapscan net" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

sys-boot/grub-2.06-r9::gentoo was built with the following:
USE="device-mapper fonts nls themes truetype -doc -efiemu -libzfs -mount -sdl (-test) -verify-sig" ABI_X86="(64)" GRUB_PLATFORMS="efi-64 emu -coreboot -efi-32 -ieee1275 (-loongson) -multiboot -pc -qemu (-qemu-mips) -uboot -xen -xen-32 -xen-pvh"
CFLAGS=""
CXXFLAGS="-march=bdver4 -mtune=znver3 -mno-fma4 -mno-lwp -mno-tbm -mno-xop -mno-xsaves -O2"
FEATURES="binpkg-logs userfetch ebuild-locks sandbox fixlafiles buildpkg-live protect-owned preserve-libs ipc-sandbox userpriv binpkg-dostrip xattr pid-sandbox usersandbox buildpkg unmerge-logs merge-sync distlocks network-sandbox parallel-fetch strict assume-digests config-protect-if-modified binpkg-docompress news unknown-features-warn multilib-strict unmerge-orphans qa-unresolved-soname-deps sfperms usersync"
LDFLAGS=""
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-03 07:07:36 UTC
FWIW grub 2.12 RCs are in tree to test but aren't kw'd given they're not final releases. They should be OK for you to try.
Comment 3 Paul Gover 2023-12-04 19:47:19 UTC
I forgot how easy it is to muck about with new grub versions on UEFI systems - of course it's all just files, no hidden stuff in the MBR - so easy to backup and test.

With sys-boot/grub-2.12_rc1-r1
a) grub-probe /boot returns f2fs, like it should
b) grub-install claimed to have worked
c) rebooting gave a menu stating "grub-2.12_rc1-r1", and my home-made (and complex) grub.cfg worked and booted into linux with no problems.

As the subject problem was sporadic, this doesn't mean I can say it's fixed, but at least the problem of not being able to grub-install on a straight f2fs disk is fixed.  I probably need to hard power-off a few times to be confident it can still reboot after that.

I'll 2.12_rc1-r1 it on my laptop, which has a root partition f2fs with extra options that broke 2.04 and 2.06 - I currently have an ext4 /boot partition there, and it would be nice to get rid of it.

Downside is that running grub-emu locked up, but that may have been me running it in the wrong environment - I'll play some more.
Comment 4 Paul Gover 2023-12-05 10:13:04 UTC
OK, Tried on my laptop with the f2fs partition with extra attributes.
grub-probe says that filesystem is f2fs, so it at least recognizes it.
However, when I start grub and enter the command line, while
ls (hd0,gpt5)
produces sensible output for an f2fs partition,
ls (hd0,gpt5)/
produces an empty list, where it should be the normal directories in a root partition (/bin, /lib etc.), so I don't believe it would be able to boot a kernel from this partition.

As for grub-emu, that worked OK from a terminal window under KDE.  The run that failed was from a tty, and perhaps that isn't a supported environment.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-23 20:38:57 UTC
Is grub-2.12 any better?

commit 76418694270557b6feb75381912a39569ee28d45
Author: Zac Medico <zmedico@gentoo.org>
Date:   Thu Dec 21 09:10:06 2023 -0800

    sys-boot/grub: add 2.12

    * Drop patch for util/grub.d/25_bli.in which was merged upstream.
    * Re-add unstable keywords for supported archs.
    * Create grub-core/extra_deps.lst missing from source tarball.

    Signed-off-by: Zac Medico <zmedico@gentoo.org>
Comment 6 Paul Gover 2023-12-24 13:42:30 UTC
Sorry, I wasn't clear in Comment 4: that WAS with 2.12
Comment 7 Mike Gilbert gentoo-dev 2024-04-03 02:14:18 UTC
You should seek support on the grub-devel mailing list upstream.