Re: armv7 chroot [and lib32] on aarch64 is getting "nfssvc() ERR#78 'Function not implemented'" for "umount /mnt" of a nfs mounted UFS file system

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 27 Jul 2024 04:58:52 UTC
On Jul 26, 2024, at 21:20, Mark Millard <marklmi@yahoo.com> wrote:

> The original mount was:
> 
> mount -onoatime 192.168.1.140:/ /mnt
> 
> For reference:
> 192.168.1.140:/ on /usr/obj/DESTDIRs/main-armv7-chroot-ports-official/mnt (nfs, noatime)
> 
> gdb reports:
> 
> Reading symbols from /sbin/umount...
> Reading symbols from /usr/lib/debug//sbin/umount.debug...
> [New LWP 100137]
> Core was generated by `umount /mnt'.
> Program terminated with signal SIGSYS, Bad system call.
> Sent by kernel.
> #0  nfssvc () at nfssvc.S:4
> 
> warning: 4 nfssvc.S: No such file or directory
> (gdb) bt
> #0  nfssvc () at nfssvc.S:4
> #1  0x00021be8 in umountfs (sfs=sfs@entry=0xffffce90) at /home/pkgbuild/worktrees/main/sbin/umount/umount.c:396
> #2  0x00022400 in checkname (mntname=0xffffddfb "/mnt", typelist=typelist@entry=0x0) at /home/pkgbuild/worktrees/main/sbin/umount/umount.c:327
> #3  0x000218a4 in main (argc=<optimized out>, argv=<optimized out>) at /home/pkgbuild/worktrees/main/sbin/umount/umount.c:195
> 
> 
> truss's output ends with:
> 
> . . .
> mmap(0x0,20480,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 537321472 (0x2006e000)
> statfs("/mnt",{ fstypename=nfs,mntonname=/usr/obj/DESTDIRs/main-armv7-chroot-ports-official/mnt,mntfromname=192.168.1.140:/,fsid=18ff003a3a000000 }) = 0 (0x0)
> fstatat(AT_FDCWD,"/mnt",{ mode=drwxr-xr-x ,inode=2,size=1536,blksize=4096 },0x0) = 0 (0x0)
> fstatat(AT_FDCWD,"/mnt/..",{ mode=drwxr-xr-x ,inode=73557804,size=512,blksize=32768 },0x0) = 0 (0x0)
> mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 537219072 (0x20055000)
> mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 537341952 (0x20073000)
> nfssvc() ERR#78 'Function not implemented'
> SIGNAL 12 (SIGSYS) code=SI_KERNEL
> process killed, signal = 12 (core dumped)
> 
> 
> For reference:
> 
>    if (nfssvc(NFSSVC_DUMPMNTOPTS, &dumpmntopts) >= 0) {
> 
> 
> armv7 chroot:
> 
> # uname -apKU
> FreeBSD aarch64-main-pbase 15.0-CURRENT FreeBSD 15.0-CURRENT main-n271408-4fab5f005482 GENERIC-NODEBUG arm armv7 1500021 1500021
> 
> # ls -lodTt /var/cache/pkg/*.snap*.pkg | grep -v "^l" | sed -E 's@^[^/]*(/.*/pkg/([^-]*-)(.*)(\.snap[^~]*)~[^.]*\.pkg)$@\2\4@' | sort -ru
> FreeBSD-.snap20240726110821
> 
> 
> aarch64 host:
> 
> # uname -apKU
> FreeBSD aarch64-main-pbase 15.0-CURRENT FreeBSD 15.0-CURRENT main-n271408-4fab5f005482 GENERIC-NODEBUG arm64 aarch64 1500021 1500021
> 
> # ls -lodTt /var/cache/pkg/*.snap*.pkg | grep -v "^l" | sed -E 's@^[^/]*(/.*/pkg/([^-]*-)(.*)(\.snap[^~]*)~[^.]*\.pkg)$@\2\4@' | sort -ru
> FreeBSD-.snap20240726112037
> 
> 
> After exiting the chroot, the aarch64 environment did the unmount /mnt just fine.


I set up a context where aarch64 ends up seeing (after chroot
exit):

# df -m
Filesystem        1M-blocks   Used  Avail Capacity  Mounted on
/dev/gpt/PBaseUFS   1114846 184896 840761    18%    /
devfs                     0      0      0     0%    /dev
/dev/gpt/PBaseEFI       244     26    218    11%    /boot/efi
192.168.1.140:/      823229  74755 682616    10%    /usr/obj/DESTDIRs/main-armv7-chroot-ports-official/mnt

I then used the armv7 umount:

# /usr/obj/DESTDIRs/main-armv7-chroot-ports-official/sbin/umount /usr/obj/DESTDIRs/main-armv7-chroot-ports-official/mnt
Bad system call (core dumped)

The truss output for such shows:

. . .
freebsd32_getfsstat(0x2004e000,11720,MNT_NOWAIT) = 4 (0x4)
freebsd32_mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 537411584 (0x20084000)
freebsd32_mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 537423872 (0x20087000)
freebsd32_mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 537427968 (0x20088000)
#155() ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12 (core dumped)


Side note:

# more ~/pkgbase-snapshot-list.sh 
#! /bin/sh
ls -lodTt /var/cache/pkg/*.snap*.pkg | grep -v "^l" | sed -E 's@^[^/]*(/.*/pkg/([^-]*-)(.*)(-[0-9][0-9]\.snap[^~]*)~[^.]*\.pkg)$@\2*\4@' | sort -ru

results in the likes of:

# ~/pkgbase-snapshot-list.sh
FreeBSD-*-15.snap20240726112037

that reads a little better.

===
Mark Millard
marklmi at yahoo.com