bindfs icon indicating copy to clipboard operation
bindfs copied to clipboard

Fstab not mounting bindfs mapping

Open jrussell88 opened this issue 6 years ago • 8 comments

In order to access the hard drive from my out-of-action MacBook, I attached my 'Home' partition via a USB connection to another machine. Both running Ubuntu 17.04 As I'm the second user on that PC, that machine's first user has ownership rights over my files, and I have not (due to Ubuntu using the UID- and GID-numbers to define file ownership).

Ubuntu automounts the USB drive at: /media/me/Home.

To fix the permissions to give me temporary access, I added a duplicate mount point: /media/Home and tested the command:

sudo bindfs --map=other_user/me --create-for-user=other_user --create-for-group=other_user /media/me/Home /media/Home

which, although the gid remains the other user's, gives me ownership of my files as the second user on the current system, and default ownership of any new files by uid 1000.

I added a line in fstab to achieve the same thing:

/media/me/Home /media/Home fuse.bindfs map=other_user/me,create-for-user=other_user,create-for-group=other_user 0 0

The fstab entry doesn't work - I don't have access to the mount point and my partition isn't mounted.

In Nautilus, the bindfs /media/Home partition displays the error: 'This partition could not be displayed. You do not have the permissions necessary to view the contents of "Home". In the command line, ls -la returns:

ls: cannot open directory '/media/Home/': Permission denied

sudo ls -la returns:

total 0

Is there something else I should do?

jrussell88 avatar Nov 10 '17 16:11 jrussell88

Strange, I'm not able to reproduce the issue with a similar fstab line, although I'm just mounting an ordinary directory, not an external disk.

  • Does it work if you mount from an ordinary directory instead?
  • If you do sudo mount /media/Home, what does it say?

mpartel avatar Nov 11 '17 11:11 mpartel

I get the same result from /Home and from /home/me/Documents/Home.

sudo mount /media/Home

works as expected. Could it be a timing issue with the mounting of USB drives?

jrussell88 avatar Nov 11 '17 14:11 jrussell88

I get the same result from /Home and from /home/me/Documents/Home

So, just to be clear, here you're mounting an ordinary directory to an ordinary directory, and neither has anything to do with any USB drives? And fstab still doesn't work?

Could it be a timing issue with the mounting of USB drives?

Good idea, it might be. What happens if you manually mount them in the wrong order?

Another possibility is that whatever reads fstab just can't handle the same path occurring twice.

mpartel avatar Nov 11 '17 15:11 mpartel

My misunderstanding. I switched the USB drive to mount from different folders. I've tried replacing the USB partition with a local folder, and mounting it in /media/Home with the same options and that works as expected.

The USB drives automount during boot; fstab mounts the bindfs drive. I added rootdelay=20 to Grub's boot line I added the options noauto,x-systemd.automount to fstab, to delay mounting

Neither had any effect

jrussell88 avatar Nov 11 '17 15:11 jrussell88

Drives is set to default automount options, and the USB partitions are mounted on boot. I tried setting nofail,noauto for the partition and the same options for Bindfs, but the system wouldn't boot.

jrussell88 avatar Nov 11 '17 17:11 jrussell88

I altered the fstab to delay the mount until the network was up:

/media/john/Home /media/Home fuse.bindfs map=panadda/john,create-for-user=panadda,create-for-group=panadda,_netdev 0 0

And until I accessed the mount point:

/media/john/Home /media/Home fuse.bindfs map=panadda/john,create-for-user=panadda,create-for-group=panadda,nofail,noauto,x-gvfs-show 0 0

But neither worked.

jrussell88 avatar Nov 11 '17 18:11 jrussell88

Did you try adding the fstab lines after boot and doing the mounting manually (without rebooting)? This might give us some information.

mpartel avatar Nov 15 '17 20:11 mpartel

Was this ever figured out? I can't seem to get this to work either.

kdub0154 avatar Oct 25 '21 12:10 kdub0154