When a fuse filesystem is mounted via the mount command, the environment variables are not passed to the fuse script. Why?


I am trying to mount hdfs (hadoop file system) via fuse.

This is easy on the command line:

# Short example version:
LD_LIBRARY_PATH=blah hadoop-fuse-dfs -onotrash  dfs://ambari:8020 /mnt/hdfsfuse
# Actual version with full path for completeness
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/hadoop/yarn/local/filecache/11/mapreduce.tar.gz/hadoop/lib/native /usr/hdp/ -onotrash  dfs://ambari:8020 /mnt/hdfsfuse

This is all and well, but if I put the definition of the FS in /etc/fstab to then use the mount command, I end up with:

fuse_dfs: error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory

Looking at the hadoop-fuse-dfs script and adding debug output, I see that LD_LIBRARY_PATH is seen as empty in this script (this is true both if I export LD_LIBRARY_PATH first or if I add it at the start of the command)


hdp 2.5, centos 7


Short of rewriting the mount script to hardcode LD_LIBRARY_PATH, how can I have environment variables in general passed via mount?

2 Answers 2


You can write your own mount fuse helper, which then calls the real fuse script. In the simple case of an fstab entry like:

dfs://ambari:8020  /mnt/hdfsfuse  fuse.mydfshelper  flag,flag,...

then your script /usr/bin/mydfshelper is called with args

dfs://ambari:8020 /mnt/hdfsfuse -o flag,flag,...

So you just need to write a one-line mydfshelper holding something like:

LD_LIBRARY_PATH=blah hadoop-fuse-dfs -onotrash "$@"
  • That's a great tip and seems kinda obvious once you think about it :( . I have an easier option to only solve the LD_LIBRARY_PATH issue (see other answer), but I like that this answer is very generic.
    – Guillaume
    Feb 2, 2017 at 6:34

To solve my particular problem, (LD_LIBRARY_PATH), the easiest I found is to add the content of the variable in a file under /etc/ld.so.conf.d. For instance, I created /etc/ld.so.conf.d/hdp.conf with the content:


After running once ldconfig as root, this new 'ld_library_path' is available system wide.

To answer the question about environment variables in general, the answer from @meuh is best.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .