Tuesday, 2 December 2025

Issue with Truenas apps - Failed to umount dataset: cannot unmount ‘/mnt/.ix-apps'

See the link:

https://serverfault.com/questions/1192547/how-to-ensure-truenas-runs-a-docker-service '/mnt/.ix-apps/docker # 0) Define canonical variables for this session (avoid typos) export POOL="tank01" # Purpose: the zpool name export DATASET="${POOL}/ix-apps/docker" # Purpose: ZFS dataset to unmount/fix export MOUNTPOINT="/mnt/.ix-apps/docker" # Purpose: kernel/systemd mount target export UNIT="$(systemd-escape -p "${MOUNTPOINT}").mount" # Purpose: owning systemd .mount unit echo "$POOL | $DATASET | $MOUNTPOINT | $UNIT" # 1) Ensure nothing will respawn Docker while fixing mounts # Purpose: prevent busy mounts and reactivation while middleware resets Apps/Docker systemctl disable --now docker.service docker.socket containerd.service || true systemctl mask docker.service docker.socket containerd.service || true # 2) Tell ZFS to NEVER automount this child until handing control to TrueNAS # Purpose: canmount=off stops zfs/systemd from recreating the mount on boot or import zfs set canmount=off "${DATASET}" zfs get canmount "${DATASET}" # 3) Stop/Mask the owning systemd mount unit # Purpose: keep systemd from pinning the path & masking prevents future jobs systemctl stop "${UNIT}" || true systemctl mask "${UNIT}" || true systemctl status "${UNIT}" --no-pager || true # 4) Unmount robustly (deepest-first), then verify # purpose: clear the kernel mount table entry once and for all /bin/umount -l "${MOUNTPOINT}" || true # helper available on many SCALE builds; harmless if absent command -v /sbin/umount.zfs && /sbin/umount.zfs "${MOUNTPOINT}" || true # If the child still shows mounted, unmount the *parent* tree and remount only parent if findmnt --target "${MOUNTPOINT}" >/dev/null 2>&1; then zfs unmount -f "${POOL}/ix-apps" || true zfs mount -O "${POOL}/ix-apps" || true # -O mounts parent only; child stays off due to canmount=off fi # Verify state findmnt --target "${MOUNTPOINT}" || echo "not mounted" # 5) Hand control back to TrueNAS Apps # purpose: re-register docker service in middleware & seed /mnt/.ix-apps/docker/* # UI path: Apps -> Settings -> Unset Pool -> (succeeds now) -> Choose Pool -> select "data"