mitcdh / docker-google-drive-ocamlfuse

Mount Google Drive with FUSE within a Docker container
75 stars 19 forks source link

Mounting google-drive-ocamlfuse in a docker container #14

Open sin3point14 opened 2 years ago

sin3point14 commented 2 years ago

This isn't exactly related to this project, but I think you can help me with a problem I'm facing since it is similar :)

I am hosting a navidrome instance on my machine and mounting my google drive Music folder into it using google-drive-ocamlfuse. On the host, I can see my google drive folder contents, but the directory, when mounted into a docker container, is empty. I don't have experience with Linux FS stuff, but is this issue somewhat related to to PUID and PGID settings specified at https://github.com/mitcdh/docker-google-drive-ocamlfuse#environment-variables (navidrome container runs as root)? Also how can I got about debugging my issue?

What I did:

senpai@sinvps-reborn:~/navidrome$ mount --bind ./music ./music
senpai@sinvps-reborn:~/navidrome$ mount --make-shared ./music
senpai@sinvps-reborn:~/navidrome$ ls
Navidrome.tar.gz  data  docker-compose.yml  music
senpai@sinvps-reborn:~/navidrome$ google-drive-ocamlfuse -o allow_other -label me ./music/
senpai@sinvps-reborn:~/navidrome$ ls music
ls: reading directory 'music': Input/output error
'XXX.mp3'
"YYY.mp3"
'ZZZ.mp3'

I don't know why I get ls: reading directory 'music': Input/output error and docker.service doesn't contain and MountFlags statement.

My compose file:

 # This is just an example. Customize it to your needs.

version: "3"
services:
  navidrome:
    image: deluan/navidrome:latest
    security_opt:
      - seccomp:unconfined
    cap_add:
      - "MKNOD"
      - "SYS_ADMIN"
    devices:
      - /dev/fuse
    ports:
      - "4533:4533"
    environment:
      # Optional: put your config options customization here. Examples:
      ND_SCANSCHEDULE: 1h
      ND_LOGLEVEL: info
      ND_BASEURL: ""
    volumes:
      - "/home/sin3point14/navidrome/data:/data"
      - "/home/sin3point14/navidrome/music:/music:shared"

Edit: To debug ls: reading directory 'music': Input/output error I ran strace ls music and the entire log is available here https://controlc.com/966c4d54 while I found this to be particularly interesting:

openat(AT_FDCWD, "music", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
getdents(3, /* 52 entries */, 32768)    = 3848
getdents(3, /* 53 entries */, 32768)    = 3872
getdents(3, /* 48 entries */, 32768)    = 3896
getdents(3, /* 49 entries */, 32768)    = 3856
getdents(3, /* 48 entries */, 32768)    = 3824
brk(0x559269069000)                     = 0x559269069000
brk(0x55926905f000)                     = 0x55926905f000
getdents(3, /* 18 entries */, 32768)    = 1352
getdents(3, 0x559269021500, 32768)      = -1 EIO (Input/output error)
openat(AT_FDCWD, "/usr/share/locale/C.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/C.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/C/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "ls: ", 4ls: )                     = 4
write(2, "reading directory 'music'", 25reading directory 'music') = 25
openat(AT_FDCWD, "/usr/share/locale/C.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/C.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/C/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Input/output error", 20: Input/output error)    = 20
write(2, "\n", 1
)                       = 1
close(3)                                = 0

Though after this, it still prints all the files

mitcdh commented 2 years ago

Asking on the astrada repo is best, this was just a quick implementation I put together to run the tool in Docker to avoid adding it to the host. Mounting with debug might get you more information.