Librum-Server icon indicating copy to clipboard operation
Librum-Server copied to clipboard

Docker install won't start with error "Access denied for user 'librum'@'localhost'"

Open goaliedude3919 opened this issue 1 year ago • 8 comments

docker-compose file

Logs

goaliedude3919 avatar Jul 29 '24 20:07 goaliedude3919

Same here :/

Lipown avatar Aug 01 '24 16:08 Lipown

Wanted to give Librum a try, it looks very interesting, but same error here also

benooye avatar Aug 15 '24 21:08 benooye

I've had a similar issue with Kubernetes and I've added an init-container to chmod it like this:

    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: librum-pvc
      initContainers:
        - name: init-storage
          image: busybox:latest
          command:
            - sh
            - '-c'
            - mkdir -p /vol-path && chmod -R 777 /vol-path
          resources:
            limits:
              cpu: '1'
              memory: 1Gi
          volumeMounts:
            - name: data
              mountPath: /vol-path
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always

paulcsiki avatar Sep 13 '24 13:09 paulcsiki

I still have this issue. I don't use kubernetes so I tried to implement @paulcsiki paulcsiki solution via vanilla docker compose, but to no avail...

# Init service to chmod the volume
  init-storage:
    image: busybox:latest
    command: sh -c "mkdir -p /vol-path && chmod -R 777 /vol-path"
    volumes:
      - data:/vol-path
    deploy:
      resources:
        limits:
          cpus: "1"
          memory: 1G
    restart: "no" 

abdessalaam avatar Sep 14 '24 10:09 abdessalaam

I've had a similar issue with Kubernetes and I've added an init-container to chmod it like this:

    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: librum-pvc
      initContainers:
        - name: init-storage
          image: busybox:latest
          command:
            - sh
            - '-c'
            - mkdir -p /vol-path && chmod -R 777 /vol-path
          resources:
            limits:
              cpu: '1'
              memory: 1Gi
          volumeMounts:
            - name: data
              mountPath: /vol-path
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always

As someone who's not super well versed in docker, is that something that you added on top of your existing compose file? What exactly would should my docker compose file look like when trying this?

goaliedude3919 avatar Sep 17 '24 15:09 goaliedude3919

I worked out one of the issues here. The file permission issue is due to using a bind mount instead of docker volumes. The container executes commands using a non-root uid and gid that doesn't match the docker user, so if you want to use a bind mount then you need to manually set the ownership of the server's storage directory to uid=999 and gid=999 before running the container. eg:

chown -R 999:999 /opt/apps/librum

It looks like you also have a database login issue as well though. Are the credentials in your docker-compose file the ones you actually used? Or are they placeholders?

swonky avatar Nov 13 '24 04:11 swonky

The permission issue is due to the Dockerfile assign a user itself:

RUN groupadd -r -f librum-server
RUN useradd -r -g librum-server -d /var/lib/librum-server --shell /usr/sbin/nologin librum-server

And it seems 999 is picked as the user ID.

These two statements really are unnecessary. User and group ID are better assigned by the user at runtime.

zhen-huan-hu avatar Jan 19 '25 21:01 zhen-huan-hu

Ok, I well find

RUN groupadd -r -f librum-server
RUN useradd -r -g librum-server -d /var/lib/librum-server --shell /usr/sbin/nologin librum-server

into the Dockerfile... But what next (sorry I noob)

I cant /bin/bash into the container to fix anything.. Do I need to specify uid=999 (and group) has container variables ?

Realy interessting project I will give a try, thanks for the help

bonnebulle avatar Apr 24 '25 19:04 bonnebulle