# Can get off of a bad Boot Environment - solved



## Rod Myers (Mar 23, 2018)

Lenovo T520

I have freebsd installed on a SSD (not that it matters), using zfs and Boot Environments (BE).

I created a test BE, called TEST. changed a variable to test it out, just in case. It locks the system up as soon as I hit enter at the boot menu.

Been tinkering with option 2, and the ESC key to drop to an emergency shell. I can set/unset every variable, except the one I need. I can change every ENV setting to point to a safe BE.

The entry I am unable to edit

zfs_be_active=zfs:<be>/ROOT/TEST


If I change everything I need to change, but typing "boot", it uses the bad BE.

If I reboot to try and get to a good BE, all edits are lost.

Not sure how to make changes permanent through a reboot, or force the active_be to change.

Any tricks, tips, pointers, etc would be greatly appreciated.

Thanks


----------



## Eric A. Borisch (Mar 23, 2018)

You’re unable to use the boot menu to select your other boot environment?

The sysutils/beadm tool is the easiest way to durably (as in survives reboots) switch environments; basically it is setting the zpool(8) bootfs property. You want to make sure you don’t have a vfs.root.mountfrom set in /boot/loader.conf(5), and your BEs should (in general) be set to canmount=noauto. Using beadm(1) automates this process.

Edit: fix loader variable name.


----------



## ShelLuser (Mar 23, 2018)

You're going at this the wrong way, you don't need to change the variable you mentioned.

What you need to change / set is currdev and vfs.root.mountfrom.

For example, when I started with a rescue CD and wanted to boot my main system (installed on ZFS on the second HD) I used this (on the bootloader 'ok' prompt):

```
set currdev="disk1p2"
set vfs.root.mountfrom="zfs:zroot"
```

(edit): you can also refer to the lsdev menu command to identify the available devices and ZFS pools.


----------



## Rod Myers (Mar 23, 2018)

you got me very close. close enough to unscrew my system,

Followed your suggestions. it would still lock up.

Found the ENV setting I had entered, which was the cause of the lockup. "unset" it, and was able to get to a point I could change BE's

Thank you.


----------

