Bug 244068

Summary: Boot environment doesn't work without vfs.root.mountfrom
Product: Base System Reporter: greencoppermine
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People    
Priority: ---    
Version: 12.1-RELEASE   
Hardware: amd64   
OS: Any   

Description greencoppermine 2020-02-12 07:31:57 UTC
I don't know if this is perhaps because I'm using a couple of GELI disks in a mirror, but when I create a boot environment and activate it I cannot boot from it unless I also set "vfs.root.mountfrom" in /boot/loader.conf to the boot environment I want to boot from.

Also the environments doesn't show up in the boot loader.

# zfs list -t all
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
bootpool                                 244M  1.51G   244M  /bootpool
zroot                                   94.2G   797G    88K  /zroot
zroot@snap-2020-02-10                       0      -    88K  -
zroot/ROOT                              5.41G   797G    88K  none
zroot/ROOT@snap-2020-02-10                  0      -    88K  -
zroot/ROOT/default                       210M   797G  5.37G  /
zroot/ROOT/krita                        5.20G   797G  5.18G  /
zroot/ROOT/krita@snap-2020-02-10        2.54M      -  5.13G  -
zroot/ROOT/krita@2020-02-12-06:41:25-0  2.05M      -  5.13G  -
zroot/ROOT/krita@2020-02-12-07:54:48    4.64M      -  5.18G  -
zroot/tmp                                 88K   797G    88K  /tmp
zroot/usr                               88.8G   797G    88K  /usr
zroot/usr@snap-2020-02-10                   0      -    88K  -
zroot/usr/home                          88.1G   797G  87.6G  /usr/home
zroot/usr/home@snap-2020-02-10           502M      -  83.6G  -
zroot/usr/ports                          710M   797G   710M  /usr/ports
zroot/usr/ports@snap-2020-02-10             0      -   710M  -
zroot/usr/src                             88K   797G    88K  /usr/src
zroot/usr/src@snap-2020-02-10               0      -    88K  -
zroot/var                               1.19M   797G    88K  /var
zroot/var@snap-2020-02-10                   0      -    88K  -
zroot/var/audit                           88K   797G    88K  /var/audit
zroot/var/audit@snap-2020-02-10             0      -    88K  -
zroot/var/crash                           88K   797G    88K  /var/crash
zroot/var/crash@snap-2020-02-10             0      -    88K  -
zroot/var/log                            636K   797G   480K  /var/log
zroot/var/log@snap-2020-02-10            156K      -   428K  -
zroot/var/mail                           172K   797G   116K  /var/mail
zroot/var/mail@snap-2020-02-10            56K      -   116K  -
zroot/var/tmp                            144K   797G    88K  /var/tmp
zroot/var/tmp@snap-2020-02-10             56K      -    88K  -

# mount
zroot/ROOT/default on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs, local, multilabel)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
bootpool on /bootpool (zfs, local, nfsv4acls)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot on /zroot (zfs, local, noatime, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)

# bectl list
BE      Active Mountpoint Space Created
default NR     /          5.40G 2020-02-02 02:37
krita   -      -          13.0M 2020-02-12 07:54

# bectl activate krita
successfully activated boot environment krita

# bectl list
BE      Active Mountpoint Space Created
default N      /          214M  2020-02-02 02:37
krita   R      -          5.20G 2020-02-12 07:54

If I then do a reboot I get a kernel panic with:

mountroot: unable to remount devfs under /dev (error2)
mountroot: unable to unlink /dev/dev (error2)
init not found...
panic: no init

If during boot I drop into the loader and manually do:

set vfs.root.mountfrom="zfs:zroot/ROOT/krita"
boot

Then it works.

I noticed that before I attempted any of this the installer had set vfs.root.mountfrom="zfs:zroot/ROOT/default" in /boot/loader.conf

Kind regards
Comment 1 greencoppermine 2020-03-18 21:42:43 UTC
Ping!