From b78a43d05f51cc2b9c7cb072db4568d04e7cf99c Mon Sep 17 00:00:00 2001 From: Socialpranker <273312799+Socialpranker@users.noreply.github.com> Date: Sat, 11 Jul 2026 18:39:52 +0200 Subject: [PATCH] nfsmount: call mount_nfs directly on OpenBSD so -T is accepted The previous OpenBSD path built the right options ("-o port=N -T") but still handed them to mount(8). On OpenBSD "-T" is a mount_nfs(8) flag, not a mount(8) one, so mount rejected it with "mount: unknown option -- T" and the mount never ran. Call mount_nfs(8) directly on OpenBSD; the options are already in its native syntax. Verified on a real OpenBSD 7.9 arm64 VM: with this change the command becomes "mount_nfs -o port=N -T localhost:/ " and mount_nfs accepts the flags. The mount then fails later with "Stale NFS file handle" because the OpenBSD client and rclone's in-process NFS server disagree on the root filehandle - that is a separate issue in the NFS server, not in the mount options this PR is about. Co-Authored-By: Claude Opus 4.8 --- cmd/nfsmount/nfsmount.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/nfsmount/nfsmount.go b/cmd/nfsmount/nfsmount.go index 3a003e28f..b33fb2d04 100644 --- a/cmd/nfsmount/nfsmount.go +++ b/cmd/nfsmount/nfsmount.go @@ -54,16 +54,20 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (asyncerrors return } - // Options + // Options and mount binary // // OpenBSD's mount_nfs(8) doesn't understand "-o mountport=" or "-o // tcp" - the mountd port isn't settable that way and TCP is - // requested with the "-T" flag instead, so build a different set of - // options there. FreeBSD's mount_nfs(8) accepts the same "-o - // port=", "-o mountport=" and "-o tcp" options as Linux so it uses - // the common case. + // requested with the "-T" flag instead. "-T" is a mount_nfs(8) flag, + // not a generic mount(8) one, so on OpenBSD we call mount_nfs(8) + // directly; running it through mount(8) makes mount reject "-T" with + // "unknown option". FreeBSD's mount_nfs(8) accepts the same "-o + // port=", "-o mountport=" and "-o tcp" options as Linux, and mount(8) + // there forwards them, so it stays on the common path. + mountBin := "mount" var options []string if runtime.GOOS == "openbsd" { + mountBin = "mount_nfs" options = []string{ "-o", fmt.Sprintf("port=%s", port), "-T", @@ -84,7 +88,7 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (asyncerrors if sudo { cmd = append(cmd, "sudo") } - cmd = append(cmd, "mount") + cmd = append(cmd, mountBin) cmd = append(cmd, options...) cmd = append(cmd, "localhost:"+mountPath, mountpoint) fs.Debugf(nil, "Running mount command: %q", cmd)