3

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

Done.

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?

1 Answer 1

6

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.

1
  • Interestingly enough this is really helpful for starting s3fs in a running Docker container as well. Just what I was looking for. Thanks!
    – ryan1234
    Jan 13, 2015 at 18:59

You must log in to answer this question.

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