From owner-freebsd-current@FreeBSD.ORG Fri Oct 7 20:37:40 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50002106566B for ; Fri, 7 Oct 2011 20:37:40 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id B2B7F8FC18 for ; Fri, 7 Oct 2011 20:37:39 +0000 (UTC) Received: by wyj26 with SMTP id 26so5887701wyj.13 for ; Fri, 07 Oct 2011 13:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=04QF3sGFjRnPWK6ejcjBEveCatx/kUFc7l1onFsoTws=; b=YMJR+ZB1QDPr5eKYX7UNHWhfDNJeyo2TIwsDWsIZmX461faT4d5tmIEoWor5IZ3DGl YDch5g7ASOZPkSJYRrdm35qGml9e7TyXmcFm8z0byvL04r3pVwEeGsGcdXPqGbK0Bzn4 tTH+s9JT0VvTq7dA3x0hbsQsy1DOqkvM2hnNc= MIME-Version: 1.0 Received: by 10.227.135.130 with SMTP id n2mr2874861wbt.51.1318019858404; Fri, 07 Oct 2011 13:37:38 -0700 (PDT) Received: by 10.180.103.33 with HTTP; Fri, 7 Oct 2011 13:37:38 -0700 (PDT) In-Reply-To: References: <81477.1318015137@critter.freebsd.dk> <4E8F55CC.3060302@FreeBSD.org> Date: Fri, 7 Oct 2011 16:37:38 -0400 Message-ID: From: Arnaud Lacombe To: Warren Block Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Garrett Cooper , Glen Barber , Poul-Henning Kamp , freebsd-current@freebsd.org, Benjamin Kaduk Subject: Re: aliasing (or renaming) kern.geom.debugflags X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 20:37:40 -0000 Hi, On Fri, Oct 7, 2011 at 4:27 PM, Warren Block wrote: > On Fri, 7 Oct 2011, Glen Barber wrote: > >> Hi, >> >> On 10/7/11 3:18 PM, Poul-Henning Kamp wrote: >>>> >>>> My guess is that GEOM isn't letting go of the GPT table and you have >>>> multiple partitions in the GPT table and you're not destroying them >>>> hierarchically in a proper manner.. but again, that's just a guess >>>> based on hazy recollection. >>> >>> If none of the GPT partitions are open, you should be able to >>> open /dev/da0. =A0If not, the GPT geom class is buggy. >>> >> >> In my experience, without kern.geom.debugflags=3D16, the MBR will not be >> written to the memstick, leaving you with what would effectively be a >> coaster in the not-so-distant past. > > Tried it just now with the 9.0-BETA3 memstick image. > > # dd if=3D/tmp/FreeBSD-9.0-BETA3-amd64-memstick.img of=3D/dev/da0 bs=3D64= k > 10463+1 records in > 10463+1 records out > 685731840 bytes transferred in 52.614157 secs (13033219 bytes/sec) > # mount /dev/da0p2 /mnt > # dd if=3D/tmp/FreeBSD-9.0-BETA3-amd64-memstick.img of=3D/dev/da0 bs=3D64= k > dd: /dev/da0: Operation not permitted > # sysctl kern.geom.debugflags=3D16 > kern.geom.debugflags: 0 -> 16 > # dd if=3D/tmp/FreeBSD-9.0-BETA3-amd64-memstick.img of=3D/dev/da0 bs=3D64= k > 10463+1 records in > 10463+1 records out > 685731840 bytes transferred in 52.915362 secs (12959031 bytes/sec) > in the mean time, some background application issued a sync(2), corrupting part of what you just wrote, if not crashing the kernel. > Followed by removing the memory stick without unmounting it to avoid > overwriting part of the image. =A0No obvious problems, but no, it's not > polite. =A0(I'm thinking "automounter" here.) > > We could make the normal procedure just the dd, followed by a note: > > =A0If this gives an 'Operation not permitted' error, make sure that the > =A0target device is not in use or being automounted by some helpful > =A0utility program. > > And maybe > > =A0If the error still appears and no other options are available, > =A0 =A0sysctl kern.geomflags.debug=3D16 > =A0will override the system safety and allow writes to the device. > Then you can start to introduce backdoor for every single kernel-enforced policy. `kern.geomflags.debug=3D16' should not be used by the lambda user. - Arnaud