From nobody@FreeBSD.org  Mon Dec 16 19:47:32 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 60C1B655
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Dec 2013 19:47:32 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 4CFBC1353
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Dec 2013 19:47:32 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rBGJlVif013898
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 16 Dec 2013 19:47:31 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rBGJlVR0013888;
	Mon, 16 Dec 2013 19:47:31 GMT
	(envelope-from nobody)
Message-Id: <201312161947.rBGJlVR0013888@oldred.freebsd.org>
Date: Mon, 16 Dec 2013 19:47:31 GMT
From: Max Parmer <maxp@trystero.is>
To: freebsd-gnats-submit@FreeBSD.org
Subject: bootcode not installed correctly by bsdinstall
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         184910
>Category:       bin
>Synopsis:       bootcode not installed correctly by bsdinstall(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 16 19:50:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Sun May 04 05:11:34 UTC 2014
>Originator:     Max Parmer
>Release:        10.0-RC1
>Organization:
>Environment:
FreeBSD fatima.local 10.0-RC1 FreeBSD 10.0-RC1 #0 r259068: Sat Dec  7 17:45:20 UTC 2013     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Following a simple UFS autopartitioned install from `bsdinstall` on a Lenovo x220 (w/latest BIOS image available from Lenovo) the bootcode does not appear to be installed. I.e. the system reacts as if there is no bootable OS on the boot drive.

I experimented with GPT partitioning and also made some attempts to get bootcodes working for ZFS (with both but MBR and GPT schemes) and never quite sorted out what to bootcode to install where to render the install bootable.

It is my understanding the x220s (and some other Lenovo laptops) have some known idiosyncratic boot behavior, but it also seems as if bsdinstall has been skipping the branch wherein it installs bootcodes on this system.

In all experiments I used the memstick USB image

I have not experienced this issue with virtualized systems
>How-To-Repeat:
Install with any autopartitioned option in `bsdinstall` on a Lenovo x220 (regardless of legacy boot vs. EFI boot BIOS setting) with either a current or vintage BIOS installed.
>Fix:
To remedy this I have exited to a shell following the installer, and have manually run:

gpart bootcode -b /boot/mbr /dev/ada0
gpart bootcode -b /boot/boot /dev/ada0s1

>Release-Note:
>Audit-Trail:

From: Joseph Mingrone <jrm@ftfl.ca>
To: bug-followup@FreeBSD.org
Cc: maxp@trystero.is, Allan Jude <freebsd@allanjude.com>, "Teske\, Devin" <Devin.Teske@fisglobal.com>
Subject: RE:misc/184910:bootcode not installed correctly by bsdinstall
Date: Tue, 31 Dec 2013 09:49:20 -0400

 I can confirm there is still a problem with 10RC3.
 
 Background:
 The X220 has a quirk/feature/bug in that it refuses to boot from a GPT
 partitioned disk if you select "legacy boot" in the BIOS.  This
 apparently is a problem for GNU/Linux users as well. So, we're stuck
 with MBR partition schemes until UEFI booting is supported.
 
 Here is the bsdinstall_log from an attempt to install MBR/ZFS/GELI:
 http://ftfl.ca/misc/bsdinstall_log.
 
 Like Max, I'm told there is no OS installed after rebooting.
 
 After bsdinstall finishes if I try to manually add the boot code with
 
 # gpart bootcode -b /boot/mbr ada0
 # gpart set -a active -i 1 ada0
 # dd if=/boot/zfsboot of=/dev/ada1s1 count=1
 # dd if=/boot/zfsboot of=/dev/ada1s1a skip=1 seek=1024
 
 the two dd commands return operation not permitted errors even
 when setting kern.geom.debugflags=0x10.  Now after I reboot I see an
 error about not having ufs filesystems.
 
 If there is anything else I can test, just let me know.
 
 Joseph
>Unformatted:
