Automatically mount Google Drive with google-drive-ocamlfuse at startup?


I got the google-drive-ocamlfuse to work using this link:

Now I am trying to mount the Google Drive at startup. I did add the following command to Startup Applications: “google-drive-ocamlfuse ~/googledrive”

But after I boot up, the drive is still not mounted until I enter the above mount command manually. What am I doing wrong?

Appreciate any help on this…


I got it to work by changing the mount command in Startup Applications to the following:

google-drive-ocamlfuse “/home/john/googledrive”


Thanks for this question and solution. really helped me out.


I could not get it done on Ubuntu 18.04 LTS. The command “google-drive-ocamlfuse ~/mygoogledrive” works on the terminal, but it does not work when added to startup applications.

I have tried different options like “google-drive-ocamlfuse /home/mygoogledrive” or google-drive-ocamlfuse “/home/mygoogledrive” (with and without quotes), but no luck.

Any help appreciated!


You needed /home/username/googledrive not /home/googledrive

You don’t need any quotes unless “/path/to/googledrive” contains any spaces or other special characters that the shell might interpret. * & $ # ! ( ) { } [ ] " ’ ` < > ? ; \ | all have meanings to the shell and need to be not onlyt quoted but escaped if you have a directory or filename that includes one of those characters.

No matter what, you don’t want quotes around the entire command. That tells the shell to look for a file named “something [space] /path/to/foo”, and try to execute it with no arguments. There is no such program of course. :slight_smile: There is a program called “something” and you want to execute THAT with an argument of “/path/to/foo”

One thing I do not know myself yet because I have not tested yet: What happens if wifi isn’t working until long after the desktop session is started? IE, you start the desktop session, but there is no network until you log in to the captive portal at a coffee shop. But google-drive-ocamlfuse was executed right away as soon as you entered your pasword. Does it fail and thats that? or does it stay running even though it failed, and retry every 60 seconds regardless if the network is up or down, and then later when the network is up it just starts working? That could be one reason this might not work for some people sometimes yet work for other people other times, purely by the luck of the timing of how fast different things happen.


… and the answer, for me, is google-drive-ocamlfuse stays running even after the initial connection attempt fails, but does NOT start functioning when the network connection starts working later. It has been over 10 minutes now since I enabled wifi and connected to the access point. I even logged in to google drive in a browser just to prove that there is working connectivity and account access to google drive.

Also I verified that neither “~” nor “${HOME}” works for the path to my home dir in /home/bkw/.config/lxsession/Lubuntu/autostart
it must be “/home/bkw/GoogleDrive” (with or without quotes in this case, because there are no spaces in that path)

(I am using lubuntu & lxde, not mate, so some other desktop environment with some other software to run session programs may behave differently.)

I guess I have to wrap google-drive-ocamlfuse in my own shell script to check for network connectivity and loop, retrying periodically, and killing also when network connectivity drops, so that later when reconnecting you don’t get mutiple processes. That’s kind of crap, needing essentially a daemon to sit and watch another daemon, to sit and watch the google drive mount point. Maybe the pam_automount idea from the wiki on the gdfuse github is the way to go.