13

I connected my action camera (GoPro Hero 5) to the computer running Ubuntu 16.10 LTS to download files. To my surprise, I did not see the camera's folder in /media/. Running find | grep DCIM from the root folder discovered a folder with the following path, which contained the video files I was looking for:

/run/user/1000/gvfs/gphoto2:host=%5Busb%3A003%2C094%5D/DCIM/

So, what is /run/user/1000/gvfs/ and how is its purpose different than /media/?

Eric Carvalho
  • 54,385
  • 2
  • @Zanna I don't think that's related. I do not have any permissions problem. I am asking why the camera does not get mounted to /media/ just like all other usb devices that I tried so far. – AlwaysLearning Oct 27 '16 at 12:51
  • 1
    hmm the answer tells what /run/user/1000/gvfs is - a mountpoint for FUSE. If that's not what you're asking, you might want to edit the title of your question. But I wasn't saying it is a duplicate – Zanna Oct 27 '16 at 12:57
  • @Zanna You are right. I guess the question becomes: why in the world would a camera use FUSE? – AlwaysLearning Oct 27 '16 at 13:02
  • 1
    @AlwaysLearning Why wouldn't it? FUSE (the name includes "user-space") allows ordinary user to mount devices - you don't want normal users to apply administrator permissions just to access a camera or a phone (even allowing for udisks and polkit). http://unix.stackexchange.com/a/65074/70524 – muru Oct 27 '16 at 14:08
  • @Zanna Related to your related is grep is murdered by the /run directory (and a few others too) and one of the reasons it takes 53 hours to run: https://askubuntu.com/questions/1005437/greping-all-files-for-a-string-takes-a-long-time – WinEunuuchs2Unix May 12 '18 at 00:14
  • @AlwaysLearning This question is old and it would be tidy things if you wrote an answer and accepted it. Just use @ WinEunuuchs2Unix in a comment afterwards and I'll up-vote it (within reason). – WinEunuuchs2Unix Aug 23 '18 at 00:38

1 Answers1

15

All roads lead to Gnome

Ubuntu is based upon many things plus home-grown programming from Canonical (the owners of Ubuntu). Most people know it is based on Linux kernel and provides a "GNOME" Desktop environment. But it is also based on Debian and perhaps just as important Gnome Internals. It is so intrinsic I dare to say on Ubuntu that: "All roads lead to Gnome".

What is GIO / gvfs?

In your question, /run/user/1000/gvfs/ the gvfs component stands for "Gnome Virtual File System". Your camera and Android phones are mounted in this "User Space" outside of "Kernel Space" where a normal "mount" occurs.

To learn more about GIO (Gnome Input Output I surmise) see here and here. Ubuntu has a page about using GIO to mount devices using the gvfs-mount command.

The other component in your question /run/user/1000/gvfs/ is the /run/user component. This was created by systemd to circumvent using the /tmp directory which was common practice for such devices because it side-stepped network "rules". See here.

The other part of your question is how is it different from /media?

The /media directory is where removable storage is located. The removable storage is in a familiar file format such as ext4, fat or ntfs. The device names and mount names are static.

Your Android phone is not just removable storage, but a removable foreign operating system that has storage. The storage is generally accessed with MTP. However, there is a host of programs to communicate with the phone. That is why it goes into /run/user/1000/gvfs. Samba also goes into the same directory chain, but I haven't researched that one yet.

In the /run/user/1000 directory structure the mount names are dynamic and change with every connection. For example, my phone currently is:

$ ll /run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C013%5D
total 0
dr-x------ 1 rick rick 0 Dec 31  1969 ./
dr-x------ 3 rick rick 0 May  9 18:20 ../
drwx------ 1 rick rick 0 Dec 31  1969 Internal storage/
drwx------ 1 rick rick 0 Dec 31  1969 SD card/

The USB enumeration is notorious for changing, so you can be assured the directory name will be different next time. /media "stuff" on the other hand is static.

Notice the dates shown by Ubuntu 16.04 under Kernel 4.14.34. I haven't had this Android Smartphone since the year 1969. I guess we can call this a bug.

Pablo Bianchi
  • 15,657
  • 1
    You are right. If you mount a Samba share from your file manager it goes into gvfs. But if you mount a Samba share through fstab, it goes into /media. This confused me at first but now I just accept. – Organic Marble May 12 '18 at 00:16
  • @OrganicMarble Sadly I haven't tried Samba yet. I have it on my to-do list along with Ubuntu Server, LAMP, SQL and C. Thanks for sharing your experience, I only read briefly about it's relationship to /run/user/1000. – WinEunuuchs2Unix May 12 '18 at 00:19
  • I have spent much time learning Samba! No expert for sure but I have a working config. Best wishes as you learn it. – Organic Marble May 12 '18 at 00:21
  • @OrganicMarble Actually my reason for learning was to share files with Windows 10 Ubuntu Bash (WSL) instead of my current third partition. I'm not even sure if it will work just read about it some place a month ago or two. – WinEunuuchs2Unix May 12 '18 at 00:30