# Boot with ZFS failed with error 2



## eyebone (Jun 18, 2012)

Hello forum,

*I* am stuck at the boottime of a freshly installed FreeBSD System 9 on amd64 with zfs and geli.

During boottime *I* have to enter the geli passwords for the devices and the associated keys, this is working (*I* see the .eli devices in the mount prompt later). After successfully attach geli *I* get the error message: 
	
	



```
Mounting from zfs:zpool failed with error 2.
```

I booted already several times into live fs and adjuste*d* some of the properties like mountpoint to / and legacy, can mount on / off.

What else *I* might want to check?

Thanks,
 Eyebone


----------



## vermaden (Jun 18, 2012)

You need to 'regenerate' the /boot/zfs/zpool.cache file.

To do that, boot from FreeBSD live CD, then after attaching the GELI devices do:

```
# zpool import -f -o cachefile=/tmp/zpool.cache -o altroot=/mnt YourPoolName
# cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache
# zpool export YourPoolName
# zpool import YourPoolName
```


----------



## eyebone (Jun 18, 2012)

vermaden said:
			
		

> You need to 'regenerate' the /boot/zfs/zpool.cache file.
> 
> To do that, boot from FreeBSD live CD, then after attaching the GELI devices do:
> 
> ...



Thanks! Your posting remembered me that *I* always give the cache the name of the pool and the boot loader is searching for zpool.cache and not for mypool.cache.


----------



## vermaden (Jun 18, 2012)

Welcome.


----------



## Markand (Apr 10, 2013)

I have the same problem, however the zpool.cache regeneration did not work for me, does the mount point property *must* be set to legacy on the pool?


----------



## HarryE (Apr 10, 2013)

The pool must not be in "exported" state when trying to boot from it. Redo the 
	
	



```
# zpool import -f -o cachefile=/tmp/zpool.cache -o altroot=/mnt YourPoolName
# cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache
# zpool export YourPoolName
```
 then `# zpool import YourPoolName` and reboot


----------



## Stochastix (May 30, 2013)

I first tried the @vermaden without reading to the end of the thread and it didn't work.  The extra bit from @HarryE was required.  Even though I had reset /boot/loader.conf to the new name of my root pool, I still had to enter it by hand at mountroute.  

Strangely, I now see in /boot/loader.conf that 

```
vfs.root.mountfrom="zfs:oldname/root"
```
This is neither the new name I see with `zpool list` (the same I had to give at the mountroute prompt).  Is it going to boot next time without help?  I don't know.  

Would be nice if the critical @vermaden post could be edited with the extra bit in the fashion of StackExchange.


----------



## vermaden (May 30, 2013)

@Stochastix,

Fixed.


----------

