docspell icon indicating copy to clipboard operation
docspell copied to clipboard

solr error message

Open nompangyi19 opened this issue 3 years ago • 14 comments

Cannot write to /var/solr as 8983:8983 drwxr-xr-x 1 1026 users 0 Jul 27 14:11 /var/solr

You will receive a message that you will continue to restart. Is there a reason?

nompangyi19 avatar Jul 31 '22 18:07 nompangyi19

I get the same on the 9.0 solr version. Funnily enough when I tried running it on a different pc everything worked again. Also /var/solr is actually writeable in the container.

My solution was downgrading to version 8.9 for now

lohningerthomas avatar Aug 01 '22 07:08 lohningerthomas

I haven't tried with solr 9 yet myself. Maybe its good to use the 8.x version for now. The described error is due to a permission problem. Sometimes there is some fiddling needed when running through docker. But I would need more details... maybe the solr docs are helpful here, too.

eikek avatar Aug 01 '22 09:08 eikek

I already did a lot of fiddling so maybe I can share my experience so far:

  • As mentioned already above it seems to be a problem with specific docker configs as it does not work on my server but on my private pc there are no problems running solr
  • When starting the solr container while bypassing the entrypoint script (and just open a shell in the container) I managed to find the file where the error lines are produced. It is in /opt/solr-9.0.0/docker/scripts/init-var-solr
  • This script checks if the the /var/solr directory is writeable and exits if it is not
  • While the script doesn't see the dir as writeable you can create files and subdirectories inside /var/solr manually, so it obviously is writeable
  • This error keeps persisting even when mounting a server directory to the /var/solr folder
  • It also persists when the container is started using root as a user

And after 2 days of researching I just opted for 8.9 as this is working out of the box

lohningerthomas avatar Aug 01 '22 12:08 lohningerthomas

I already did a lot of fiddling so maybe I can share my experience so far:

  • As mentioned already above it seems to be a problem with specific docker configs as it does not work on my server but on my private pc there are no problems running solr
  • When starting the solr container while bypassing the entrypoint script (and just open a shell in the container) I managed to find the file where the error lines are produced. It is in /opt/solr-9.0.0/docker/scripts/init-var-solr
  • This script checks if the the /var/solr directory is writeable and exits if it is not
  • While the script doesn't see the dir as writeable you can create files and subdirectories inside /var/solr manually, so it obviously is writeable
  • This error keeps persisting even when mounting a server directory to the /var/solr folder
  • It also persists when the container is started using root as a user

And after 2 days of researching I just opted for 8.9 as this is working out of the box

I already did a lot of fiddling so maybe I can share my experience so far:

  • As mentioned already above it seems to be a problem with specific docker configs as it does not work on my server but on my private pc there are no problems running solr
  • When starting the solr container while bypassing the entrypoint script (and just open a shell in the container) I managed to find the file where the error lines are produced. It is in /opt/solr-9.0.0/docker/scripts/init-var-solr
  • This script checks if the the /var/solr directory is writeable and exits if it is not
  • While the script doesn't see the dir as writeable you can create files and subdirectories inside /var/solr manually, so it obviously is writeable
  • This error keeps persisting even when mounting a server directory to the /var/solr folder
  • It also persists when the container is started using root as a user

And after 2 days of researching I just opted for 8.9 as this is working out of the box Changed to 8.9 and resolved by authorizing the volume. Thank you for your help!

nompangyi19 avatar Aug 02 '22 03:08 nompangyi19

I haven't tried with solr 9 yet myself. Maybe its good to use the 8.x version for now. The described error is due to a permission problem. Sometimes there is some fiddling needed when running through docker. But I would need more details... maybe the solr docs are helpful here, too.

Changed to 8.9 and resolved by authorizing the volume. Thank you for your help!

nompangyi19 avatar Aug 02 '22 03:08 nompangyi19

If you use docker, you should bind mount the solr directory to a specific location and set the owner and group ID to 8983 for that directory

  solr:
    image: solr:9
    container_name: docspell-solr
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
    volumes:
      - ./docspell_docker_data_solr:/var/solr

run (once):

mkdir ./docspell_docker_data_solr # optional
chown 8983:8983 ./docspell_docker_data_solr # needed by solr

Snify89 avatar Aug 02 '22 11:08 Snify89

Can someone (@Snify89 :)) confirm/invalidate that solr 9 is working? If so I would close this one?

eikek avatar Aug 02 '22 16:08 eikek

Can someone (@Snify89 :)) confirm/invalidate that solr 9 is working? If so I would close this one?

Thanks! Solr9 works fine, too!

nompangyi19 avatar Aug 03 '22 00:08 nompangyi19

Solr9 works fine (afaik) if used with docker managed volumes. If you use bind mount to a specific location, you need to set the UID/GID to 8983. https://stackoverflow.com/questions/63993993/docker-persisted-volum-has-no-permissions-apache-solr

@eikek You may close.

Snify89 avatar Aug 03 '22 07:08 Snify89

Solr9 works fine (afaik) if used with docker managed volumes. If you use bind mount to a specific location, you need to set the UID/GID to 8983. https://stackoverflow.com/questions/63993993/docker-persisted-volum-has-no-permissions-apache-solr

@eikek You may close.

Actually it does not work for me no matter if I used managed volumes, or mounted volumes with the set permissions. As mentioned in a previous comment I am in fact able to write to the /var/solr directory if I open a shell inside the container. It is solr that thinks that the directory is not writeable. However it seems to be a specific problem cause for me it does not work on one system but it does on another. solr 8.9 works on every system for me (managed or mounted volumes)

lohningerthomas avatar Aug 03 '22 07:08 lohningerthomas

  • While the script doesn't see the dir as writeable you can create files and subdirectories inside /var/solr manually, so it obviously is writeable

When you open the shell in the solr container, are you logged in as root and be able to write to /var/solr or are you the solr user (8983)? Also, you may have issues if you use incompatible file systems for that volume/bind mount.

Snify89 avatar Aug 04 '22 06:08 Snify89

I'm also having this problem with Solr9. My bind mount has user:group = 8983:8983, and I set permissions to 777. I'm also running docker as root. My docker-compose.yml: version: '3.1' services: solr: image: solr ports: - "8983:8983" volumes: - ./solr/core/:/opt/solr/server/solr/markdown/ - ./solr/libs/:/opt/solr/server/solr-cell/ - ./var/solr:/var/solr

Solr seems to thinks that /var/solr is owned by solr:solr:

docker-compose up Creating solr-tika_solr_1 ... done Attaching to solr-tika_solr_1 solr_1 | Cannot write to /var/solr as 8983:8983 solr_1 | drwxrwxrwx 2 solr solr 4096 Aug 4 18:01 /var/solr solr-tika_solr_1 exited with code 1

Also I'm using ext4 filesystem on Debian 10 Version 8.9 works fine. It also works fine if I use the Solr9 docker image by bitnami

eriam234 avatar Aug 04 '22 18:08 eriam234

Hi @eriam234, your logs say something about solr-ika_solr? Where does this come from - it's not mentioned (the tika) in your compose file? Your volume mounts look a bit strange to me: what do you mount into sorl/markdown and solr-cell?

I just tried here on my laptop and solr9 works fine for me. I have used managed volumes and some local directory mounted into the container (required to set owner and group to 8983 - as indicated by the error message). For people having problems with solr9, I would suggest trying with a dedicated compose file in a new directory only with solr and play around with it a bit. Maybe some small bits changed in the image, solr has documentation about their docker images here - maybe this helps as well.

eikek avatar Aug 14 '22 10:08 eikek

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. This only applies to 'question' issues. Always feel free to reopen or create new issues. Thank you!

stale[bot] avatar Sep 16 '22 00:09 stale[bot]