Why is mount -a not mounting fuse drive properly when executed remotely (via Fabric)?

by Jim D   Last Updated January 11, 2019 12:00 PM - source

This is a weird bug and I'm not sure where it's coming from. Here's a quick run down of what I'm doing.

I'm trying to mount a FUSE drive to an Amazon EC2 instance running Ubuntu 10.10 using s3fs (FUSE over Amazon). s3fs is compiled from source according to the instructions etc. I've also added an entry to /etc/fstab so that the drive mounts on boot. Here's what /etc/fstab looks like:

# /etc/fstab: static file system information.
# <file system>                                 <mount point>   <type>  <options>       <dump>  <pass>
proc                                            /proc           proc    nodev,noexec,nosuid 0       0
LABEL=uec-rootfs                                       /               ext4    defaults        0       0
/dev/sda2   /mnt    auto    defaults,nobootwait,comment=cloudconfig 0   2
/dev/sda3   none    swap    sw,comment=cloudconfig  0   0
s3fs#mybucket /mnt/s3/mybucket fuse default_acl=public-read,use_cache=/tmp,allow_other 0 0

So the good news is that this works fine. On reboot the connection mounts correctly. I can also do:

$ sudo umount /mnt/s3/mybucket 
$ sudo mount -a
$ mountpoint /mnt/s3/mybucket 
/mnt/s3/mybucket is a mountpoint

Great, right?

Well here's the problem. I'm using Fabric to automate the process of building and managing this instance. I noticed I was getting this error message when using Fabric to build s3fs and set up the mount process:

mountpoint: /mnt/s3/mybucket: Transport endpoint is not connected

I isolated it down the the problem and built a fabric task that reproduces the problem:

def remount_s3fs():
    sudo("mount -a")

Which does:

[ec2-xx-xx-xx-xx.compute-1.amazonaws.com] Executing task 'remount_s3fs'
[ec2-xx-xx-xx-xx.compute-1.amazonaws.com] sudo: mount -a

[And yes, I was sure to unmount it before running this task.] When I check the mount using mountpoint I get:

$ mountpoint /mnt/s3/mybucket
mountpoint: /mnt/s3/mybucket: Transport endpoint is not connected


But if I run sudo mount -a at the command line, it works. Hrm.

Here is that fab task output again, this time in full debug mode:

[ec2-xx-xx-xx-xx.compute-1.amazonaws.com] Executing task 'remount_s3fs'
[ec2-xx-xx-xx-xx.compute-1.amazonaws.com] sudo: sudo -S -p 'sudo password:'  /bin/bash -l -c "mount -a"

Again, I get that transport endpoint not connected error. I've also tried copying and pasting the exact command run into my ssh session (i.e. sudo -S -p 'sudo password:' /bin/bash -l -c "mount -a") and it works fine.

So...that's my problem. Any ideas?

Tags : fuse fabric s3fs

Answers 1

Okay isn't this always how it works... Just as I submitted this question, a dim light bulb went off in my head and I remembered something about the pty terminal Fabric uses causing problems every now and then. Found this is in the Fabric docs for run():

You may pass pty=False to forego creation of a pseudo-terminal on the remote end in case the presence of one causes problems for the command in question.

Well, sure enough if I amend the sudo statement in my task as follows:

sudo("mount -a", pty=False)

Everything works just fine.

Jim D
Jim D
March 15, 2011 15:45 PM

Related Questions

S3FS and Fuse, scale out or scale up

Updated December 01, 2015 16:00 PM

s3fs Input/output error

Updated May 14, 2015 22:00 PM

s3fs-mounted S3 bucket shows bad filesizes

Updated May 22, 2017 15:00 PM

s3fs: how to force remount on errors?

Updated January 10, 2019 00:00 AM