Bug 1161641 - grub2-install fails with "not a directory" error
grub2-install fails with "not a directory" error
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Bootloader
Current
Other Other
: P5 - None : Normal (vote)
: Current
Assigned To: don matheson
Jiri Srain
: DSLA_REQUIRED
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-23 07:24 UTC by Stefan Seyfried
Modified: 2021-10-20 13:28 UTC (History)
3 users (show)

See Also:
Found By: Customer
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
reproducer script (3.04 KB, application/x-shellscript)
2020-01-23 07:24 UTC, Stefan Seyfried
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Seyfried 2020-01-23 07:24:49 UTC
Created attachment 828118 [details]
reproducer script

I recently came across a strange grub2-install error when building kiwi images in OBS.

The reason is a bug in the minix file system detection.
I filed upstream bug https://savannah.gnu.org/bugs/index.php?57652

Note I experienced this on SLES15-SP1.
The bug is still present in current Tumbleweed (see attached reproducer script)
This bug thus needs fixing in all supported openSUSE releases.

The reproducer-script is called as root like

# bash ./grub-bug-57652-reproduce-suse.sh /tmp/grub-test.img /mnt

/tmp needs 1GB of free storage to store the image.
Comment 2 Stefan Seyfried 2020-01-24 10:23:08 UTC
maybe this would be good enough as  a minimal-intrusive fix:

diff --git a/Makefile.am b/Makefile.am
index 1f4bb9b8c..0bef226d3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,8 +42,11 @@ libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgru
          -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
 CLEANFILES += libgrub.pp
 
+# the grep/sed ensures that ext2 gets initialized before minix*
+# see https://savannah.gnu.org/bugs/?57652
 libgrub_a_init.lst: libgrub.pp
        cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1)
+       if grep ^ext2 $@ >/dev/null; then sed '/ext2/d;/newc/iext2' < $@ > $@.tmp && mv $@.tmp $@; fi
 CLEANFILES += libgrub_a_init.lst
 
 libgrub_a_init.c: libgrub_a_init.lst $(top_srcdir)/geninit.sh

It does not fix the minix detection code, but instead makes sure that ext[234] is tried before minix
Comment 3 Michael Chang 2020-02-03 09:27:49 UTC
I think using sed '/ext2/d;$aext2' to put ext2 to last of the list in case newc were renamed or removed could be a better way, but the patch is good to go for me as well.

Would you please send your patch upstream ? At least it helps to draw attention of the developer of minix who may be able to come up with better solution ?
Comment 4 Stefan Seyfried 2020-02-03 18:11:58 UTC
As the order of FS detection might cause regressions (at least theoretically), I just wanted to change as little as possible, but putting ext2 last will probably work as well.

I filed upstream bug https://savannah.gnu.org/bugs/index.php?57652 but it has not drawn any attention yet.
Comment 5 Michael Chang 2020-02-04 06:03:39 UTC
(In reply to Stefan Seyfried from comment #4)
> As the order of FS detection might cause regressions (at least
> theoretically), I just wanted to change as little as possible,

Indeed this is something to think about.

> I filed upstream bug https://savannah.gnu.org/bugs/index.php?57652 but it
> has not drawn any attention yet.

I am going to including your patch in comment#2 to openSUSE. We could resort to upstream mailing list to draw attention if no update in a few days.

Thanks for the report & fix.
Comment 6 Michael Chang 2020-02-06 04:59:16 UTC
(In reply to Michael Chang from comment #5)
> (In reply to Stefan Seyfried from comment #4)

[snip]

> I am going to including your patch in comment#2 to openSUSE. We could resort
> to upstream mailing list to draw attention if no update in a few days.

The patch is submitted to openSUSE Factory. Feel free to reopen if anything missing.

Thanks.
Comment 7 Stefan Seyfried 2020-02-06 06:58:12 UTC
Now that there is obviously another private bug for the SLES updates, can we please reopen this bug? I deliberately filed it against openSUSE so that everyone can see it. Thanks.
Comment 8 Stefan Seyfried 2020-02-06 06:58:39 UTC
with "reopen" I meant "make it visible to the public", sorry.
Comment 9 Benjamin Brunner 2020-02-06 10:51:01 UTC
Stefan, I've moved the bug back to openSUSE again. Please let me know if something is missing. Sorry for the inconvenience!
Comment 11 Swamp Workflow Management 2020-03-23 20:22:19 UTC
SUSE-RU-2020:0749-1: An update that has two recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1161641,1162403
CVE References: 
Sources used:
SUSE Linux Enterprise Module for Server Applications 15-SP1 (src):    grub2-2.02-26.12.1
SUSE Linux Enterprise Module for Open Buildservice Development Tools 15-SP1 (src):    grub2-2.02-26.12.1
SUSE Linux Enterprise Module for Basesystem 15-SP1 (src):    grub2-2.02-26.12.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 12 Swamp Workflow Management 2020-03-23 20:36:08 UTC
SUSE-RU-2020:0748-1: An update that has two recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1161641,1162403
CVE References: 
Sources used:
SUSE Linux Enterprise Server for SAP 15 (src):    grub2-2.02-19.36.1
SUSE Linux Enterprise Server 15-LTSS (src):    grub2-2.02-19.36.1
SUSE Linux Enterprise High Performance Computing 15-LTSS (src):    grub2-2.02-19.36.1
SUSE Linux Enterprise High Performance Computing 15-ESPOS (src):    grub2-2.02-19.36.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 13 Swamp Workflow Management 2020-03-27 14:15:49 UTC
SUSE-RU-2020:0804-1: An update that has two recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1161641,1162403
CVE References: 
Sources used:
SUSE Linux Enterprise Server 12-SP5 (src):    grub2-2.02-12.21.1
SUSE Linux Enterprise Server 12-SP4 (src):    grub2-2.02-12.21.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 14 Swamp Workflow Management 2020-03-29 04:15:44 UTC
openSUSE-RU-2020:0401-1: An update that has two recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1161641,1162403
CVE References: 
Sources used:
openSUSE Leap 15.1 (src):    grub2-2.02-lp151.21.12.1
Comment 18 Swamp Workflow Management 2021-10-20 13:28:15 UTC
SUSE-RU-2021:3478-1: An update that has two recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1161641,1162403
CVE References: 
JIRA References: 
Sources used:
SUSE OpenStack Cloud Crowbar 9 (src):    grub2-2.02-121.12.1
SUSE OpenStack Cloud 9 (src):    grub2-2.02-121.12.1
SUSE Linux Enterprise Server for SAP 12-SP4 (src):    grub2-2.02-121.12.1
SUSE Linux Enterprise Server 12-SP5 (src):    grub2-2.02-121.12.1
SUSE Linux Enterprise Server 12-SP4-LTSS (src):    grub2-2.02-121.12.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.