Bug 28662

Summary: drakboot crash on removable drive: not a F2FS filesystem (no superblock)
Product: Mageia Reporter: Antonin Roussel <antonin.roussel>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal CC: davidwhodgins, fri, ouaurelien
Version: 8Keywords: NEEDINFO
Target Milestone: ---   
Hardware: i586   
OS: Linux   
Whiteboard:
Source RPM: drakxtools-18.45-1.mga8.src.rpm CVE:
Status comment:
Attachments: lspcidrake -v
blkid
fstab
modprobe.conf
grub.cfg

Description Antonin Roussel 2021-03-27 15:04:48 CET
Description of problem:
After a net install on a USB stick (almost following https://wiki.mageia.org/en/Installing_Mageia_on_a_removable_drive), grub2 could not write on removable drive. So did on computer hard disk (/dev/sda/) and after boot mageia tried again on the removable drive. The bug is now trapped...

How reproducible: twice

Error message:

Le programme « drakboot » a planté avec l'erreur suivante :

  grub2-install failed: Installation pour la plate-forme i386-pc.
  grub2-install : attention : ../grub-core/fs/f2fs.c:813:not a F2FS filesystem (no superblock).
  grub2-install : attention : L'embarquage est impossible. GRUB ne peut être installé sur cette configuration qu'en utilisant les listes de blocs. Cependant, les listes de blocs ne sont PAS fiables et leur utilisation est déconseillée..
  grub2-install : erreur : refus de continuer avec les listes de blocs.
  	...propagated at /usr/lib/libDrakX/any.pm line 278.
  	...propagated at /usr/libexec/drakboot line 49.
  Perl's trace:
  drakbug::bug_handler() called from /usr/libexec/drakboot:49

Thème utilisé : Adwaita
Comment 1 Antonin Roussel 2021-03-27 15:10:14 CET
Created attachment 12531 [details]
lspcidrake -v
Comment 2 Antonin Roussel 2021-03-27 15:10:33 CET
Created attachment 12532 [details]
blkid
Comment 3 Antonin Roussel 2021-03-27 15:10:51 CET
Created attachment 12533 [details]
fstab
Comment 4 Antonin Roussel 2021-03-27 15:11:16 CET
Created attachment 12534 [details]
modprobe.conf
Comment 5 Antonin Roussel 2021-03-27 15:11:33 CET
Created attachment 12535 [details]
grub.cfg
Comment 6 Aurelien Oudelet 2021-04-03 17:00:25 CEST
(In reply to Antonin Roussel from comment #0)
> Le programme « drakboot » a planté avec l'erreur suivante :
> 
>   grub2-install failed: Installation pour la plate-forme i386-pc.
>   grub2-install : attention : ../grub-core/fs/f2fs.c:813:not a F2FS

Hi, you try to install Mageia on a F2FS volume in Legacy BIOS mode.

You can do this as long as you add at the very beginning of the disk a small partition name GRUB BIOS BOOT and with a 1 MB size. This is normally done by installer in automatic mode.

But, you choose to apply a custom mode. Please try again.

CC: (none) => ouaurelien

Comment 7 Aurelien Oudelet 2021-04-06 20:07:32 CEST
Reporter, could you please reply to the previous question? If you don't reply within two weeks from now, I will have to close this bug as OLD. Thank you.

Status: NEW => NEEDINFO
Keywords: (none) => NEEDINFO

Comment 8 Antonin Roussel 2021-04-12 14:40:45 CEST
Thank you

I have created a 1 MB leading partition, and have tried again my net install, with same error. So was wondering if my 1 MB partition is good.
It is now FAT32 with label GRUB_BIOS_B (truncated).

From another system (GRUB4DOS), I managed to boot in the fresh installed system in order to set a correct MBR with that command which could not terminate:
# mount /dev/sdb1 /mnt/setmbr
# grub2-install --target=i386-pc --debug --boot-directory=/mnt/setmbr/boot /dev/sdb
# grub2-install --target=i386-pc --debug --force --boot-directory=/mnt/setmbr/boot /dev/sdb

That was the _force_ setup of /boot/ directory in this 1 MB partition (sic). I Understand the setup started with the MBR before /boot/ directory.
Inspired from https://www.linuxsecrets.com/archlinux-wiki/wiki.archlinux.org/index.php/GRUB.1.html#Install_to_external_USB_stick

Sorry for the mess.

My need for booting from that F2FS volume is gone. So this bug report can be closed, or tested further. Remaining question, why have I not seen a command for MBR setting only?
Comment 9 Dave Hodgins 2021-04-12 15:31:54 CEST
The empty first partition has to be type x00, aka "BIOS boot or Empty partition"
in diskdrake.

CC: (none) => davidwhodgins

Comment 10 Antonin Roussel 2021-04-14 11:22:50 CEST
Thank you for your tips.

Despite, the previous step was stable, I had hard time to try again checking my leading partition type from mcc.mga<8, changing the partition type (and partitions table too). Rebuilding partition table with fdisk ended slightly broken. 

So I simply tried again from scratch, discovered on partition stage, the select box to choose the hard drive on which install Mageia... \o/ hurrah!

(If this select box had a blue glow like radio buttons or check boxes, it would have made me less blind)

"Pourquoi faire simple quand on peut faire compliqué ?" Shadock - Jacques Rouxel
KISS

Status: NEEDINFO => RESOLVED
Resolution: (none) => FIXED

Comment 11 Morgan Leijström 2021-04-14 17:50:47 CEST
I guess the 1MB partition is due to a part of grub2 need somewhere to reside?

BIOS boot partition seem not be needed when there is am ESP partition instead, right?  So for making a USB stick system to be able to boot from both legacy and EFI systems a partition for /boot/EFI should fulfil both needs.

I think this check should be added to diskdrake for the manual partitioning step.
- It do already check and warn for some other things.

WDYT?

CC: (none) => fri

Comment 12 Dave Hodgins 2021-04-14 20:10:28 CEST
When booting in bios firmware mode, grub2 has to be loaded from a part of the
drive that is not in a normal file system.

 - If the drive uses the mbr style partition layout (aka dos style), grub2 will
be stored in and loaded from the part of the first track immediately following
the first sector, where the master boot record and primary partition table are
stored.

 - If the drive uses the gpt style partition layout, grub2 will be stored in
and loaded from a "BIOS boot or Empty partition". I.E. space reserved for
use by grub2, that does not contain any type of a normal file system.

When booting in uefi firmware mode, one of the partitions must be a vfat
partition, the EFI system partition, where the bootloader will be stored,
that will be selected, loaded, and started by the uefi firmware.

The partition has to have a fat (vfat, fat12, etc.) file system that the
uefi firmware knows how to read.

If the drive uses a mbr partition table, it's type must be 0xEF.

If the drive uses a gpt partition table the gpt partition table entry must
also have the flags boot and esp set, and have the GUID type set to
C12A7328-F81F-11D2-BA4B-00A0C93EC93.

================================================================

So the "BIOS boot or Empty partition" partition is only needed if booting in
bios firmware mode, and using a gpt partition table.

The drak boot loader install tools will detect whether they are running in a
system that's been booted in bios or uefi firmware mode, and set up grub2 or
grub2-efi, as appropriate. It will not do both.

For bios firmware mode with a mbr partition table, it's technically possible
to install grub2 to a partition instead of the mbr, but the drak tools do not
support this. They did with grub legacy, but not with grub2. When that is
being done manually, the file system type has to be one that leaves space in
the first track of the partition that grub2 can use. f2fs is not one of the
types that leaves the needed space unused.

I suspect the problem initially reported was due to using a gpt partition
table and bios firmware mode and not having a proper
"BIOS boot or Empty partition".
Comment 13 Morgan Leijström 2021-04-15 00:56:13 CEST
Ah, thanks :)
Comment 14 Antonin Roussel 2021-04-15 09:46:57 CEST
The problem initially reported was due to using _customized_partition_mode_ during installation on a Legacy BIOS laptop. I selected the whole F2FS disk to make a single partition, expecting a MBR space would be left by design.

The reason why I did not select the default whole disk option on the F2FS disk, was I have not seen the disk select box which default choice was the laptop disk.

Wikipedia may display a nice picture about GRUB2 boot files https://en.wikipedia.org/wiki/BIOS_boot_partition
Comment 15 Dave Hodgins 2021-04-15 18:05:15 CEST
Changing to invalid, since f2fs is not intended to be used on the entire device
(not in a partition) and have that device used for the boot loader, so this
was not a Mageia bug that needed to be fixed.

A word of caution about using the entire device for any file system. When I
was first experimenting with lvm, I tried using an entire device (a usb stick)
as a lvm physical volume. Found out the hard way that booting into windows with
that device connected, windows would silently overwrite the first sector creating
an empty partition table. I think that was windows 98. No idea if windows still
does that or not, as I haven't used it in years.

Resolution: FIXED => INVALID