BASH auto complete doesn’t work? Watch out the mount option “noexec”

BASH is one of popular shell environment on Linux OS. And when using it, everyone loves the auto complete feature, you just tab after you enter first few letters and BASH will match commands/files for you.

However, a few weeks ago when I went into a newly staged Oracle Linux 8 system with some kind of security measures implemented, I noticed auto complete didn’t work for the home directory of the user I used to login.

Initially I thought it might be something wrong with the user profile and some kind of restrictions on the user. But I didn’t find anything in bashrc or bash_profile either at the system level or the user level. Then I noticed it did work with other directories.

After a closer look, those working directories are mounted on different mount points. So by comparing the mount options, it turned out the mount option “noexec” was used on user’s home directory mount point which blocked auto complete.

I’ve also seen “noexec” option will cause some other weird issues. For example, I have a bash wrapped binary file (jar files) which will expand the binary file and execute it when run this bash file. If you put the bash file on a directory not knowing “noexec” option in use, even you can use “bash ./script” to run the bash, the expansion would fail — saying “the architecture or bitness (32/64) of the bundled JVM might not match your machine” which is quite misleading.

So when seeing some strange issues about execution on a Linux system, don’t forget to take a look at the mount options of your filesystem.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s