Bug 241531 - autofs: stale entries remain in /media, "automount -c" does not remove them
Summary: autofs: stale entries remain in /media, "automount -c" does not remove them
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.3-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-28 02:56 UTC by Victor Sudakov
Modified: 2020-01-06 16:49 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Sudakov 2019-10-28 02:56:31 UTC
I'm using the -media map attached to /media. The problem is that stale entries for removed CDROMs remain in /media forever.

Please note that:

1. Running /etc/autofs/special_media does not show those CDROMs but they are still in /media

2. Even running "/usr/sbin/automount -c" by hand DOES NOT help, the stale entries are still there.

Only restarting the automountd and autounmountd daemons removes those entries.
Comment 1 Victor Sudakov 2019-10-28 14:27:21 UTC
root@vas:~ # automount -cv |& grep -v autofs
automount: flushing /media1
root@vas:~ # /etc/autofs/special_media
TESTPEN
root@vas:~ # ls /media1
Linux Mint 19 Cinnamon 64-bit   TESTPEN
root@vas:~ #
Comment 2 Victor Sudakov 2019-11-03 16:54:32 UTC
Really, why does it accumulate all that stale stuff?

root@vas:~ # automount -cv |& grep flush
automount: flushing autofs caches
automount: flushing /media
root@vas:~ # /etc/autofs/special_media
HAIRCLIPPER
root@vas:~ # ls /media
da0             da0p2           da0s1           HAIRCLIPPER
root@vas:~ #
Comment 3 Edward Tomasz Napierala freebsd_committer 2019-11-25 12:38:23 UTC
It's a known issue, I'm afraid, and requires some kernel hacking in autofs(5) to fix.  I can provide guidance, but I don't have enough time right now to fix it myself.
Comment 4 Victor Sudakov 2019-11-25 13:30:01 UTC
(In reply to Edward Tomasz Napierala from comment #3)
It is good news at least that this is a known issue :-)
Comment 5 Jason W. Bacon freebsd_committer 2020-01-05 18:02:22 UTC
I'm not sure if this is the same issue, but when inserting a media with the same device name as but a different filesystem than a previously mounted FS, it will not be detected.

E.g. I have two USB sticks, one with FAT32 and volume ID "SONY8" and another with exFAT, both identified as /dev/da1s1.

After accessing the FAT32 FS, the /media/SONY8 directory remains indefinitely and inserting the exFAT stick does not trigger creation of /media/da0s1.

It seems a reboot is necessary to clear this condition.
Comment 6 Victor Sudakov 2020-01-06 16:49:04 UTC
(In reply to Jason W. Bacon from comment #5)
autofs is most certainly not ready for production use. When it becomes all stale and stops detecting new media (which happens regularly), I restart the whole thing with the following script:

service automountd stop
service autounmountd stop
umount -Aft autofs
service automountd start
service autounmountd start
automount

No need to reboot.