Bug 274421 - bectl mount does not recognize intermediate canmount=off partitions for deep boot environments
Summary: bectl mount does not recognize intermediate canmount=off partitions for deep ...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Kyle Evans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-12 02:30 UTC by tamaru
Modified: 2023-11-03 11:37 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tamaru 2023-10-12 02:30:37 UTC
I have tested this on FreeBSD 14.0-BETA5.
 
Following is a sample zfs layout to describe the issue.

NAME                      canmount mountpoint
root/ROOT/default         noauto   /
root/ROOT/default/usr     off      /usr
root/ROOT/default/usr/src noauto   /usr/src
root/ROOT/default/usr/obj noauto   /usr/obj
root/home                 on       /home
root/var                  off      /var
root/var/log              on       /var/log

It is close to the "deep boot environment" as described in btctl(8),
but differs in that canmount=off for /root/ROOT/default/usr .

/etc/rc.d/zfsbe correctly mounts this BE as:

Filesystem                 Mounted on
root/ROOT/default          /
root/ROOT/default/usr/src  /usr/src
root/ROOT/default/usr/obj  /usr/obj
root/home                  /home
root/var/log               /var/log

and the contents of /usr such as /usr/bin is included in root/ROOT/default .

However, running
btctl -r root/ROOT mount default
when the system is booted from another BE or pool, it only mounts
as deep as just before the first non- canmount=off partition,
in this case root/ROOT/default only:

Filesystem                Mounted on
root/ROOT/default         /tmp/be_mount.WsGI

and differs from the preferred behavior that zfsbe gives.


When we are at this, bectl create misbehaves in this regard as well. Running
bectl create -r backup
correctly replicates the whole hierarchy, but does not honor canmount properties.

NAME                      canmount mountpoint
root/ROOT/default         noauto   /
root/ROOT/default/usr     off      /usr
root/ROOT/default/usr/src noauto   /usr/src
root/ROOT/default/usr/obj noauto   /usr/obj
root/ROOT/backup          noauto   /
root/ROOT/backup/usr      noauto   /usr     <====
root/ROOT/backup/usr/src  noauto   /usr/src
root/ROOT/backup/usr/obj  noauto   /usr/obj
root/home                 on       /home
root/var                  off      /var
root/var/log              on       /var/log

and thus, by switching to this backup BE by
bectl activate backup
the next boot looses /usr/bin (and others) when zfsbe (correctly) mounts /usr .