# freebsd-update on a 8.0 rootzfs system



## Jago (Mar 7, 2010)

I have a 8.0 system that uses zfsroot and gptzfsboot. It uses the GENERIC kernel and the only thing that had to be manually recompiled is obviously the bootloader, to enable zfs boot support, other then that, the system is using stock 8.0 binaries. Since fully rebuilding world and kernel on this system is a 5 hour process, I would very much like to use freebsd-update and I wanted someone to clarify the utility's behaviour. If I run freebsd-update on this system, what will it do when it detects that the bootloader binaries do not match those of stock 8.0-RELEASE? Will it:

1) Ignore the changed/recompiled bootloader files completely, only updating the binaries whose checksums it can recognize. This behaviour is alright for updating within 8.0, updating for release errata, but would cause some problems updating to 8.1 and further, since 8.1 will have zfs capable bootloader by default and having freebsd-update
always completely ignore a system component that has once been recompiled sounds a bit silly.

2) Happily update the system, overwrite my custom compiled bootloader, forcing me to manually rebuild the bootloader again before I reboot the system. This I guess would actually be the desired behaviour.


- Sincerely,
Dan Naumov


----------



## Jago (Mar 7, 2010)

OK, I did a testrun of this in a VM environment and #1 is what happens. I tried "freebsd-update IDS" first and that showed that /boot/loader SHA256 does not match what is expected, I then applied the updates, but it ignored my custom /boot/loader anyway and didn't touch it despite the mismatch. Why?

My biggest concern is what does this mean going forward, when the eventual time for upgrading to 8.1 and 8.2 comes. 8.1 definately has a changed bootloader. Does the current behaviour mean that when I upgrade to 8.1, it will still refuse to update the bootloader and will refuse to update it forever or will it actually update "whatever is given" to 8.1, which would be the desired behaviour?

- Sincerely,
Dan Naumov


----------



## SirDice (Mar 8, 2010)

If I'm not mistaken even a [cmd=]make installworld[/cmd] doesn't update the bootloader. AFAIK you've always had to update the actual bootloader by hand. But in all the years I've been using FreeBSD I only had to update it a few times. Not sure what happens with freebsd-update though, I don't use it.


----------



## Jago (Mar 8, 2010)

SirDice said:
			
		

> If I'm not mistaken even a [cmd=]make installworld[/cmd] doesn't update the bootloader. AFAIK you've always had to update the actual bootloader by hand. But in all the years I've been using FreeBSD I only had to update it a few times. Not sure what happens with freebsd-update though, I don't use it.


[cmd=]make installworld[/cmd] does not touch stage0 and stage1 bootloaders, but it most definately can and does touch the stage2 bootloader, which is the /boot/loader file.


----------



## gkontos (Mar 8, 2010)

Actually if you have this on your src.conf

```
LOADER_ZFS_SUPPORT=YES
```
it will automatically compile a ZFS boot loader.
Also it appears that in future versions this will not be necessary any more.

George


----------



## Jago (Mar 8, 2010)

gkontos said:
			
		

> Actually if you have this on your src.conf
> 
> ```
> LOADER_ZFS_SUPPORT=YES
> ...


I know 

I am using a stock 8.0 system, BUT, with a recompiled /boot/loader specifically with the option you mention so I can boot off my ZFS root pool. I just wanted to know whether using freebsd-update would overwrite my custom /boot/loader with the stock one, resulting in an unbootable system. This didn't happen  I will have to look into this again when 8.1 comes out and see how freebsd-update is going to handle the upgrade process.


----------



## SirDice (Mar 8, 2010)

Jago said:
			
		

> [cmd=]make installworld[/cmd] does not touch stage0 and stage1 bootloaders, but it most definately can and does touch the stage2 bootloader, which is the /boot/loader file.



I was referring to the actual code in the MBR.


----------



## bschmidt (Mar 8, 2010)

freebsd-update manages cache files in /var/db/freebsd-update, did you try removing those files and run freebsd-update again? I'm pretty sure it will overwrite /boot/loader then, as I run into this once..


----------



## ernie (Jul 14, 2010)

Anyone know if 8.1 makes it any easier to install FreeBSD as a ZFS root setup?


----------



## phoenix (Jul 14, 2010)

sysinstall (the standard FreeBSD installer) only supports UFS.

You can use the PC-BSD 8 installer to install FreeBSD onto ZFS, though.


----------



## ernie (Jul 14, 2010)

phoenix said:
			
		

> sysinstall (the standard FreeBSD installer) only supports UFS.
> 
> You can use the PC-BSD 8 installer to install FreeBSD onto ZFS, though.



That's handy to know. I will give it a try tomorrow.


----------



## Sylgeist (Jul 20, 2010)

I just upgraded from 8.1-RC2 to 8.1-RELEASE (I know it's not officially out yet). It blew away my root zfs config. I had to go into the Fixit environment and and redo the gpart bootcode steps.


----------



## Ben (Jul 22, 2010)

I am running a FreeBSD 8.0 AMD64 on a ZFS-only system. I also compiled the bootloader to make it support ZFS.

Just to be clear: If I run a binary-update (freebsd-update) on my 8.0 as soon as 8.1 is out, will it kill my bootloader or I just recompile and install it again after updating to 8.1?

I don't have physical access to my server for the moment and want to be sure not to kill it 

Would be great if somebody could make this clear. Im a little confused by the comments above.

Thanks!


----------



## Deleted member 10519 (Jul 23, 2010)

Hi, Ben.

I have just used freebsd-update to upgrade an installation of FreeBSD 8.0 with ZFS on root with GPT to 8.1-RELEASE and my bootloader was _not_ updated.  Upon the first reboot, my laptop would not boot and it was necessary to use a Fixit shell to reinstall a new bootloader.  I had feared this might happen so I prepared a memory stick containing a FreeBSD 8.1 image.

To reinstall the boot loader, I used the command (where ad4 is the disk with your boot partition):

`# gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfsoot -i 1 ad4`


----------



## Ben (Jul 24, 2010)

Which of the ISOs has the Fixit included? Is it still Disc1 or can I use the LiveFS?

I need to check with my provider to put the right volume into my CD drive.

Thanks for your help. I have the same setup!

Is this the last time to update it this way?

EDIT: Sorry for the stupid questions, but I need to give instructions to make them update properly 
Is the path already existing, so just boot into fixit and gpart bootcode... once for ad4, once for ad6 or do I have to mount sth to /mnt2/boot...? Then reboot and ok?

Thanks for your help!!


----------



## Nukama (Jul 25, 2010)

In Availability the announce message states, that there are three available images which allow booting a livefs.


dvd1
livefs
memstick

You could also look into the content of the iso images, while mounted with these commands:
`# [man]mdconfig[/man] -a -t vnode -f FreeBSD-8.1-RELEASE-amd64-livefs.iso -u 1`
`# [man]mount[/man] -t cd9660 /dev/md1 /mnt`

Issuing [CMD=""]ls  /mnt/boot[/CMD] shows the files pmbr and gptzfsboot. The content will be accessible on /mnt2 in Fixit environment.

gpart should write gptzfsboot on the freebsd-boot partition.
`# [man]gpart[/man] bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptzfs[b]b[/b]oot -i 1 ad4`

Another option (not tested by me) is to write the bootcode before rebooting with pmbr and gptzfsboot from 8.1-RELEASE image. 
Needs the right kern.geom.debugflags value set (a.k.a "Enable footshooting), if "operation not permitted" shows up on your system.


----------



## swa (Jul 25, 2010)

Nukama said:
			
		

> Another option (not tested by me) is to write the bootcode before rebooting with pmbr and gptzfsboot from 8.1-RELEASE image.


Today I used this method to upgrade to 8.1, everything went ok for me.


----------



## Ben (Jul 26, 2010)

@swa: So you downloaded the LiveFS-Image, mounted it and ran the commands Nukama posted? Afterwards do the upgrade via freebsd-update, reboot and it works?

Maybe you can give a few more details about your steps, I guess this is helpful to a lot more people!

Thanks!!


----------



## swa (Jul 26, 2010)

Hi Ben,
Can't tell if it will work for you, but this worked for me to upgrade from 8.0 to 8.1 with freebsd-update.
(I have Root on ZFS Mirror similar like described here)

Like in the original announce:
`# freebsd-update upgrade -r 8.1-RELEASE`
`# freebsd-update install`

Now before rebooting the machine I wrote the bootcode, replace ad4 and/or ad6 to your own needs.
`# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad4`
`# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad6`

Because I have a custom kernel and freebsd-update updates GENERIC only I forced next reboot to load GENERIC kernel:
`# nextboot -k GENERIC`

From here I again followed the steps like in the original announce:
`# shutdown -r now`
After reboot
`# freebsd-update install`

Now I started building custom kernel the usual way.
Hope this helps


----------



## Ben (Jul 26, 2010)

Yeah, that helps. I am using the same setup (at least same tutorial) but with a GENERIC kernel.

I will try this then. I hope it won't kill my server 

Thanks for your help!!

UPDATE: After lot's of (mental) preparation I upgraded the way u suggested and it worked fine. Thanks for your help!!


----------

