Solved fstab nullfs on zfs dataset boot order

i have a zfs video dataset that is mounted in my home directory,
and i want to mount it using nullfs to the video directory in a Linuxulator chroot

i can manually mount the directory from the host into the chroot

the issue is the zfs datasets are mounted later in the boot process
than the nullfs in the fstab

i tried the late option in the fstab but i think thats generally used with remote filesystems like nfs

i have Davinci Resolve in the chroot
and i would like to find a way for users to mount the video directory from the host to the chroot
so they can import and export footage from resolve directory into the video directory on the freebsd host

rather than copying files back and forth into the chroot

zfs dataset layout

Code:
zroot/home                                     285G   512G  16.3G  /home
zroot/home/djwilcox                            243G   512G   963M  /home/djwilcox
zroot/home/djwilcox/desktop                    192M   512G   132K  /home/djwilcox/desktop
zroot/home/djwilcox/documents                 32.8G   512G  24.3G  /home/djwilcox/documents
zroot/home/djwilcox/downloads                 14.5G   512G   120K  /home/djwilcox/downloads
zroot/home/djwilcox/git                       1001M   512G   853M  /home/djwilcox/git
zroot/home/djwilcox/music                      112G   512G   112G  /home/djwilcox/music
zroot/home/djwilcox/pictures                  2.00M   512G   540K  /home/djwilcox/pictures
zroot/home/djwilcox/torrents                  50.6G   512G   152K  /home/djwilcox/torrents
zroot/home/djwilcox/video                     4.31G   512G  2.03G  /home/djwilcox/video

create the video directory in the chroot

Code:
mkdir -p /compat/ubuntu/home/djwilcox/video

mount the directory from the host to the chroot

Code:
mount -t nullfs /home/djwilcox/video /compat/ubuntu/home/djwicox/video

umount the mount point in the chroot

Code:
umount  /compat/ubuntu/home/djwilcox/video

fstab on the freebsd host

Code:
# Device        Mountpoint    FStype    Options        Dump    Pass#
/dev/gpt/efiboot0        /boot/efi    msdosfs    rw        2    2
/dev/nda0p3.eli        none    swap    sw        0    0
# linux
proc                            /proc           procfs  rw      0       0

# mount video from host to chroot
/home/djwilcox/video           /compat/ubuntu/home/djwilcox/video     nullfs          rw,late                      0       0

mount fstab

Code:
sudo mount -al

that works

but it you reboot it fails because the nullfs is mounted earlier in the boot process that the video zfs dataset
so you are dropped to single user mode

This is the last thing i need to resolve for Davinci Resolve on Freebsd
if you'll excuse the pun

If anyone knows how to delay mounting the nullfs mount point in the fstab
until after zfs has mounted the datasets that would really help me out

i ran into the same issue trying to put the /compat/ubuntu directory in a zfs dataset

maybe noauto is what im looking for

noauto works and doesnt drop you to single user mode

freebsd fstab

Code:
# mount video from host to chroot
/home/djwilcox/video           /compat/ubuntu/home/djwilcox/video     nullfs          rw,noauto                      0       0

only issue is you manually need to mount the directory

Code:
mount /compat/ubuntu/home/djwilcox/video

you get auto completion using the mount command so you dont have to type the full path

would be nice if i could get the video directory to automatically mount
 
The first thing I'd think of, instead of using just chroot, make your Ubuntu tree an autostarted jail instead, then you can add the mount to the jail's fstab instead.

But apart from that, late should be the correct thing to do here (just because it's often used with NFS et al doesn't make it related to network filesystems at all). I can't see why that should still be too early on your machine.
 
im not using a jail
I got that, and the suggestion was to use one. Why not? Is there anything that will stop working jailed?

Note I only suggested that because you wrote chroot. Normally, the path /compat is meant for userlands that "overlay" your normal root filesystem, so, no chroot is in place and you can access (almost) everything, but as you wrote chroot, I assumed you're not doing that.
 
Im running Davinci Resolve in the chroot
and piping the audio from the chroot over a pulseaudio.socket in /tmp to the freebsd host

and setting DISPLAY :1 in the chroot and forwarding the display to a Xwayland window on the Freebsd host

i thought doing that in a jail would add an extra layer of complexity

i also noticed failok in the fstab man page

Code:
If the option “failok” is specified, the system will ignore any error
which happens during the mount of that filesystem, which would otherwise
cause the system to drop into single user mode.  This option is
implemented by the mount(8) command and will not be passed to the kernel.

thats another option that might be worth a look
 
piping the audio from the chroot over a pulseaudio.socket in /tmp to the freebsd host
Doesn't that mean you already have to mount your /tmp inside the chroot as well? So, how are you doing that? :-/
I don't think it's that much harder to get it to work in a jail, although you'll probably need quite some "allow" options.

The other way around would be to go for the overlay (setting sysctl compat.linux.emul_path to your Ubuntu installation), then there's no need to mount anything.
 
you used to have to set the mount point for the linuxulator in your fstab


but you dont need to do that anymore

from the ubuntu rc.d config file

Code:
sysctl compat.linux.emul_path=/compat/ubuntu

_emul_path="/compat/ubuntu"
unmounted "${_emul_path}/dev" && (mount -o nocover -t devfs devfs "${_emul_path}/dev" || exit 1)
unmounted "${_emul_path}/dev/fd" && (mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" || exit 1)
unmounted "${_emul_path}/dev/shm" && (mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" || exit 1)
unmounted "${_emul_path}/home" && (mount -t nullfs /home "${_emul_path}/home" || exit 1)
unmounted "${_emul_path}/proc" && (mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" || exit 1)
unmounted "${_emul_path}/sys" && (mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" || exit 1)
unmounted "${_emul_path}/tmp" && (mount -t nullfs /tmp "${_emul_path}/tmp" || exit 1)
unmounted /dev/fd && (mount -o nocover -t fdescfs fdescfs /dev/fd || exit 1)
unmounted /proc && (mount -o nocover -t procfs procfs /proc || exit 1)
true

might be possible to do the same thing with a jail
but its not needed for the project im working on
 
I don't know why you're writing about a "chroot", the script snippet you just posted already sets your Ubuntu install as the Linux compat "overlay" instead.

And it's doing mounts inside there, so why don't you just add your missing mount there as well?
edit: And, going a step back here, why do you need a mount at all? When it's configured as an overlay, a Linux program should be able to access any path on your host system anyways (as long as it's NOT overlayed...)
 
using noauto will do the job for now
ill just get users to manually mount the directory

this is a project to install Davinci Resolve on Freebsd using the Linuxulator
and its already pretty complex

i dont want to add extra steps for users to follow to increase the complexity of the install
that ill then have to spend time explaining
 
i did look at the linux-browser-installer for ideas

what im doing using doas to chroot into ubuntu without a password and running a wrapper script

Code:
#!/bin/sh

# resolve

# Freebsd script to launch Davinci Resolve from a Linuxulator chroot
# the window is displayed on Freebsd using either Xwayland or Xephyr
# and the audio is routed over a pulseaudio socker from the chroot to the host

# start pulseaudio
pulseaudio --start --daemonize

# Note if you are using X11 on Freebsd comment out the Xwayland line
# and uncomment the Xephyr line

# Wayland - create the Xwayland window to display Davinci Resolve
Xwayland -host-grab -fullscreen -geometry 1920x1080 :01 &

# X11 - create the Xwayland window to display Davinci Resolve
# Xephyr -br -ac -noreset -screen 1920x1080 :1 &

# doas chroot into ubuntu run run the wrapper script to start resolve
doas chroot /compat/ubuntu /usr/local/bin/wrapper-resolve

wrapper-resolve in the chroot launches resolve

Code:
#!/bin/bash

# change username below to the name of the user in the chroot
su username -c '/opt/resolve/bin/resolve' 2>/dev/null
 
Back
Top