Linux Tips: bash completion: /dev/fd/62: No such file or directory

This post will show how to deal with the issue I had on a newly installed debian lenny xen virtual machine. I used xen-tools to create the vm using the deboostrap method, and all was fine. I installed the bash-completion package, as probably most of you, I can’t live without bash completion, but quickly found out that it was broken. Any attempt to perform a filelist completion was failing with this error:

vm11:~# tail -f /va<TAB>-bash: /dev/fd/62: No such file or directory
-bash: /dev/fd/60: No such file or directory

and this basically makes the bash completion useless. On a quick look I could easily see that the /dev/fd link was not there and that was the main cause of the problem. Still on one older lenny vm I had for a couple of months this was not happening (from what I can tell because it had an older version of the /etc/bash_completion file). There are several ways to fix this starting with the obvious one to downgrade /etc/bash_completion but I didn’t like that, so I looked for some other ways.

This is a quick fix: we create the /dev/fd link manually:

ln -s /proc/self/fd /dev/fd

and bash completion will start working immediately.

Still, after the vm is restarted this link will be lost as /dev is not a persistent storage. We could of course add the link creation command to rc.local, but at this point I asked myself why udev was not creating that file automatically as it was present under /dev/.static/dev/fd?

Udev was missing

Then I realized that udev package was not installed, and this was the reason for the static devices not being created. I manually installed udev using:

aptitude install udev

and this was the solution for my problem. Hopefully you will find this post useful if you have the same problem, and it will save you the trouble to go into looking yourself for a solution for this.

comments powered by Disqus