astrada / google-drive-ocamlfuse

FUSE filesystem over Google Drive
https://astrada.github.io/google-drive-ocamlfuse/
MIT License
5.57k stars 354 forks source link

Automounting default does not automount #566

Open gomfy opened 5 years ago

gomfy commented 5 years ago

Problem

Automouting the default drive via command in ~/.profile gives error:

cannot access 'google_drive': Input/output error

Command that fails

I have the following mount lines in ~/.profile:

# automount google drives
mount | grep "${HOME}/politics/politics_google_drive" >/dev/null || /usr/bin/google-drive-ocamlfuse -verbose -label politics "${HOME}/politics/politics_google_drive"&

mount | grep "${HOME}/sociology/sociology_google_drive" >/dev/null || /usr/bin/google-drive-ocamlfuse -verbose -label sociology "${HOME}/sociology/sociology_google_drive"&

mount | grep "${HOME}/google_drive" >/dev/null || /usr/bin/google-drive-ocamlfuse -verbose -label default "${HOME}/google_drive"&

Additional weirdness

fusermount -u ~/google_drive
google-drive-ocamlfuse ~/google_drive

Log file

The gdfuse.log for the default google_drive has could-not-resolve-host errors like this:

Error during request: Code: 6, Description: CURLE_COULDNT_RESOLVE_HOST, ErrorBuffer: Could not resolve host: www.googleapis.com

after the unsuccessful automount attempt.

System

I'm using Linux 5.0.0-23-generic and Ubuntu 18.04.1

jcemerson commented 5 years ago

I'm having this exact same issue, down to the letter. Automount via .profile results in a mounted drive I can't access: The UI gives message "input/output error" when trying to open the mounted drive in File Manager.

Checking the curl and gdfuse logs, the process can't resolve www.googleapis.com. Unlike others that have reported similar issues, my errors are showing at the outset and not later on after the drive was already successfully mounted.

I noticed that on occasion my laptop has been slow to connect to wi-fi, so I decided to try a hardwire connection and the process worked as expected! It's not practical for me to maintain a hardwire connection on my laptop in all circumstances, so I still need to work towards a solution, but perhaps this insight will help troubleshoot other issues.

Is it possible any of you are having transient DNS or network/internet connectivity issues?

Also, an interesting detail that I haven't figured out, when the mounting failure takes place upon start-up, the 'Google-Drive' directory I'm mounting to is no longer visible in File Manager, though I can see it's still there using ~$ ls. Once I unmount the drive with ~$ fusermount -u Google-Drive and refresh the File Manager, the folder is visible again.

simulationrose commented 4 years ago

+1

Exactly the same behavior. I always have to unmount googledrive manually before I end my session to make the startup script work. Otherwise, I will run into the problem mentioned above that the file manager cannot access my home directory anymore. After unmounting and mounting it manually everything is fine again. Any ideas how to solve that issue? Thx a lot.

NightfallAlicorn commented 4 years ago

I'm having the same issue when I add it to Xubuntu's Session and Startup application with sh -c "google-drive-ocamlfuse ~/drive".

Manually running it in Terminal works fine after Xubuntu has started. The odd thing is it was working fine yesterday but now it throws an input and output error in my home directory. Had me scared for a moment.

fleapower commented 4 years ago

I was having this exact same problem and was able to fix it this morning. In sum, I pinged Google to confirm a network connection before mounting the drive. I'm a relative noob to Linux (been using it only for about two weeks), so hopefully you'll understand my instructions:

1) Create this script and put it in /home/username/bin (username changed to your profile name). You'll also need to change the "/home/username/GoogleDrive" in the script below to whatever your mount point is.

#!/bin/bash

while true; do
  # check to see if there is a connection by pinging a Google server
  if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
    # if connected, mount the drive and break the loop
    google-drive-ocamlfuse /home/username/GoogleDrive; break;
  else
    # if not connected, wait for one second and then check again
    sleep 1
  fi
done

2) Make the script executable either through the CLI or a file manager which allows you to change permissions.

3) Used AutoStart in Kubuntu and added the script. I've heard AutoStart is called Startup Applications in other distros.

I've tested this and it is mounting the drive on my system. For confirmation, please let me know if this works for you.

jcemerson commented 4 years ago

I was having this exact same problem and was able to fix it this morning. In sum, I pinged Google to confirm a network connection before mounting the drive. I'm a relative noob to Linux (been using it only for about two weeks), so hopefully you'll understand my instructions:

1. Create this script and put it in /home/**_username_**/bin (username changed to your profile name).  You'll also need to change the "/home/username/GoogleDrive" in the script below to whatever your mount point is.
#!/bin/bash

while true; do
  # check to see if there is a connection by pinging a Google server
  if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then
    # if connected, mount the drive and break the loop
    google-drive-ocamlfuse /home/username/GoogleDrive; break;
  else
    # if not connected, wait for one second and then check again
    sleep 1
  fi
done
1. Make the script executable either through the CLI or a file manager which allows you to change permissions.

2. Used AutoStart in Kubuntu and added the script.  I've heard AutoStart is called Startup Applications in other distros.

I've tested this and it is mounting the drive on my system. For confirmation, please let me know if this works for you.

Thanks for the tip. I implemented something similar, but instead using ping www.googleapis.com since that's the address the logs indicated couldn't be resolved and is required for this program to work. This should account for any DNS issues that may prevent resolving the IP, despite an internet connection.

It would be nice (though not essential) if this program could account for this before mounting since it will mount no matter what, it seems. (I LOVE THIS PROGRAM, BY THE WAY!)

Since most of my issues stem from WiFi failing to auto-connect when the SSID I'm connecting to is hidden, I added a start-up service that scans for the hidden SSID once network-online.target is up. Then I have this mounting script running at start-up using Startup Applications (Linux Mint 19.3).

Now my WiFi is connected immediately at startup 98% of the time, and the change you prompted today with your script will ensure that I don't mount GD the remaining 2% of the time until the internet connection is established.

astrada commented 4 years ago

In version 0.7.15 there is a fix that should resolve (I hope :wink:) this issue.

Rednox commented 4 years ago

@astrada I tried exactly what @gomfy did in the "~/.profile" running version 0.7.18 and it is working. I think the issue is resolved. Great work!