2

I'm trying to mount my database to my container using gcsfuse but im getting this error when i run gcsfuse storage-name /media i get this error:

...
2022/08/07 20:33:42.908030 Mounting file system "development-videoo-storage1"...
daemonize.Run: readFromProcess: sub-process: mountWithArgs: mountWithConn: Mount: mount: running /usr/bin/fusermount: exit status 1

Now there is already a question posted about this topic which seems to have a similar issue. However I've allready tried everything on it to no avail. I've also tried this question.

I ran getent passwd and saw that there is indeed a user caller "www-data" so I gave it permissions using chown -R www-data:www-data / and manually created media directory using mkdir then ran chown -R www-data:www-data media but it still gives me the same error when I run gcsfuse storage-name /media.

I'm using kubernetes so I added this to my deployment.yaml file:

        securityContext:
        privileged: true
        capabilities:
          add:
            - SYS_ADMIN

But it still gives the same error. This is my Dockerfile where i install gcsfuse:

FROM --platform=amd64 ubuntu:22.10

# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]

# Install.
EXPOSE 80

RUN apt-get update -y && apt-get dist-upgrade -y && apt-get -y install lsb-release curl gnupg && apt -y install lsb-core

ENV GCSFUSE_REPO gcsfuse-stretch
USER root


RUN apt-get update -y && apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl gnupg
RUN echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list
RUN echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

# Install gcsfuse and google cloud sdk
RUN apt-get update -y  && apt-get install -y gcsfuse google-cloud-sdk \
    && apt-get autoremove -y \
    && apt-get clean -y \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

I've also checked the permissions for accessing the cloud storage (storage-name) and it says "Public access Not public" but my service account seems to have the right permissions (I'm not %100 sure whether it has the right permissions or not).

I've also tried running gcsfuse -o rw,noauto,user,implicit_dirs,allow_other storage-name /media to be greeted with the same error...

Edit: Here is the result of gcsfuse --implicit-dirs --foreground --debug_gcs --debug_fuse storage-name /media:

WARNING: gcsfuse invoked as root. This will cause all files to be owned by
root. If this is not what you intended, invoke gcsfuse as the user that will
be interacting with the file system.
2022/08/07 21:47:00.807929 Creating a new server...
2022/08/07 21:47:00.808134 Set up root directory for bucket development-videoo-storage1
2022/08/07 21:47:00.808381 OpenBucket("development-videoo-storage1", "")
gcs: 2022/08/07 21:47:00.808669 Req              0x0: <- ListObjects("")
gcs: 2022/08/07 21:47:00.900159 Req              0x0: -> ListObjects("") (91.477658ms): OK
gcs: 2022/08/07 21:47:00.900634 Req              0x1: <- ListObjects("")
gcs: 2022/08/07 21:47:00.932224 Req              0x1: -> ListObjects("") (31.587009ms): OK
2022/08/07 21:47:00.932631 Mounting file system "storage-name"...
/usr/bin/fusermount: fuse device not found, try 'modprobe fuse' first
mountWithArgs: mountWithConn: Mount: mount: running /usr/bin/fusermount: exit status 1
command terminated with exit code 1
Turgut
  • 711
  • 3
  • 25
  • 1
    Have you checked if your GCS bucket is mounted on `path/to/mount` by entering `df -h`? I've got the same error when I'm trying to mount my bucket when it's already mounted. – Robert G Aug 08 '22 at 03:02
  • 1
    @RobertG When i run ```df -h``` I got some files listed but it does not list my mount path. – Turgut Aug 08 '22 at 07:48
  • 1
    @RobertG, do you mean that it mounts correctly, but still gives an error? – london_utku Aug 08 '22 at 07:55
  • 1
    @Turgut, yes. See my [screenshot](https://i.stack.imgur.com/iWzob.png) (need to hide some info for privacy reasons). If I enter `gcsfuse [bucket-name] [/path/to/mount]`, it gave me `daemonize.Run: readFromProcess: sub-process: mountWithArgs: mountWithConn: Mount: mount: running /usr/bin/fusermount: exit status 1` error. Try `fusermount -u /path/to/mount` to unmount your bucket from your path. – Robert G Aug 08 '22 at 21:41

0 Answers0