Actually, the root cause was the fact that /boot/efi was mounted before /boot, "ls /boot/efi" returned nothing.
This can be solved by properly activating zfs-mount-generator which creates one unit per mountpoint as mentioned in #1904764.
To do this, I ran the following script (but there is also an example which relies on zfs-sed in the manpage: https://openzfs.github.io/openzfs-docs/man/master/8/zfs-mount-generator.8.html#EXAMPLES).
PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\
,readonly,setuid,nbmand,encroot,keylocation\
,org.openzfs.systemd:requires,org.openzfs.systemd:requires-mounts-for\
,org.openzfs.systemd:before,org.openzfs.systemd:after\
,org.openzfs.systemd:wanted-by,org.openzfs.systemd:required-by\
,org.openzfs.systemd:nofail,org.openzfs.systemd:ignore"
mkdir /etc/zfs/zfs-list.cache/
zpool list -H -o name | while IFS= read -r pool; do
zfs list -H -t filesystem -o "$PROPS" -r "$pool" > "/etc/zfs/zfs-list.cache/$pool"
done
At the next boot, there was a separate boot.mount unit which was activated before boot-efi.mount, so the extraneous "boot/efi" directory inside the / pool was no longer present.
Actually, the root cause was the fact that /boot/efi was mounted before /boot, "ls /boot/efi" returned nothing.
This can be solved by properly activating zfs-mount-generator which creates one unit per mountpoint as mentioned in #1904764.
To do this, I ran the following script (but there is also an example which relies on zfs-sed in the manpage: https:/ /openzfs. github. io/openzfs- docs/man/ master/ 8/zfs-mount- generator. 8.html# EXAMPLES). name,mountpoint ,canmount, atime,relatime, devices, exec\ setuid, nbmand, encroot, keylocation\ systemd: requires, org.openzfs. systemd: requires- mounts- for\ systemd: before, org.openzfs. systemd: after\ systemd: wanted- by,org. openzfs. systemd: required- by\ systemd: nofail, org.openzfs. systemd: ignore" zfs-list. cache/ zfs-list. cache/$ pool"
PROPS="
,readonly,
,org.openzfs.
,org.openzfs.
,org.openzfs.
,org.openzfs.
mkdir /etc/zfs/
zpool list -H -o name | while IFS= read -r pool; do
zfs list -H -t filesystem -o "$PROPS" -r "$pool" > "/etc/zfs/
done
At the next boot, there was a separate boot.mount unit which was activated before boot-efi.mount, so the extraneous "boot/efi" directory inside the / pool was no longer present.