From owner-freebsd-stable@FreeBSD.ORG Mon May 13 03:54:47 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A57D9ECC for ; Mon, 13 May 2013 03:54:47 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (wollman-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) by mx1.freebsd.org (Postfix) with ESMTP id 4764022C for ; Mon, 13 May 2013 03:54:46 +0000 (UTC) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.14.5/8.14.5) with ESMTP id r4D3sjTA017173; Sun, 12 May 2013 23:54:45 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.14.5/8.14.4/Submit) id r4D3sjUu017172; Sun, 12 May 2013 23:54:45 -0400 (EDT) (envelope-from wollman) Date: Sun, 12 May 2013 23:54:45 -0400 (EDT) From: Garrett Wollman Message-Id: <201305130354.r4D3sjUu017172@hergotha.csail.mit.edu> To: jdc@koitsu.org Subject: Re: Reinstalling boot blocks on a ZFS-only system X-Newsgroups: mit.lcs.mail.freebsd-stable In-Reply-To: <20130513032838.GA76253@icarus.home.lan> References: <201305130314.r4D3EKaJ016781@hergotha.csail.mit.edu> Organization: none X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (hergotha.csail.mit.edu [127.0.0.1]); Sun, 12 May 2013 23:54:46 -0400 (EDT) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on hergotha.csail.mit.edu Cc: freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 May 2013 03:54:47 -0000 In article <20130513032838.GA76253@icarus.home.lan>, jdc@koitsu.org write: >https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot > >5. Install the Protected MBR (pmbr) and gptzfsboot loader Bug #1: "Protective", not "Protected". > Fixit# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsboot -i 1 ad0 > > This may fail with an "operation not permitted" error message, since the > kernel likes to protect critical parts of the disk. If this happens for > you, run: > > Fixit# sysctl kern.geom.debugflags=0x10 I suppose the bit that's missing here is: ...and then file a bug report, with severity "serious" and priority "high", because this indicates that something is seriously broken in the kernel's implementation of GPT partitioning. The only way this step can fail (absent bugs) is if something (other than gpart) has either the whole-disk device or the partition 1 device open in exclusive mode, which is a "can't happen" condition at this stage in an installation. (Well, it can happen if the disk you are in the process of destroying has a still-mounted filesystem on it, which is what the code is supposed to prevent!) This little bit of cargo-culting used to be necessary for *MBR* and *bsdlabel* partitioning, before the days of "gpart bootcode", to update the boot0 and embedded partition-boot (boot1) blocks while the filesystem was mounted, because the bsdlabel boot blocks are stored in the first 64k of the root filesystem. When using GPT, the boot blocks are stored in the boot partition, which doesn't have a mountable filesystem on it, so should never be open for write except when gpart bootcode is doing the deed. -GAWollman