From owner-freebsd-arm@freebsd.org Thu Jul 14 18:27:38 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37BF6B99545 for ; Thu, 14 Jul 2016 18:27:38 +0000 (UTC) (envelope-from karl@denninger.net) Received: from mail.denninger.net (denninger.net [70.169.168.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6364165A for ; Thu, 14 Jul 2016 18:27:37 +0000 (UTC) (envelope-from karl@denninger.net) Received: from [192.168.1.40] (Karl-Desktop.Denninger.net [192.168.1.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.denninger.net (Postfix) with ESMTPSA id 24041224473 for ; Thu, 14 Jul 2016 13:27:35 -0500 (CDT) Subject: Re: Bizarre clone attempt failures on Raspberry Pi2... To: freebsd-arm@freebsd.org References: <548783e1-9047-68f7-5f50-449db684d602@denninger.net> <5475ea53-ae22-2634-6f2a-5737d1b0e308@denninger.net> <398ae56c-8893-f188-c210-cf7f19ccf433@denninger.net> <1468518953.72182.219.camel@freebsd.org> From: Karl Denninger Message-ID: <7a91fc79-1c85-fac8-aa3f-db90592f3f44@denninger.net> Date: Thu, 14 Jul 2016 13:27:35 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1468518953.72182.219.camel@freebsd.org> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-512; boundary="------------ms080000060206080005050305" X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2016 18:27:38 -0000 This is a cryptographically signed message in MIME format. --------------ms080000060206080005050305 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 7/14/2016 12:55, Ian Lepore wrote: > On Thu, 2016-07-14 at 11:44 -0500, Karl Denninger wrote: >> On 7/13/2016 21:44, Karl Denninger wrote: >>> On 7/13/2016 19:13, Paul Mather wrote: >>>>> On Jul 13, 2016, at 3:54 PM, Karl Denninger >>>>> wrote: >>>>> Oh, there is one difference: >>>>> >>>>> tunefs -p on the new device *works* (no idea why however since >>>>> there's >>>>> no slice there) where it FAILS on the original: >>>>> >>>>> root@Test-MCP:/home/karl # tunefs -p /dev/mmcsd0s2 >>>> Shouldn't this be /dev/mmcsd0s2a? You're referencing the entire >>>> BSD slice in the above command, not the UFS partition upon which >>>> the rootfs lives. >>> Right. Here's the issue; it doesn't work on the original disk (as >>> it >>> shouldn't) on the entire BSD slice but... >>>>> tunefs: /dev/mmcsd0s2: could not read superblock to fill out >>>>> disk >>>>> >>>>> root@Test-MCP:/home/karl # tunefs -p /dev/da0s2 >>>>> tunefs: POSIX.1e ACLs: (-a) =20 >>>>> disabled >>>>> tunefs: NFSv4 ACLs: (-N) =20 >>>>> disabled >>>>> tunefs: MAC multilabel: (-l) =20 >>>>> disabled >>>>> tunefs: soft updates: (-n) =20 >>>>> enabled >>>>> tunefs: soft update journaling: (-j) =20 >>>>> disabled >>>>> tunefs: gjournal: (-J) =20 >>>>> disabled >>>>> tunefs: trim: (-t) =20 >>>>> disabled >>>>> tunefs: maximum blocks per file in a cylinder group: (-e) 4096 >>>>> tunefs: average file size: (-f) =20 >>>>> 16384 >>>>> tunefs: average number of files in a directory: (-s) 64 >>>>> tunefs: minimum percentage of free space: (-m) 8% >>>>> tunefs: space to hold for metadata blocks: (-k) 6408 >>>>> tunefs: optimization preference: (-o) time >>>>> tunefs: volume label: (-L) =20 >>>>> rootfs >>>> Cheers, >>>> >>>> Paul. >>> It DOES on the "clone"! >>> >>> It ALSO does on the "a" partition of the clone. >>> >>> This implies that gpart screwed up the partitioning, but THAT >>> leaves >>> open how and why the original partitioning (which is defined here >>> https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20Pi%202%20image) >>> works >>> at all, since that's what I'm doing -- and yet it gives the results >>> as >>> above (and no boot when I'm done.) >>> >> Ok, so what's broken here folks? This is likely to blow up soon >> enough >> on the build systems that the people who are building snapshot >> releases >> are using (once they update); I assume this is a function of some >> sort >> of change that was made somewhere upstream in the system. >> >> The format of the card has to be: >> >> 1. MBR >> 2. First partition is MSDOS (Type "!12") with the various boot code >> on >> it (ubldr, etc.) This is fine. >> 3. The second partition has to be a "BSD" format partition (old >> -style) >> 4. Inside the second partition is a "traditional" BSD labeled >> (bsdlabel >> style) partititon table. >> >> Up to #2 all goes fine on an attached SD card: >> # gpart show da0 >> =3D> 63 62552001 da0 MBR (30G) >> 63 102400 1 !12 (50M) >> 102463 62449601 - free - (30G) >> >> Now we try to create the BSD labeled piece -- I got this from the >> crochet disk blob creator, incidentally, along with the FreeBSD Wiki >> (at >> https://wiki.freebsd.org/FreeBSD/arm/Raspberry Pi 2 image) >> >> # gpart add -t freebsd -a 4m /dev/da0 >> da0s2 added >> # gpart create -s BSD /dev/da0s2 >> *gpart: geom 'da0s2': File exists* >> >> *Heh, what was that? :)* >> > There's nothing new or different-on-rpi about this. There was > previously a BSD geom there.=20 No there wasn't. It was a blank (brand new) card the first time around; it had a MSDOS filesystem on it (as do all new cards) but *no* BSD-specific geom anything on it. > To reliably create a new layout regardless of what may be present > already on the media, you have two choices: > > 1 - dd zeroes to the entire device > 2 - use the "no commit" feature of gpart Actually in the case at hand #1 isn't impractical since I really only care about the first 100MB or so being zeroed. The reason is that my boot block (the MSDOS fs) is ~50Mb and the label is obviously next, so if we zero the first 100MB we're fine. And in fact that does work. > When you pass no '-f ' to a gpart command, it automatically adds= > the "-f C" (commit) flag behind your back. There is no "don't commit" > flag, so (this is surrealistically crazy...) what you're supposed to do= > is pass an invalid flag, which it won't complain about, in order to > prevent it from automatically adding that 'C' flag you didn't even > realize existed. (This is where *I* curse whoever coded this mess.) > > When you don't commit, the changes take place in a sort of 'virtual > workspace' and nothing on the physical disk changes until you do a > "gpart commit" (or "gpart undo" to discard the changes). Making all > this much-less-cool that it's sounding right now, there is no automatic= > recursion for commit and undo... if you create a bunch of nested stuff > (a slice, a geom within that slice, parititions within that geom), then= > you have to commit all the pending new geoms *in reverse order of how > they were created*. > > So, using da0 (since it's shorter to type), the sequence goes like: > > gpart destroy -f x -F da0 > gpart create -f x -s MBR da0 > gpart add -f x -t \!12 -s 64M -a 4M da0 > gpart add -f x -t freebsd -a 4M da0 > gpart destroy -f x -F da0s2 > gpart create -f x -s BSD da0s2 > gpart add -f x -t freebsd-ufs da0s2 > gpart commit da0s2 > gpart commit da0 > newfs_msdos /dev/da0s1 > newfs -U /dev/da0s2a > > And that reliably creates a fresh rpi-style layout regardless of what > was on the media before you started. Ok, I will try this, BUT I suspect it's still screwed (blind) because when I zeroed the front of the disk I got a "correct" partition layout but after populating it what I get still hangs after it mounts root in the same place. The way to prevent the alignment issue from coming up is to specify a "-b" switch on the "add", giving you a block offset.=20 "-b 64" is sufficient; now if the system tries to "taste" da0s2 it will fail (as it does for the card that is running) but "tasting" da0s2a succeeds. > Now, to address the question of the filesystem existing at da0s2 versus= > da0s2a, the difference is alignment. Making things even more > confusing, alignment (if you don't specify it) sometimes changes based > on the type and brand of usb sdcard reader you're using and the fake > geometry values it reports to the system. (A USB reader almost always > reports different fake geometry than a native sd slot would on a > machine with non-USB based sd support.) Yes, I understand that; if the alignment matches thus the "a" partition starts at offset zero then you can actually reference that (although length might be wrong) with the base device. After all, what it really does is look at the blocks to see if the magic number is good, and if so it tries to read and process it. But this doesn't explain why, after getting a layout that's correct (by writing zeros to the front of the card first, so anything that "might" be there isn't) and copying all the file structure over (which facially not only appears to be correct but the loader finds and loads the kernel, AND the root filesystem mounts!) the system hangs, apparently just before init gets started. If init can't be found you should get a complaint (been there, done that) on the console but there is no complaint of any sort. I've gotten through the bad structure issue on the SD card, and am now left with "why does it hang on boot -- with no error or other indication of what the problem is" after the kernel loads *and* the root filesystem mounts? --=20 Karl Denninger karl@denninger.net /The Market Ticker/ /[S/MIME encrypted email preferred]/ --------------ms080000060206080005050305 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwEAAKCC Bl8wggZbMIIEQ6ADAgECAgEpMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzEQMA4G A1UECBMHRmxvcmlkYTESMBAGA1UEBxMJTmljZXZpbGxlMRkwFwYDVQQKExBDdWRhIFN5c3Rl bXMgTExDMRwwGgYDVQQDExNDdWRhIFN5c3RlbXMgTExDIENBMSIwIAYJKoZIhvcNAQkBFhND dWRhIFN5c3RlbXMgTExDIENBMB4XDTE1MDQyMTAyMjE1OVoXDTIwMDQxOTAyMjE1OVowWjEL MAkGA1UEBhMCVVMxEDAOBgNVBAgTB0Zsb3JpZGExGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM TEMxHjAcBgNVBAMTFUthcmwgRGVubmluZ2VyIChPQ1NQKTCCAiIwDQYJKoZIhvcNAQEBBQAD ggIPADCCAgoCggIBALmEWPhAdphrWd4K5VTvE5pxL3blRQPyGF3ApjUjgtavqU1Y8pbI3Byg XDj2/Uz9Si8XVj/kNbKEjkRh5SsNvx3Fc0oQ1uVjyCq7zC/kctF7yLzQbvWnU4grAPZ3IuAp 3/fFxIVaXpxEdKmyZAVDhk9az+IgHH43rdJRIMzxJ5vqQMb+n2EjadVqiGPbtG9aZEImlq7f IYDTnKyToi23PAnkPwwT+q1IkI2DTvf2jzWrhLR5DTX0fUYC0nxlHWbjgpiap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