When I first open a terminal, or open a new one after not having used one for a while, any kind of tab completion in my home directory (for example, ls and Tab) takes several seconds. I have seen this behavior before when using autofs to mount network drives, but I don't have any in ~/. I do mount NFS shares with systemd's automount, but those are in ~/badabing/, so everything in ~/ itself is just a local file.
In case it is an automount issue, here are the relevant /etc/fstab lines (yes, the server is called "badabing", I named it during a Sopranos binge a few years ago):
badabing:/nfs_shares/music /mnt/badabing/music nfs4 noauto,x-systemd.automount,x-systemd.device-timeout=5sec,x-systemd.idle-timeout=1min 0 0
badabing:/nfs_shares/series /mnt/badabing/series nfs4 noauto,x-systemd.automount,x-systemd.device-timeout=5sec,x-systemd.idle-timeout=1min 0 0
badabing:/nfs_shares/movies /mnt/badabing/movies nfs4 noauto,x-systemd.automount,x-systemd.device-timeout=5sec,x-systemd.idle-timeout=1min 0 0
Then, in ~/badabing I have:
$ ls -l ~/badabing/
total 0
lrwxrwxrwx 1 terdon terdon 32 Jan 10 2016 movies -> /mnt/badabing/nfs_shares/movies/
lrwxrwxrwx 1 terdon terdon 31 Jan 10 2016 music -> /mnt/badabing/nfs_shares/music/
lrwxrwxrwx 1 terdon terdon 31 Jan 10 2016 series -> /mnt/badabing/nfs_shares/series
I'd like to investigate this more. Can I somehow strace tab completion? Is the only way to add echo commands in the various bash completion scripts to see what's hanging? There are quite a few of those so I'd really rather avoid that.
So, what's causing this or, at least, how can I debug it further?
/usr/share/bash-completionwhich are run when bash tries to complete something. How would I run strace here though? I can't dostrace bash 2>logsince that will hang. Ah, I just saw that I can attachstraceto an already running process. I'll try that, thanks.-poption of strace.-foption, that will follow the (new) child processes.