autofs auto(un)mountd umount problem

Tomasz CEDRO tomek at
Tue Jun 2 11:49:25 UTC 2020

Hello world :-)

I am developing an embedded system. Firmware update can be done by
drag-and-drop a firmware file to a UMS exposed endpoint of the debug
probe (ARM MBED DAPLink) that emulates a small FAT memory drive. After
the firmware file bin/hex is put on the drive probe uses FlashAlgo to
put its content into a microcontroller flash memory over SWD/JTAG port
and then device reboots so the drive vanishes itself as detached and
re-attach when ready for next flashing.

Because I am quite frequently updating this firmware I have decided to
try the autofs and auto(un)mountd.

The mount part works fine. But I always need to unmount by hand. Even
though there are no files after device detach, it does not mount again
without manual umount. This may be caused by device vanish as its
intended behavior.

I guess the role of autounmountd is to unmount detached drive for me
right? After enabling debug of the autofs I can see this message
"autofs_unmount: vflush failed with error 16" which may indicate a
source of the problem. But the flush is not possible as device is
already gone. Would I like umount to use the force in that case?

Also I have vfs.usermount=1 but I am unable to mount/umount as user.

I have set vfs.autofs.cache="5" in /boot/loader.conf.

# sysctl -a | grep autofs
WARNING: autofs_unmount: vflush failed with error 16
vfs.autofs.interruptible: 1
vfs.autofs.retry_delay: 1
vfs.autofs.retry_attempts: 3
vfs.autofs.cache: 5
vfs.autofs.timeout: 30
vfs.autofs.mount_on_stat: 0
vfs.autofs.debug: 1

# sysctl -a|grep mount
WARNING: autofs_unmount: vflush failed with error 16
vfs.autofs.mount_on_stat: 0
vfs.ffs.compute_summary_at_mount: 0
vfs.root_mount_always_wait: 0
vfs.usermount: 1

 # grep cd /etc/group

The questions are:

1. How to make autounmountd quickly unmount vanished device so I do
not need to umount it by hand?

2. Why I cannot mount/umount as user even though vfs.usermount is set?

3. To you know a good standardized way for a memory device to detach
itself in a graceful way? At this point flashing probe just vanishes
itself itself from the scsi (?) layer which looks like a hardware
failure which may cause problems to the USB and AUTOFS layer. I can
modify the debug probe firmware if that would be the most elegant way.
I have already done it, its Open-Source, so that would be no problem,
I would only need to know the valid way of graceful detach that would
work correctly on all platforms.

Any hints welcome :-)



More information about the freebsd-questions mailing list