Bug 153804 - boot from zfs kernel.old recovery undocumented/impossible
Summary: boot from zfs kernel.old recovery undocumented/impossible
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-09 02:10 UTC by Nick Sayer
Modified: 2011-05-26 17:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Sayer 2011-01-09 02:10:04 UTC
After creating an unbootable kernel, the steps necessary to boot
kernel.old are unclear.

The problem is that under normal circumstances, /boot/zfs/zpool.cache is
loaded in some magic way - this is evidenced by breaking into the loader
(by pressing "6") and doing an lsmod.

If you attempt to unload, then manually load kernel and zfs.ko, the
zpool.cache file is not loaded. Attempting to load zpool.cache with the
load command fails, and there is no alternative command to do so.

Attempting to boot the kernel without the zpool.cache loaded results in
an irrecoverable failure to mount root.

Fix: 

Either loading zfs.ko needs to perform whatever magic is
	necessary to fetch zpool.cache, or a command needs to be added
	(like load_geli) to fetch the zpool cache.
How-To-Repeat: 	Set up a zfsroot system.

	boot.

	hit '6' at the loader menu, then "unload", "load kernel" and "load
	zfs.ko", then "boot".
Comment 1 Benedict Reuschling freebsd_committer freebsd_triage 2011-05-24 16:31:04 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

From the description, it sounds more like an issue for the 
filesystem people.
Comment 2 Andriy Gapon freebsd_committer freebsd_triage 2011-05-24 19:47:08 UTC
Try the following options:

1)
unload
set kernel=kernel.old
boot

2)
unload
load /boot/kernel.old/kernel
load -t /boot/zfs/zpool.cache /boot/zfs/zpool.cache
boot

My expectation is that both should do what you want.
-- 
Andriy Gapon
Comment 3 Nick Sayer 2011-05-24 22:58:39 UTC
Option number 2, indeed, does the trick.

This should be added to the documentation for ZFS-on-root installations.
Comment 4 Pan Tsu 2011-05-25 09:52:38 UTC
Andriy Gapon <avg@FreeBSD.org> writes:

> Try the following options:
> 
> 1)
> unload
> set kernel=kernel.old
> boot
> 
> 2)
> unload
> load /boot/kernel.old/kernel
> load -t /boot/zfs/zpool.cache /boot/zfs/zpool.cache

zpool_cache_type can be anything. loader(8) unlike grub2 doesn't enforce
type to be "/boot/zfs/zpool.cache".

> boot

Whatever happened to just typing following?

  boot kernel.old

It assumes zpool.cache was already preloaded by failed attempt to boot
default kernel. No need to `unload' the kernel, `boot' replaces it.

> My expectation is that both should do what you want.
Comment 5 Nick Sayer 2011-05-25 15:21:40 UTC
On May 25, 2011, at 1:52 AM, Pan Tsu wrote:

> Andriy Gapon <avg@FreeBSD.org> writes:
>=20
>> Try the following options:
>>=20
>> 1)
>> unload
>> set kernel=3Dkernel.old
>> boot
>>=20
>> 2)
>> unload
>> load /boot/kernel.old/kernel
>> load -t /boot/zfs/zpool.cache /boot/zfs/zpool.cache
>=20
> zpool_cache_type can be anything. loader(8) unlike grub2 doesn't =
enforce
> type to be "/boot/zfs/zpool.cache".
>=20
>> boot
>=20
> Whatever happened to just typing following?
>=20
>  boot kernel.old
>=20
> It assumes zpool.cache was already preloaded by failed attempt to boot
> default kernel. No need to `unload' the kernel, `boot' replaces it.

I didn't try that. At the time I didn't think it worked that way. Back =
when I was in full on panic mode, I think option number 1 was what =
finally worked, but I am happier with option 2, as it offers the most =
control. It just needs to be better documented.

>=20
>> My expectation is that both should do what you want.
Comment 6 Andriy Gapon freebsd_committer freebsd_triage 2011-05-26 12:54:53 UTC
on 25/05/2011 11:52 Pan Tsu said the following:
> Andriy Gapon <avg@FreeBSD.org> writes:
> 
>> Try the following options:
>>
>> 1)
>> unload
>> set kernel=kernel.old
>> boot
>>
>> 2)
>> unload
>> load /boot/kernel.old/kernel
>> load -t /boot/zfs/zpool.cache /boot/zfs/zpool.cache
> 
> zpool_cache_type can be anything. loader(8) unlike grub2 doesn't enforce
> type to be "/boot/zfs/zpool.cache".

Yes, one can specify load -t anything /boot/zfs/zpool.cache and it will work.
I was just on the safe side following what's done in /boot/defaults/loader.conf.

>> boot
> 
> Whatever happened to just typing following?
> 
>   boot kernel.old
> 
> It assumes zpool.cache was already preloaded by failed attempt to boot
> default kernel. No need to `unload' the kernel, `boot' replaces it.
> 

Yes, I think that this command is a more convenient form of doing #1 above.

All in all, I qualify this as a pilot error.
Supported convenience methods do the right thing automatically.  In the completely
manual method a user should know what he is doing.  Perhaps it's worth mentioning
somewhere that zpool.cache must be loaded, but I think that it's a common knowledge.

-- 
Andriy Gapon
Comment 7 Andriy Gapon freebsd_committer freebsd_triage 2011-05-26 12:55:22 UTC
State Changed
From-To: open->closed

No change needed.
Comment 8 Nick Sayer 2011-05-26 15:31:13 UTC
Before this gets closed, is someone going to maybe add this to some =
documentation somewhere? This ought to go in the handbook at the very =
least.
Comment 9 martin 2011-05-26 17:01:10 UTC
>>>>> On Thu, 26 May 2011 18:20:14 +0300, Andriy Gapon said:
> 
> on 26/05/2011 17:40 Nick Sayer said the following:
> >  
> >  Before this gets closed, is someone going to maybe add this to some =
> >  documentation somewhere? This ought to go in the handbook at the very =
> >  least.
> 
> Which part exactly?
> IMO, loader(8) should be sufficient.

I think it should be

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-trouble.html

where it currently tells you to do unload and boot with arguments that don't
work for zfs...

__Martin