From owner-freebsd-hackers@freebsd.org Mon Jun 20 11:08:56 2016 Return-Path: Delivered-To: freebsd-hackers@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 570EDA7BFB5 for ; Mon, 20 Jun 2016 11:08:56 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 306AF11FE for ; Mon, 20 Jun 2016 11:08:56 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-242-176.lns20.per4.internode.on.net [121.45.242.176]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u5KB8osA087678 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Mon, 20 Jun 2016 04:08:53 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: gpart inside jails To: freebsd-hackers@freebsd.org References: <94b54de6-0817-3171-7715-4610d7e985a4@demig.de> <307505f1-a05f-f869-bb9f-027262e74eb0@freebsd.org> <0d90638f-ca86-5b75-3682-e45ab8220874@demig.de> <1bf8d133-99ac-1933-378b-0f8cc71281df@demig.de> From: Julian Elischer Message-ID: Date: Mon, 20 Jun 2016 19:08:44 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1bf8d133-99ac-1933-378b-0f8cc71281df@demig.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 11:08:56 -0000 On 20/06/2016 3:07 PM, Norbert Koch wrote: > > > Am 2016-06-20 um 08:44 schrieb Julian Elischer: >> On 17/06/2016 2:21 PM, Norbert Koch wrote: >>> >>> >>> Am 2016-06-16 um 17:39 schrieb Allan Jude: >>>> On 2016-06-16 11:23, Norbert Koch wrote: >>>>> Hello, >>>>> >>>>> for creating freebsd boot flash media for embedded devices >>>>> I use mdconfig/gpart. >>>>> >>>>> Recently I put my 32-bit build machines into a jail under a >>>>> 64-bit machine. >>>>> This is my configuration: >>>>> >>>>> Host: FreeBSD-10.3/amd64 >>>>> Jail1: FreeBSD-9.1/i386 >>>>> Jail2: FreeBSD-10.3/i386 >>>>> Jail3: FreeBSD-10.3/amd64 >>>>> >>>>> If I jexec gpart status I get this: >>>>> Jail1: segmentation fault >>>>> Jail2: segmentation fault >>>>> Jail3: correct result as seen under host system >>>>> >>>>> So, this is obviously a 32/64 bit issue. Any idea? >>>>> >>>>> Thank you, >>>>> Norbert Koch >>>>> >>>>> _______________________________________________ >>>>> freebsd-hackers@freebsd.org mailing list >>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers >>>>> To unsubscribe, send any mail to >>>>> "freebsd-hackers-unsubscribe@freebsd.org" >>>> You might want to look at: >>>> >>>> makefs(8): create a ufs filesystem in a file, from a directory >>>> tree or >>>> mtree file. This allows you to avoid mdconfig, and can be done as a >>>> non-root user. >>>> >>>> mkimg(8): create a disk or VM (vmdk, vdi, qcow2, raw, etc) image >>>> from >>>> one or more file systems. Allows you to create the partitions and >>>> load >>>> the boot code etc. This allows you to avoid gpart, and can be >>>> done as a >>>> non-root user. >>>> >>> >>> Thank you. I'll try these. >>> >>> >>>> Re: why it crashes: I am guessing the kernel interface between >>>> gpart and >>>> geom_part.ko is not 32/64 safe or something. Someone else with a >>>> better >>>> informed opinion may be able to help you resolve the issue. Maybe >>>> the >>>> above workarounds will help. >>>> >>> >> for a 64bit kernel moduel to work with a 32 bit user space system, >> all paths from userspace to module have to translate values back >> and forth as needed. I can quite believe that making such shims for >> geom has not been a high priorlty. >> >> On the other hand, you can cheat, by adding 64 bit versions of the >> gpart and related programs into your 32 bit jail. >> they should run just fine and you can use libmap.conf if there are >> any library collisions that you need to handle. >> Evrything else should run fie to generate the images.. >> I'm not sure though how you would MOUNT the images inside the jail >> once you have partitioned them. >> > > You are right. Mounting became my next problem after solving the > gpart issue. > After having delegated the mount to the host by sending a command > via ssh > (not really elegant or secure, I know) I had to learn that the path > to a mount point is > rather limited (88 characters or so). Changing this would lead to a > lot of compatibility > problems (statfs). > Not talking about the job to manage all those very special > modifications. > I finally decided to delegate image creation and configuration to a > "true" virtual machine > and only use the jail for software build. I'd seriously look at mkimg there's nothing like having a specialty tool designed for the job > > >> All in all the mkimg utility is a good answer, as I think you are >> going to hit several problems one after the other with trying to >> mount system devices from within a jail. >> >> >> >> >