# Some boot environments pointers?



## Bobi B. (Aug 26, 2018)

Greetings, All! Can someone provide pointers and/or documentation regarding boot environments? Like

what is it exactly,
what problems does it solve,
what is it good for,
what is it compatible with, and
what are its requirements?
I recently found out about beadm(1), but it is not easy to grasp the concept with zero context. Thank you!


----------



## romanaOne (Aug 26, 2018)

Yeah, trying to learn what something is from man pages can be rough. 

It's a way to safely upgrade.  "Safely" means I can easily downgrade  without having to mess with a rescue disk. Mostly I have had to downgrade  after playing with, err, dangerous modules like virtualbox and drm.

Example use:

DRM won't work at all on my Skylake laptop unless I install  graphics/drm-stable-kmod.  There was an update a few days ago. So I created a new boot environment (BE):

`beadm create 11.2Rp2_DRM_Aug22`

then I activate it:
`beadm activate 11.2Rp2_DRM_Aug22`

This means it will be the active BE when I reboot.
Then I reboot and install the latest graphics/drm-stable-kmod .


```
>beadm list

BE                Active Mountpoint  Space Created
default           -      -            3.2G 2018-07-03 15:14
11.2Rp2_DRM_Aug2  -      -          563.9M 2018-08-03 15:15
11.2Rp2_DRM_Aug22 NR     /           16.4G 2018-08-23 10:07
```

What beadm did:

```
>zfs list -t snapshot

NAME                                               USED  AVAIL  REFER  MOUNTPOINT
zroot/ROOT/11.2Rp2_DRM_Aug22@2018-07-10-21:29:56  3.22G      -  8.99G  -
zroot/ROOT/11.2Rp2_DRM_Aug22@2018-08-23-10:07:21   563M      -  12.4G  -

>zfs list
NAME                           USED  AVAIL  REFER  MOUNTPOINT
zroot                          284G   146G    96K  /zroot
zroot/ROOT                    16.4G   146G    88K  none
zroot/ROOT/11.2Rp2_DRM_Aug2    896K   146G  12.4G  /
zroot/ROOT/11.2Rp2_DRM_Aug22  16.4G   146G  12.6G  /
zroot/ROOT/default             912K   146G  8.99G  /
```

If suspend to ram broke with Aug 22 drm or other bad things happen, I can revert to the zroot/ROOT dataset to Aug 2  by activating and rebooting into the old Aug2 BE. If really bad things happen and I can't even boot,  the beastie loader menu allows me to select any BE, overriding the active (11.2Rp2_DRM_Aug22) one.

beadm rolling back will not affect other datasets so usr/home, usr/ports/, usr/src do not get rolled back.

beadm won't work if you have changed  the default  zfs datasets created by the installer or are using disk encryption.

I found Michael W. Lucas's not too detailed explanation of how beadm works very helpful, especially the bit explaining exactly what does and doesn't get rolled back. Before understanding this, I was afraid to mess with beadm.


----------

