Bug 227422

Summary: i386 mini-memstick 11-stable installer not recognized as bootable device on Lenovo x220
Product: Base System Reporter: Ed Maste <emaste>
Component: miscAssignee: Ed Maste <emaste>
Status: Closed FIXED    
Severity: Affects Only Me CC: allanjude
Priority: ---    
Version: 11.1-STABLE   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221477
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227954
Attachments:
Description Flags
switch i386 memstick to mbr none

Description Ed Maste freebsd_committer freebsd_triage 2018-04-10 14:48:01 UTC
I fetched an i386 mini-memstick snapshot image from https://download.freebsd.org/ftp/snapshots/ISO-IMAGES/11.1/FreeBSD-11.1-STABLE-i386-20180315-r330998-mini-memstick.img.xz and wrote it to a USB hard drive.

When attempting to boot on a Lenvo x220 laptop the BIOS does not recognize this as a bootable drive - it appears in the boot selection menu, but choosing it returns immediately to the selection menu, as occurs with other non-bootable drives.

For reference, same drive boots and kernel starts on a ASRock J3455B (but the kernel hangs for other reasons, under investigation elsewhere)
Comment 1 Ed Maste freebsd_committer freebsd_triage 2018-04-10 15:00:31 UTC
amd64 fails the same way on this hardware when BIOS configured for "legacy only" boot; UEFI boot is successful.
Comment 2 Allan Jude freebsd_committer freebsd_triage 2018-04-10 15:25:24 UTC
This is likely related to changes Benno has been making.

You might compare what is in that snapshot to what is in the 11.1 release .img


One option is to apply the lenovofix to the images, but it is not clear if that might cause issues on any other buggy BIOSes.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2018-04-10 16:32:55 UTC
11-1-RELEASE-i386 fails in the same way
Comment 4 Ed Maste freebsd_committer freebsd_triage 2018-04-10 17:07:43 UTC
Or perhaps we should just be using MBR
Comment 5 Ed Maste freebsd_committer freebsd_triage 2018-04-10 17:42:47 UTC
Perhaps:

diff --git a/release/i386/make-memstick.sh b/release/i386/make-memstick.sh
index 1943e07942c1..1eb5d57942e3 100755
--- a/release/i386/make-memstick.sh
+++ b/release/i386/make-memstick.sh
@@ -36,10 +36,8 @@ makefs -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${1}
 rm ${1}/etc/fstab
 rm ${1}/etc/rc.conf.local
 
-mkimg -s gpt -b ${1}/boot/pmbr \
-    -p freebsd-boot:=${1}/boot/gptboot \
-    -p freebsd-ufs:=${2}.part \
-    -p freebsd-swap::1M \
+mkimg -s mbr -b ${1}/boot/mbr \
+    -p freebsd:-"mkimg -s bsd -b ${1}/boot/boot -p freebsd-ufs:=${2}.part" \
     -o ${2}
 rm ${2}.part
Comment 6 Ed Maste freebsd_committer freebsd_triage 2018-04-12 18:25:35 UTC
Created attachment 192468 [details]
switch i386 memstick to mbr
Comment 7 Ed Maste freebsd_committer freebsd_triage 2018-04-12 18:42:57 UTC
Note the swap partition was added to work around a GPT issue and shouldn't be necessary on MBR:

Author: nwhitehorn <nwhitehorn@FreeBSD.org>
Date:   Sun Apr 27 16:34:59 2014 +0000

    loader's GPT support on BIOS does not seem to like the root filesystem
    being the last filesystem on the disk for some reason when made by this
    script. Add a vestigial swap partition to allow this to boot with QEMU
    BIOS.

Notes:
    svn path=/head/; revision=265017
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-04-12 19:00:47 UTC
A commit references this bug:

Author: emaste
Date: Thu Apr 12 19:00:22 UTC 2018
New revision: 332446
URL: https://svnweb.freebsd.org/changeset/base/332446

Log:
  switch i386 memstick installer images to MBR

  Some BIOSes have trouble booting from GPT in non-UEFI mode.  This is
  commonly reported with Lenovo laptops, including my x220.  As we do not
  currently support booting FreeBSD/i386 via UEFI there's no reason to
  prefer GPT.

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

  We may want to make the same change to amd64, although the issue there is
  mitigated by such systems booting via UEFI in the common case.

  PR:		227422
  Reviewed by:	gjb
  MFC after:	3 weeks
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/release/i386/make-memstick.sh
Comment 9 Ed Maste freebsd_committer freebsd_triage 2018-05-09 14:19:17 UTC
Can confirm FreeBSD-12.0-CURRENT-i386-20180503-r333209-memstick.img.xz boots on a variety of Lenovo hardware here that previously failed with pmbr+gpt memsticks (X220 & X230 Thinkpads, E31 ThinkStation)
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-05-09 14:39:02 UTC
A commit references this bug:

Author: emaste
Date: Wed May  9 14:38:07 UTC 2018
New revision: 333410
URL: https://svnweb.freebsd.org/changeset/base/333410

Log:
  MFC r332446: switch i386 memstick installer images to MBR

  Some BIOSes have trouble booting from GPT in non-UEFI mode.  This is
  commonly reported with Lenovo laptops, including my x220.  As we do not
  currently support booting FreeBSD/i386 via UEFI there's no reason to
  prefer GPT.

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

  We may want to make the same change to amd64, although the issue there is
  mitigated by such systems booting via UEFI in the common case.

  PR:		227422
  Approved by:	re
  Relnotes:	Yes
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/11/
  stable/11/release/i386/make-memstick.sh
Comment 11 Ed Maste freebsd_committer freebsd_triage 2018-05-28 21:21:37 UTC
(In reply to Allan Jude from comment #2)
> This is likely related to changes Benno has been making.

This is with the existing dual-mode memstick images, not Benno's triple-mode ISO image work.