Date: Fri, 13 May 2016 17:28:43 +0200 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= <trasz@FreeBSD.org> To: Jilles Tjoelker <jilles@stack.nl> Cc: Melissa Jenkins <melissa-freebsd@littlebluecar.co.uk>, freebsd-stable@freebsd.org Subject: Re: 10.3 and reboot -r (reroot) Message-ID: <20160513152843.GA3717@brick> In-Reply-To: <20160502212604.GA9127@stack.nl> References: <mailman.13.1446379200.13179.freebsd-stable@freebsd.org> <45B67BCE-540F-432A-9AA2-192B20312D27@littlebluecar.co.uk> <20160419104654.GC5543@brick.home> <20160502212604.GA9127@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160513152843.GA3717>