Bug 227954 - FreeBSD memstick doesn't boot off of non-efi systems
Summary: FreeBSD memstick doesn't boot off of non-efi systems
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-03 16:43 UTC by jollyjester
Modified: 2018-11-16 12:08 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jollyjester 2018-05-03 16:43:56 UTC
While writing an mini-memstick image of the FreeBSD operating system onto a USB, the said USB doesn't boot off of an non-EFI system
Comment 1 Ed Maste freebsd_committer 2018-05-05 01:00:43 UTC
I have booted FreeBSD memstick images in both UEFI and CSM (legacy BIOS) modes.

Please report back with the specific memstick image and hardware that you tested.
Comment 2 jollyjester 2018-05-05 08:24:00 UTC
(In reply to Ed Maste from comment #1)
I used the "FreeBSD-11.1-RELEASE-amd64-memstick.img"
And my hardware is as follows

CPU
	Intel Pentium 4 630
	Prescott 90nm Technology
RAM
	2.00GB Dual-Channel DDR2 @ 332MHz (5-5-5-15)
Motherboard
	Hewlett-Packard 09F0h (XU1 PROCESSOR)	58 °C
Graphics
	W1946 (1360x768@60Hz)
	1024MB NVIDIA GeForce 210 (ZOTAC International)	43 °C
Storage
	74GB Western Digital WDC WD800JD-60LSA5 ATA Device (SATA)	33 °C
Optical Drives
	LITE-ON DVD SOHD-16P9S ATA Device
Audio
	Realtek High Definition Audio
Comment 3 Glen Barber freebsd_committer 2018-05-07 15:25:04 UTC
Can you try with the most recent 11.2-PRERELEASE image?  There have been a few changes to how the images are created, which I believe may resolve this.

https://download.freebsd.org/ftp/snapshots/ISO-IMAGES/11.2/FreeBSD-11.2-PRERELEASE-amd64-20180504-r333226-memstick.img
Comment 4 Ed Maste freebsd_committer 2018-05-28 17:21:45 UTC
There are two changes in review for this issue:

* https://reviews.freebsd.org/D15598 (by imp@)
* https://reviews.freebsd.org/D15599

I have a test image built with D15598 and the equivalent of D15599 at https://people.freebsd.org/~emaste/mini-image-2018-05-28-amd64.xz  Can you uncompress and write it to a memstick and see if it boots on your hardware?
Comment 5 commit-hook freebsd_committer 2018-05-29 15:07:07 UTC
A commit references this bug:

Author: emaste
Date: Tue May 29 15:06:13 UTC 2018
New revision: 334337
URL: https://svnweb.freebsd.org/changeset/base/334337

Log:
  switch amd64 memstick installer images to MBR

  A good number of BIOSes have trouble booting from GPT in non-UEFI mode.
  This is commonly reported with Lenovo desktops and laptops (including
  X220, X230, T430, and E31) and Dell systems.  Although UEFI is the
  preferred amd64 boot method on recent hardware, older hardware does not
  support UEFI, a user may wish to boot via BIOS/CSM, and some systems
  that support UEFI fail to boot FreeBSD via UEFI (such as an old
  AMD FX-6100 that I have).

  With this change amd64 memsticks remain dual-mode (booting from either
  UEFI or CSM); the partitioning type is just switched from GPT to MBR.

  The "vestigial swap partition" in the GPT scheme was added in r265017 to
  work around some issue with loader's GPT support, so we should not need
  it when using MBR.

  There is some concern that future UEFI systems may not boot from MBR,
  but I am not aware of any today.  In any case the likely path forward
  for our installers is to migrate to CD/USB combo images, and if it
  becomes necessary introduce a separate memstick specifically for the
  MBR BIOS/CSM case.

  PR:		227954
  Reviewed by:	gjb, imp, tsoome
  MFC after:	3 days
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D15599

Changes:
  head/release/amd64/make-memstick.sh
Comment 6 Ed Maste freebsd_committer 2018-05-29 15:25:30 UTC
The next -current snapshot builds will include the switch to MBR partitioning. I hope to receive a number of test reports on those (or the test image I built) before MFCing the change to 11 for RC2.
Comment 7 commit-hook freebsd_committer 2018-05-31 20:02:24 UTC
A commit references this bug:

Author: gjb
Date: Thu May 31 20:01:59 UTC 2018
New revision: 334444
URL: https://svnweb.freebsd.org/changeset/base/334444

Log:
  MFC r334310, r334337:

   r334310 (imp):
    Teach ufs_module.c about bsd labels and probe 'a' partition.

    If the check for a UFS partition at offset 0 on the disk fails, check
    to see if there's a BSD disklabel at block 1 (standard) or at offset
    512 (install images assume 512 sector size). If found, probe for UFS
    on the 'a' partition.

    This fixes UEFI booting images from a BSD labeled MBR slice when the
    'a' partiton isn't at offset 0. This is a stop-gap fix since we plan
    on removing boot1.efi in FreeBSD 12. We can't easily do that for 11.2,
    however, hence the short MFC window.

   r334337 (emaste):
    switch amd64 memstick installer images to MBR

    A good number of BIOSes have trouble booting from GPT in non-UEFI
    mode.

    With this change amd64 memsticks remain dual-mode (booting from either
    UEFI or CSM); the partitioning type is just switched from GPT to MBR.

  PR:		227954

  Note, there are two changes specific to stable/11 where there is code
  that had diverged from head and never merged back.  The two changes are
  an include in stand/efi/boot1/ufs_module.c, replacing sys/disk/bsd.h
  with sys/disklabel.h and replacing BSD_MAGIC with DISKMAGIC in the
  same file.  The latter two are direct commits to stable/11 in order to
  avoid unexpected regressions at this point of the 11.2 cycle.  Thank
  you to imp@ for pointing out what changes needed to be made.

  Approved by:	re (marius)

  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/11/
  stable/11/release/amd64/make-memstick.sh
  stable/11/stand/efi/boot1/boot_module.h
  stable/11/stand/efi/boot1/ufs_module.c
Comment 8 Ed Maste freebsd_committer 2018-10-04 01:24:33 UTC
jollyjester, can you please try one of the recent snapshot images on your machine and check that this is fixed?
Comment 9 Petr Ketner 2018-11-16 12:08:13 UTC
(In reply to commit-hook from comment #5)

This commit breaks UEFI specification and the memstick will/does not boot on most if not all UEFI-only machines (Tested on Asus E203NA).

https://superuser.com/questions/563074/do-hard-drives-need-a-guid-partition-table-gpt-to-boot-in-uefi-mode

The hybrid ISO image dd'd to USB flash works fine. Handbook should probably mention that the ISO can be used with USB flash.