the different way of mounting Google drive with your Ubuntu

As I explained it in my previous blog post, using the built-in feature of gnome to mount Google drive have some serious limitations. Here I describe all the solutions I have tried.

Context

The native solution provided by the GNOME and KDE environments rely on dedicated libraries to wrap the I/Os.

This is the same idea for the two libraries, it provides a superset of I/Os functions that make easier I/Os on remote target accessible via HTTP/FTP. Or any other protocols if you write the corresponding extension. The goal is to display remote file storage in your window manager, transparent for the end-user.

The main drawback is that if your application don't use the file dialog of the window manager it don't work. And there is a lot of case when apps don't use the dialog of the file manager. Examples:

  • Qt or KDE pass running on classical Ubuntu
  • Other graphical toolkits like Tk or AWT for java apps

nautilus_config

To be clear if your application doesn't linked on GIO or KIO, it don't work.

$ ldd $(which gnumeric) |grep gio
    libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f6fffcb7000)
$ ldd $(which vim) |grep gio
$ 

Warning: the google drive slave for KIO does not work with Ubuntu 20, see https://bugs.launchpad.net/ubuntu/+source/kaccounts-integration/+bug/1864627

The rclone problem

Rclone is a tool that is used for all cloud operations. It supports a wide variety of cloud providers and have a lot of really cools features like mount. The approach is very different from KIO/GIO. This is based on FUSE a feature of the linux kernel. This is really powerfull compared to the KIO/GIO approach because you don't need to change the code source of your application. It's just a standard Unix mount.

nautilus_config

Rclone token renewal

Okay, it sounds great but what's the problem with rclone? I used rclone in 2020 and I finally gave up because the mount was frequently break due to token expiration. The defaults of rclone are:

  • it's a command line tool so it's not as user-friendly as clicking on the nautilus windows manager to connect your drive. Rclone setup is done through a text-mode interface.
  • Rclone is more a sysadmin tools than a end-user tools. Many gory details are visible and slow down the usage
  • all the low-level details of the Google storage API are visible. So you have to create and declare rclone as an application in the google Console API to have your own client id. Having your own client id is not required by it is a good practice. It means you have to be familiar with Oauth2, Google apps and things like this (even if there is an official documentation for doing it)
  • to automate the mount you have to create your own systemd user units
  • I never succeed to automate the token renewal. It means that each time the token expires, I had to re-run the config in text mode :-(. This a known problem. It's the most annoying problem

I hope that Rclone will improve all this things because it's so frustating to see that the mount is working very well and it is broken one week after. I don't understand why it's so simple to connect with Gnome and why it's complex with Rclone. Maybe future posts for the blog? :-) :-)

By @Romain JACQUET in
Tags :