Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autostart in Ubuntu #18

Closed
cubica opened this issue Sep 23, 2013 · 9 comments
Closed

Autostart in Ubuntu #18

cubica opened this issue Sep 23, 2013 · 9 comments
Labels

Comments

@cubica
Copy link

cubica commented Sep 23, 2013

Very nice project indeed!
I'm wondering which is the right way to launch google-drive-ocamlfuse at startup in Ubuntu. Some blogs suggest to add it to ubuntu's startup applications, but I'm not convinced since fuse is not unmounted on logout, so if I login twice the program is started twice, trying to remount google drive on the same path and resulting in an error.
Any suggestions?

@astrada
Copy link
Owner

astrada commented Sep 23, 2013

I didn't try it, but it looks like afuse is the tool you are looking for. It is packaged for Ubuntu, and you can configure it running the command:

$ afuse -o mount_template='google-drive-ocamlfuse %m' -o unmount_template='fusermount -u -z %m' mountpoint

(replace mountpoint with your actual directory).

Here you can find further examples.

Please, let me know if it works, so I can add this info to the wiki. Thanks

@cubica
Copy link
Author

cubica commented Sep 24, 2013

Thank you very much for the info!
The problem with afuse is that it mounts fuse filesystems on-demand based on the subdirectory of mountpoint that is requested.
For example, if I launch it like this

$ afuse -o mount_template='google-drive-ocamlfuse %m' -o unmount_template='fusermount -u -z %m' /my/path

And then I try

$ ls /my/path/anything

afuse mounts the google drive in /my/path/anything, where anything can be, well, anything :). So the result is that I get a new mount of the same google drive each time I access a subdirectory of mountpoint, which is not optimal.
I'm considering other solutions for on-demand mounting like x-systemd.automount in fstab or automount, however any further advice is highly welcome!

@astrada
Copy link
Owner

astrada commented Sep 24, 2013

I don't know if this solves the issue, but maybe you can use also the %r parameter in the mount template. E.g.:

$ afuse -o mount_template='google-drive-ocamlfuse -label %r %m' -o unmount_template='fusermount -u -z %m' /my/path

And then access the mounted filesystem in /my/path/default. Maybe, this is the way afuse is using to discriminate local/remote paths.

@cubica
Copy link
Author

cubica commented Sep 24, 2013

I've tried this:

$ ./afuse -o "mount_template=google-drive-ocamlfuse -label %r %m" -o "unmount_template=fusermount -u -z %m" -o "populate_root_command=cat /home/cubica/google-drive-labels" /home/cubica/google-drive

/home/cubica/google-drive-labels is just a text file with two label names corresponding to my two gdrive accounts, and it's used by afuse's populate_root_command option in order to constrain the mountable directories to that labels (see "Pre-populating afuse Root" at https://github.com/pcarrier/afuse).
This should work, the only problem is that, when the command is launched and the first label is mounted, the following folders are created inside /home/cubica/google-drive:

  • .Trash
  • .Trash-1000
  • .xdg-volume-info

So afuse immediately tries to mount those too, passing their name as a label to google-drive-ocamlfuse, which doesn't recognize such labels so tries to make me authenticate them. This somehow makes gnome hang completely, so I have to switch to a shell with ctrl-alt-f1 and kill both afuse and all the google-drive-ocamlfuse processes in order to revive gnome.
Any clue about why those dirs appear after the first mount, and how to prevent this misbehavior?
As a side note, the dirs are created even without the populate_root_command option, and trying to access them hangs the system as well.

@cubica
Copy link
Author

cubica commented Sep 24, 2013

Errata corrige: the directories above are created as soon as afuse is launched, with or without the populate_root_command option. I think they are created by GVFS, which is somehow activated by a fuse mount. I'll dig deeper and let you know.

@astrada
Copy link
Owner

astrada commented Sep 24, 2013

Those directories are created by GNOME (here you can find something about the trash directories), probably as a side effect of automount. But I have no idea how to modify the behavior without affecting other applications.

@robinhood007
Copy link

NOTE its not an issue, I am just little confused..
I have added this command:
google-drive-ocamlfuse "/home/onelove/loveAtD/Google Drive"
on my ubuntu startup and it seems to work ok.. now m i going it wrong???

@astrada
Copy link
Owner

astrada commented Oct 21, 2013

@cubica I don't know if you are still looking for a way to automount the filesystem, But I think I made some progress, and I wrote down a wiki page with instructions on how to proceed. Let me know if this works for you.

@astrada
Copy link
Owner

astrada commented Nov 4, 2013

I'm closing this issue. If something does not work as expected, please reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants