From owner-freebsd-current@FreeBSD.ORG Sun Apr 21 06:08:13 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E3EBFBE4; Sun, 21 Apr 2013 06:08:13 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ie0-x235.google.com (mail-ie0-x235.google.com [IPv6:2607:f8b0:4001:c03::235]) by mx1.freebsd.org (Postfix) with ESMTP id AEBB27E6; Sun, 21 Apr 2013 06:08:13 +0000 (UTC) Received: by mail-ie0-f181.google.com with SMTP id tp5so3558759ieb.26 for ; Sat, 20 Apr 2013 23:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=AHFq55o9TfAetZqv8dNLEmozmmJen6f7IhvMKYFdpP4=; b=sNFAFnSbAUR74f8fBo/n3j5TVlPtkAaNgDatwIR6Mdvl4/xGGum+7VwWpxzml08F3d LMojUTPsQVd9ID/Ka5g71t5bKi8G/mxxLlx0/z4LsgCJ90CkO5Lw/EJ1JurWzZWX5Q5E rhPbI6KiGFCw+HzF3HKRYeeLK4dwdPOjyGjTCGsuy2aF3uQfdQ4goSAgCvVrvWgRM+Fw CRzcpngCvyHXEPYcrQyrHIE5sP64w+6crnjCUNVnmyYybIdsmsB3pYmwQZCodu9gXBEf jdscg1uAMA+JACC8BvVl9ue8vbHQsmiShVCiEnLiRsCY4H/xRi6t7nY6PsnfAsztLnR2 XVqg== X-Received: by 10.50.46.133 with SMTP id v5mr18376964igm.94.1366524492668; Sat, 20 Apr 2013 23:08:12 -0700 (PDT) Received: from gloom ([66.11.160.35]) by mx.google.com with ESMTPSA id xc3sm10435312igb.10.2013.04.20.23.08.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 20 Apr 2013 23:08:11 -0700 (PDT) Date: Sun, 21 Apr 2013 02:07:58 -0400 From: Mark Johnston To: Steven Hartland Subject: Re: Booting an alternative kernel from loader prompt fails the first time only Message-ID: <20130421060758.GA1487@gloom> References: <625362A8116D4B43AF4912773F478CB9@multiplay.co.uk> <5172C699.8020708@smeets.im> <5172CF44.1050309@gwdg.de> <201304201741.r3KHfrJe001805@pozo.com> <517327C5.5050305@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: ae@freebsd.org, Joshua Isom , freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 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: Sun, 21 Apr 2013 06:08:14 -0000 On Sun, Apr 21, 2013 at 01:36:58AM +0100, Steven Hartland wrote: > > ----- Original Message ----- > From: "Joshua Isom" > To: > Sent: Sunday, April 21, 2013 12:41 AM > Subject: Re: Booting an alternative kernel from loader prompt fails the first time only > > > > On 4/20/2013 12:41 PM, Manfred Antar wrote: > >> At 10:24 AM 4/20/2013, Rainer Hurling wrote: > >>> On 20.04.2013 18:47 (UTC+2), Florian Smeets wrote: > >>>> On 20.04.13 18:05, Steven Hartland wrote: > >>>>> When trying to boot an alternative kernel from the loader prompt > >>>>> it fails the first time the command is run but succeeds the second > >>>>> time. > >>>>> > >>>>> Type '?' for a list of commands, 'help' for more detailed help. > >>>>> OK boot kernel.generic > >>>>> Booting... > >>>>> don't know how to load module '/boot/kernel.generic/kernel' > >>>>> OK boot kernel.generic > >>>>> Booting... > >>>>> /boot/kernel.generic/kernel text=0xd21288 data=...... > >>>>> > >>>> > >>>> Yes, I've been seeing the same thing for about 6-12 months maybe more. > >>>> None of the people I asked were able to confirm, so I'm happy that I'm > >>>> not imagining it :) > >>> > >>> I also can confirm this behaviour for month now (on 10.0-CURRENT amd64 > >>> with clang). > >>> > >>> Rainer > >>> > >> > >> Have you tried: > >> OK boot /boot/kernel.generic/kernel > >> > >> Use full path name always works for me > >> Manfred > > I believe this may well have been introduced by:- > http://svnweb.freebsd.org/base?view=revision&revision=241069 > > When booting with a /boot/loader.conf that contains a module load line > e.g. zfs_load="YES" then this is loaded before the kernel. > > Loading any module causes last_file_format to get set so when the next > file that's loaded is in fact a kernel it still try's to load it as a > "kernel module" using what was stored with last_file_format. > > This fails and trips the "Restart from the beginning" case which contains: > last_file_format = i = 0; > fp = NULL; > continue; > > So "i" gets set to 0 but the loop then increments it to 1 before running > the next iteration, so its impossible to use first handler in the retry > case; which I suspect is the kernel loader. > > This also explains why the second call to boot works as last_file_format > is now 0 due to the previous failure. > > If this is the issue the attached patch should fix it. I can't test it > ATM as my current box is at the office and doesn't have remote KVM, so > I need to be in front of it. > > If anyone can confirm this attached patch fixes the problem then I'll get > it committed, otherwise I'll test on Monday. I've been noticing this issue on my laptop, and I can confirm that the patch fixes it. -Mark