ls hangs for 90 seconds per each disconnected automount
ls hangs for 90 seconds per each disconnected automount. gnuls is not similarly blocked.
> time gnuls -al /media/myname/
total 8
drwxr-x---+ 4 root root 4096 Nov 7 12:16 .
drwxr-xr-x 4 root root 4096 Aug 23 16:52 ..
drwxr-xr-x 2 root root 0 Nov 21 23:12 corsair
drwxr-xr-x 2 root root 0 Nov 21 23:12 san1TB
real 0m0.001s
user 0m0.000s
sys 0m0.001s
> time ls -al /media/myname/
total 8
drwxr-x--- 4 root root 4096 Nov 7 12:16 .
drwxr-xr-x 4 root root 4096 Aug 23 16:52 ..
d????????? ? ? ? ? ? corsair
d????????? ? ? ? ? ? san1TB
real 3m0.327s
user 0m0.003s
sys 0m0.003s
This occurs regardless whether the automount is "loaded active waiting" or "loaded active running" as long as the mountpoint is not available. NFS mounts are affected as well.
In Ubuntu 25.10, the issue causes incoming SSH sessions to hang for 90s per each retry of each unavailable automount because the MOTD scripts make use of rust-coreutils stat and ls. https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/2130843
I am opening this bug per the suggestion of @Alonely0 in #9072.
Some context:
> grep "/media/" /etc/fstab
/dev/disk/by-label/corsair /media/myname/corsair auto x-systemd.automount,nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=corsair,noauto,user 0 0
/dev/disk/by-label/san1TB /media/myname/san1TB auto x-systemd.automount,nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=san1TB,noauto,user 0 0
> mount | grep "/media/"
systemd-1 on /media/myname/corsair type autofs (rw,relatime,fd=65,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13402)
systemd-1 on /media/myname/san1TB type autofs (rw,relatime,fd=67,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13405)
The issue occurs in both states:
> systemctl | grep media-
media-myname-corsair.automount loaded active waiting media-myname-corsair.automount
media-myname-san1TB.automount loaded active waiting media-myname-san1TB.automount
and
> systemctl | grep media-
media-myname-corsair.automount loaded active running media-myname-corsair.automount
media-myname-san1TB.automount loaded active running media-myname-san1TB.automount
media-myname-corsair.mount loaded inactive dead start /media/myname/corsair
media-myname-san1TB.mount loaded inactive dead start /media/myname/san1TB
Did some investigating into this and there's not an easy fix because we currently use the std fs Metadata object that doesn't have a constructor and we would have to call fstat directly with this flag to have the same behavior but we would first need to refactor the library to use an Metadata object other than the std fs Metadata object