# How to change to alt root filesystem with nanobsd and UEFI?



## Bobi B. (Jun 19, 2019)

Greetings! I've built several nanobsd systems, performed multiple upgrades (using two root file systems) and, so far, everything worked great. Enter UEFI. With UEFI boot process is handled by /boot/boot1.efi (uefi(8)) and gptboot(8) is no-longer in use. Therefore partition attributes, such as `bootme` and `bootonce`, are no-longer taken into account. Therefore atomic upgrades no-longer work. In fact they do work, except newly installed root file system cannot be activated, i.e. is not mounted by the kernel upon boot; instead, first root filesystem is always mounted by the kernel.

Can someone suggest a way to tell /boot/boot1.efi which partition/filesystem to use as a root filesystem? Anyone managed to successfully use alt root filesystem with nanobsd? Dare I ask if some equivalent of `bootonce` flag is even possible?


----------



## SirDice (Jun 19, 2019)

I have very little experience with UEFI booting and no experience with nanobsd but it's explained in uefi(8):

```
2.   boot1.efi reads boot configuration from /boot.config or
                /boot/config.  Unlike other first-stage boot loaders,
                boot1.efi passes the configuration to the next stage boot
                loader and does not itself act on the contents of the file.
```
Then in boot.config(5):

```
The command:

           # echo "1:ad(1,a)/boot/loader" > /boot.config

     will instruct the second stage of boot(8) on the first disk to boot with
     the third boot(8) stage from the second disk.
```
After that it just follows the regular loader(8) and loader.conf(5).


----------



## Bobi B. (Jun 19, 2019)

Will look into it. Many thanks!


----------



## Bobi B. (Jun 20, 2019)

Unfortunately that doesn't seem to work like the legacy, BIOS way of booting. With MBR boot(8) will look for an `active` partition. With GPT gptboot(8), will look for a `bootonce` or `bootme` partition. With UEFI /boot/boot1.efi will pass configuration to the next stage bootloader, /boot/loader.efi, that will load the kernel from the first filesystem with /boot/defaults/loader.conf.

So, for example, if there are multiple FreeBSD installations on a single drive (say different versions or revisions), one cannot select which one to boot. Any other ideas regarding how to do that with UEFI boot?


----------



## np1 (Jun 22, 2020)

Anybody has any update on this ?


----------



## SirDice (Jun 22, 2020)

In the  mean time I got some  experience with UEFI booting.  Use efibootmgr(8).


----------



## np1 (Jun 25, 2020)

k, thanks. However has anybody added UEFI support to Nano ?


----------



## onek (Jan 29, 2021)

Ciao, does anyone have any updates?
I saw some kind of support on the 
	
	



```
../nanobsd/embedded/common
```
but I'm not sure I understand how it works.


----------

