Python running shell script with subprocess returns 'fuse: device not found'

163 views Asked by At

I'm trying to mount an S3 bucket with s3fs so I can have access to the files in the bucket from a JupyterLab server. When I mount it directly from the terminal, by running s3fs <bucket_name>:/<bucket_folder> /home/<username>/s3-bucket -o umask=022 -o allow_other it works properly and mounts the S3 folder on the filesystem.

However, I need to do this when a user logs in to JupyterHub, which creates a user in the server, and I have to mount the S3 bucket for that specific user. For that reason, I am trying to mount the bucket from a python script that runs every time a user logs in. I run the same command from python, using the subprocess module:

bash_command = f"s3fs <bucket-name>:/<bucket-folder> /home/{system_username}/s3-bucket -o umask=022 -o allow_other".split()
result = subprocess.run(bash_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)

It throws the following error:

CompletedProcess(args=['s3fs', '<bucket-name>:/<bucket-folder>', '/home/<username>/s3-bucket', '-o', 'umask=022', '-o', 'allow_other'], returncode=1, stdout='', stderr="fuse: device not found, try 'modprobe fuse' first\n")

0

There are 0 answers