error: could not lock config file /var/gerrit/etc/gerrit.config: Permission denied

150 views
Skip to first unread message

Sumit Singh

unread,
Apr 15, 2025, 6:36:51 AM4/15/25
to Repo and Gerrit Discussion
Hi, 

We have Gerrit version 3.9.4 using Ubuntu 22.04 and we want to use Ubuntu 24.04, when we use Gerrit image with 24.04, it start failing with below error. Though we haven't changed any file/directory permission in image and on VM. 

error: could not lock config file /var/gerrit/etc/gerrit.config: Permission denied
error: could not lock config file /var/gerrit/etc/gerrit.config: Permission denied
error: could not lock config file /var/gerrit/etc/gerrit.config: Permission denied

As per https://gerrit.googlesource.com/docker-gerrit/+/refs/heads/master/ubuntu/24/Dockerfile , ubuntu 24.04 start with Gerrit version 3.11. Does this have any relation with error ? 

Please suggest and comment. 




Luca Milanesio

unread,
Apr 15, 2025, 5:43:16 PM4/15/25
to Repo and Gerrit Discussion, Luca Milanesio
I believe you’re mounting the gerrit.config externally and the Gerrit’s user has no permissions on it.
Please review your mounting and the ownership of those mounted files.

HTH

Luca.


Please suggest and comment. 





--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/da022c04-3bea-4162-a5b8-b7f80fcf4e8en%40googlegroups.com.

Sumit Singh

unread,
Apr 16, 2025, 6:37:35 AM4/16/25
to Repo and Gerrit Discussion
Hi Luca,

Thank you for the looking into this issue and response. 

Obviously it is volume ownership issue but my interest is - How gerrit container runs with same ownership when running with old image ubuntu 22.04 and start complaining permission issue when running with ubuntu 24.04 ? Gerrit version 3.9.4 is same in both cases. 

In our current set up, gerrit's volume ownership on host/vm is "devuser" but inside container it is "gerrit" user and it's working with 22.04 image.

Below docker-compose file and volume is mounted on host VM.

---
services:
  gerrit:
    image: "privaterepo.domain.io/image/gerrit_ubuntu_24:3.9.4"  # Not working
    image: "privaterepo.domain.io/image/gerrit_ubuntu_22:3.9.4"  # Working  
    restart: unless-stopped
    ports:
      - 8081:8081
      - 29418:29418
    volumes:
      - "/data/gerrit/git:/var/gerrit/git"
      - "/data/gerrit/index:/var/gerrit/index"
      - "/data/cache/gerrit:/var/gerrit/cache"
      - "/data/gerrit/db:/var/gerrit/db"
      - "/data/gerrit/etc:/var/gerrit/etc"
      - "/data/log/gerrit:/var/gerrit/logs"
      - "/data/gerrit/data:/var/gerrit/data"
      - "/data/gerrit/ssh:/var/gerrit/.ssh"
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
    environment:
      - CANONICAL_WEB_URL=https://gerrit.domain.net/
---
This is how ownership on host and inside container        
(devuser) /data/gerrit/etc:/var/gerrit/etc (gerrit)  >> gerrit.config file is here

If changed the volume ownership "gerrit" user on vm also, container is up with new image ubuntu24.04.

My question is - How different ownership on host and container works with ubuntu 22.04 but not with 24.04 ?

Is this ownership requirement enforced in ubuntu 24.04 ? Or it was since beginning and somehow it has been working in our setup.

Please ask if you need more information for investigation.

BR
Sumit

Luca Milanesio

unread,
Apr 16, 2025, 7:13:27 AM4/16/25
to Repo and Gerrit Discussion, Luca Milanesio

On 16 Apr 2025, at 11:28, Sumit Singh <sumit...@gmail.com> wrote:

Hi Luca,

Thank you for the looking into this issue and response. 

Obviously it is volume ownership issue but my interest is - How gerrit container runs with same ownership when running with old image ubuntu 22.04 and start complaining permission issue when running with ubuntu 24.04 ? Gerrit version 3.9.4 is same in both cases. 

It’s an Ubuntu 24.04 issue, as it is the only thing that’s different.
This has been discussed already at [1].

HTH

Luca.


Finn Ashford

unread,
Apr 16, 2025, 8:07:36 AM4/16/25
to Repo and Gerrit Discussion
In the Ubuntu24 Gerrit image, the gerrit user is created with UID 1001 rather than the default 1000, which might lead to permission-related problems.

docker run -it -d gerritcodereview/gerrit:3.11.1-ubuntu24
docker exec -it priceless_driscoll bash
bash-5.1:$ id
uid=1001(gerrit) gid=1001(gerrit) groups=1001(gerrit)

If you don't have a strict requirement to use the Ubuntu24 image, you could try using gerritcodereview/gerrit:3.11.1 (which is based on AlmaLinux). In that image, the gerrit user retains UID 1000, maintaining compatibility with expected permission settings:

docker run -it -d gerritcodereview/gerrit:3.11.1
docker exec -it wizardly_lewin bash
bash-5.1$ id
uid=1000(gerrit) gid=1000(gerrit) groups=1000(gerrit)


- Finn
 

Sumit Singh

unread,
Apr 16, 2025, 9:28:08 AM4/16/25
to Repo and Gerrit Discussion
Thank you so much @Luca Milanesio and @Finn Ashford for your quick support and explained the permission UID change in ubuntu 24.04

This is what I was looking for and now I have the answer. 

I'm happy with support and solution I received here :) . If you have any label, please mark this case as resolved. 

BR
Sumit

Reply all
Reply to author
Forward
0 new messages