From owner-freebsd-stable@freebsd.org Fri May 13 15:28:49 2016 Return-Path: Delivered-To: freebsd-stable@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 29D67B399CF for ; Fri, 13 May 2016 15:28:49 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD79D1163 for ; Fri, 13 May 2016 15:28:48 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id w143so4378362wmw.3 for ; Fri, 13 May 2016 08:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=183gyN0bwQFWbTADiFvsLdpXMiv5najBHdN548PGHK0=; b=tzDd3giW1tO8DGwExMxLca655wAjYW/ZXSZXgQqR0cJFggl75hzXm4w4SCQCBnZZI6 YR2X6ZmktKIxJBRO0YsL9VXt3pwO8h3sPkTJIYhuKmlfpHYkriMNTYkzy2wuDy7SXePI AhW52GJEca2Zrh7OcMNIqVbpDzWDFhtNVgfp5E45OK/a4u/z/NEj0JGUD8KpMbwvTCG6 UD7a/CA3HOgUzscACKbi7SjIKQIRWoRfihW1IInlBt3H6msBhVV/Hikzb8MRyyTShVCX KNj7ttmx6mhkCjYxJBvHXveip7hQKXMzGSGCd77vVQUSRAM5/sWSC4Xk87/kuao6A+Xm iO4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=183gyN0bwQFWbTADiFvsLdpXMiv5najBHdN548PGHK0=; b=I/gW2s0wc0UWD6QE1z8cTmjvEJihOUAvDyEeefJSlfI/9um9NhDP1J2JU9DaBolWQt sCcrY4kqwWLQGYZLSGYKuU6RI+kndgPLsOz5yDn6qusRXHv+ajCYzUMblBUnDPLzjCFy Ys6fsCv/W5RjdQu1gC3YIIOXgD2onmYMYgz+cEskLTmdz9AKMB1ezM/p7QWOV2nEMARg mLMI2sjQJXcBUTJndydENoGgGWAVvfXRS0XCNuaXbPsmkatfFa1acd7fzv8dV1vrixUx /UsoHgHdtol2Ql0oSi709/SHhNV/CDaJTmN+Q1LxT+CFnq1LTqexLV/WDX11Bm1BLoL6 iXvA== X-Gm-Message-State: AOPr4FU68kvLT1mYDPWSLiA0Pc63dJ221eVME38s4bu81IODuEH8xM6uQLNM/QYvf1G9gA== X-Received: by 10.28.91.17 with SMTP id p17mr4165042wmb.86.1463153327055; Fri, 13 May 2016 08:28:47 -0700 (PDT) Received: from brick (etm40.neoplus.adsl.tpnet.pl. [83.20.158.40]) by smtp.gmail.com with ESMTPSA id jr8sm19119825wjb.15.2016.05.13.08.28.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 May 2016 08:28:46 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Fri, 13 May 2016 17:28:43 +0200 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Jilles Tjoelker Cc: Melissa Jenkins , freebsd-stable@freebsd.org Subject: Re: 10.3 and reboot -r (reroot) Message-ID: <20160513152843.GA3717@brick> Mail-Followup-To: Jilles Tjoelker , Melissa Jenkins , freebsd-stable@freebsd.org References: <45B67BCE-540F-432A-9AA2-192B20312D27@littlebluecar.co.uk> <20160419104654.GC5543@brick.home> <20160502212604.GA9127@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160502212604.GA9127@stack.nl> User-Agent: Mutt/1.6.0 (2016-04-01) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2016 15:28:49 -0000 On 0502T2326, Jilles Tjoelker wrote: > On Tue, Apr 19, 2016 at 12:46:54PM +0200, Edward Tomasz NapieraƂa wrote: > > On 0419T0906, Melissa Jenkins wrote: > > > I've been trying to get reboot -r to work but get an error that > > > kern.proc.pathname is undefined. It then drops to single user mode. > > > > Interestingly I've checked the value of kern.proc.pathname and it > > > appears to be undefined on all the OS boxes we have from 9.3 up to > > > current. In fact the kern.proc tree doesn't appear to contain > > > anything though it does exist at least on some of the boxes. > > > The kern.proc.pathname is a weird sysctl. It's per-process, and it's > > impossible to access it via name, only by numeric ID. So, this is > > normal. > > > The fact that reroot doesn't work because of this is not normal, > > though. I have no idea why this would fail; I'll investigate. > > I can make it fail this way easily by installing a new init(8) binary. > This makes the kern.proc.pathname sysctl fail because /sbin/init has > been moved away or deleted. The command procstat -b 1 uses the same > vnode-to-pathname translation code and fails similarly. > > If only a single install has been done, a command ls -l /sbin/init* > will make the kernel realize that /sbin/init.bak is in fact the pathname > of process 1's executable, and both procstat -b 1 and reboot -r > start working. However, the reroot will use the old init binary to > perform reboot(RB_REROOT) and to find init in the new root file system, > which may be undesirable. > > It may be better to use the original argv[0]. The kernel passes a full > pathname here. > > While reading the code, I noticed another issue. The kill(-1, SIGKILL) > may fail with [ESRCH] if there is no process to kill. In this case, the > reroot should continue. This problem sometimes occurs for me when > rerooting from single user mode. Thanks; they should both be fixed now in 11-CURRENT. Btw, at https://reviews.freebsd.org/D6347 there is a patch that makes it possible to reroot into NFS, so you can eg have NFSv4 root over WiFi: boot from md_root (small rootfs image preloaded by loader(8)), setup WiFi, and then reroot into the actual root, over NFS. Testing is welcome. Note that it's currently limited to NFSv4, and due to problems with nfsuserd(8) it requres a workaround on the server side: one needs to set the vfs.nfsd.enable_stringtouid=1 sysctl and not run nfsuserd(8) on either the server or the client side.