Bug 84154

Summary: Handbook somewhat off in use of /boot/kernel.old
Product: Documentation Reporter: Gary W. Swearingen <garys>
Component: Books & ArticlesAssignee: Tom Rhodes <trhodes>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Gary W. Swearingen 2005-07-27 07:00:32 UTC
The handbook's concept of /boot/kernel always being moved to
/boot/kernel.old is wrong (in two places).  The move is only
made if the currently running kernel came from /boot/kernel/.

Fix: 

-- In section 8.3 Building and Installing a Custom Kernel,

change
   The new kernel will be copied to the /boot/kernel directory as
   /boot/kernel/kernel and the old kernel will be moved to
   /boot/kernel.old/kernel. 
to
   The new kernel and modules will be copied to the /boot/kernel directory
   but that directory will first be moved in place of /boot/kernel.old
   if the currently running kernel came from "/boot/kernel".


-- In section 8.6, under "The kernel does not boot",

change
             You cannot rely on
             kernel.old because when installing a new kernel,
             kernel.old is overwritten with the last installed kernel
             which may be non-functional.
to
             Standard kernel builds write to /boot/kernel, with
             that directory first moved in place of /boot/kernel.old
             if the currently running kernel came from /boot/kernel.
How-To-Repeat: n/a
Comment 1 Giorgos Keramidas freebsd_committer freebsd_triage 2005-07-27 11:47:37 UTC
On 2005-07-26 22:57, "Gary W. Swearingen" <garys@opusnet.com> wrote:
> The handbook's concept of /boot/kernel always being moved to
> /boot/kernel.old is wrong (in two places).  The move is only
> made if the currently running kernel came from /boot/kernel/.

AFAIK, the move is made everytime "installkernel" runs.  You can verify
this by:

	a) Copy /boot/kernel.old to /boot/kernel.saved.old and
	   /boot/kernel to /boot/kernel.saved

		# cd /boot
		# cp -Rp kernel.old kernel.saved.old
		# cp -Rp kernel     kernel.saved

Then go through a few "installkernel" runs and watch the /boot/kernel
and /boot/kernel.old directories.
Comment 2 John Baldwin freebsd_committer freebsd_triage 2005-07-27 12:52:05 UTC
How about:

The new kernel and modules will be copied to the /boot/kernel directory.  If
the currently running kernel came from "/boot/kernel", then the old kernel
and modules will be moved to the /boot/kernel.old directory.

> -- In section 8.6, under "The kernel does not boot",
>
> change
>              You cannot rely on
>              kernel.old because when installing a new kernel,
>              kernel.old is overwritten with the last installed kernel
>              which may be non-functional.
> to
>              Standard kernel builds write to /boot/kernel, with
>              that directory first moved in place of /boot/kernel.old
>              if the currently running kernel came from /boot/kernel.

I haven't read the full doc for context, but it looks like the replacement
text doesn't actually replace the same meaning.  The reason for kernel.old
only getting updated if the kernel being installed is running is to try to
make kernel.old more reliable as in theory it should always be a kernel that
was running well enough to do an installkernel now.  Probably the surrounding
section here needs more updating to reflect that larger change.

=2D-
John Baldwin <jhb@FreeBSD.org> =A0<>< =A0http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org
Comment 3 Gary W. Swearingen 2005-07-28 14:52:06 UTC
John Baldwin <jhb@FreeBSD.org> writes:

> How about:
>
> The new kernel and modules will be copied to the /boot/kernel directory.  If 
> the currently running kernel came from "/boot/kernel", then the old kernel 
> and modules will be moved to the /boot/kernel.old directory.

Change "will be" to "will first be". As-is, it doesn't sound right
because one wonders how the old kernel can be moved "then", when the
old kernel is gone.

> I haven't read the full doc for context, but it looks like the replacement 
> text doesn't actually replace the same meaning.  The reason for kernel.old 
> only getting updated if the kernel being installed is running is to try to 
> make kernel.old more reliable as in theory it should always be a kernel that 
> was running well enough to do an installkernel now.  Probably the surrounding 
> section here needs more updating to reflect that larger change.

I'm not sure about that reason.  I think the reason is that if you're
not booting from /boot/kernel, it's probably bad, so there's no reason
to save it.  (It shouldn't try to be that smart, failing some of the
time.  I'd always do the backup like my editor does, assuming I'll
have saved the old one if I wanted to.) If users follow the handbook,
they won't be booting out of /boot/kernel.old anyway as they'll be
booting out of /boot/kernel.GENERIC (like I always have).

Anyway, here's the whole old para

   Note: If you are having trouble building a kernel, make sure to
   keep a GENERIC, or some other kernel that is known to work on hand
   as a different name that will not get erased on the next build. You
   cannot rely on kernel.old because when installing a new kernel,
   kernel.old is overwritten with the last installed kernel which may
   be non-functional. Also, as soon as possible, move the working
   kernel to the proper /boot/kernel location or commands such as
   ps(1) may not work properly. To do this, simply rename the
   directory containing the good kernel:

maybe replace with

   Note: If you are having trouble building a kernel, keep on hand a
   GENERIC, or some other kernel that is known to work, as a different
   name than "/boot/kernel.old".  That directory will get removed by
   standard "make" scripts when installing a new kernel if the running
   kernel came from "/boot/kernel".  Also, as soon as possible, move
   the working kernel to the proper /boot/kernel location or commands
   such as ps(1) may not work properly. To do this, simply rename the
   directory containing the good kernel:
Comment 4 Pav Lucistnik freebsd_committer freebsd_triage 2007-05-12 17:38:20 UTC
I don't think these paragraphs needs further clarification.

In the first case, we don't need to complicate the matters by pointing
out the kernel.old creation is conditional.  It's just not important in
the context of telling the user installkernel installs new kernel
into /boot/kernel.

In the second case, we want to stress to user that kernel.old cannot be
trusted and that the user should do his own kernel.good copy.
The debated change made kernel.old a bit more trustworthy, but I don't
think we need to relax our message to user here. Let him be scared, we
can afford a little lie (simplification, really) here.

-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

It whines, glows and fades...
Comment 5 Tom Rhodes freebsd_committer freebsd_triage 2008-01-22 15:51:10 UTC
State Changed
From-To: open->closed

After reading the feedback, relevant handbook sections, and discussing this 
with brueffer, we feel the handbook documentation is fine.  Close this PR. 


Comment 6 Tom Rhodes freebsd_committer freebsd_triage 2008-01-22 15:51:10 UTC
Responsible Changed
From-To: freebsd-doc->trhodes

Over to me as closer.