Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix User UID Conflict by Creating rsk User with UID 1000
Description
This PR fixes a problem where there was a UID conflict between files created by containers running with UID 1000 (like those created with the ARROWHEAD-6.3.0 image) and the new user created with UID 1001 in the updated image (ARROWHEAD-6.5.0). The issue happened when trying to access or modify files that were created by older versions of the container. Since the Dockerfile originally created the
rsk
user with a conflicting UID, any files created by the old container would have the wrong ownership, causing permission issues when a new container with a different UID tried to access them.To resolve this, I modified the
useradd
command to explicitly set thersk
user’s UID to 1000, which matches the UID used in the previous image. This ensures consistent file ownership across container versions and prevents the permission issuesHow I Tested the Fix:
Create a Boton Instance: I created a Boton instance to simulate the environment using the following command:
create mainnet commit fix/docker_rsk_permission_issue db reset duration 2 day
Stop the RSK Service: I stopped the existing RSK service with:
sudo systemctl stop rsk
Install Docker: I followed the Docker Install Guide for Ubuntu to install Docker on the system.
Start Docker:
sudo systemctl start docker
Build the Docker Image: In the
rskj
directory, I built the Docker image using the following commandscd rskj
sudo docker build -t testing-image .
Set Up DB Directory:
mkdir -p tmp/rskj-docker-repro
cd tmp/rskj-docker-repro
mkdir db
Run RSKJ with Newer Image (Before Fix): After building the new image with the fix, I tested it by running:
sudo docker run -it --rm -v ./db:/var/lib/rsk/.rsk rsksmart/rskj:ARROWHEAD-6.5.0
. This resulted in the following error when trying to create new files due to UID conflict after the upgrade to version 6.4.0 or later (which runs with UID 1001):2024-12-06-15:33:00.0579 ERROR [db] [main] While mkdir if missing: /var/lib/rsk/database/mainnet/unitrie: Permission denied org.rocksdb.RocksDBException: While mkdir if missing: /var/lib/rsk/database/mainnet/unitrie: Permission denied at org.rocksdb.RocksDB.open(Native Method) at org.rocksdb.RocksDB.open(RocksDB.java:252)
sudo docker run -it --rm -v ./db:/var/lib/rsk/.rsk testing
. The container started successfully, and no permission errors occurred.Types of changes
Checklist: