[BUG] V0.6 Packager fails if the user's primary group conflicts with a existing/default group, e.g. 0 for root
MMelQin opened this issue · 0 comments
Note
The issue reported here serves to provide the known workaround, while the bug is being fixed in Holoscan SDK CLI.
See below for the workarounds.
Describe the bug
On running the packager, if the user account's primary group is in conflict with a default/existing group, error would occur and the package build fails, for example, when a user logged on as root and ran the packager, package/container build would fail with the following error in the output log,
#10 [ 4/20] RUN groupadd -g 0 holoscan
#10 0.213 groupadd: GID '0' already exists
#10 ERROR: process "/bin/sh -c groupadd -g $GID $UNAME" did not complete successfully: exit code: 4
------
> [ 4/20] RUN groupadd -g 0 holoscan:
#10 0.213 groupadd: GID '0' already exists
------
Dockerfile:48
--------------------
46 |
47 |
48 | >>> RUN groupadd -g $GID $UNAME
49 | RUN useradd -rm -d /home/$UNAME -s /bin/bash -g $GID -G sudo -u $UID $UNAME
50 | RUN chown -R holoscan /var/holoscan
--------------------
ERROR: failed to solve: process "/bin/sh -c groupadd -g $GID $UNAME" did not complete successfully: exit code: 4
[2023-09-29 10:21:16,112] [INFO] (packager) - Build Summary:
Platform: x64-workstation/dgpu
Status: Failure
Error: Error building image: see Docker output for additional details.
Steps/Code to reproduce bug
Log on as root user and run a package command, or, simulate the effort with
monai-deploy package simple_imaging_app -c simple_imaging_app/app.yaml -t simple_imaging_app:1.0 --platform x64-workstation -l DEBUG --gid 0
Expected behavior
The packager should detect existing conflict group before try to add the new name group with the same group ID, or it should have used the -f
option on groupadd
to ignore the -g
option when conflict happens, i.e.
Environment details (please complete the following information)
- OS/Platform: Ubuntu 20.04 LTS
- Python Version: 3.8.10
- Method of MONAI Deploy App SDK install: [pip, from source]
- SDK Version: 0.6.0
Workaround
If you encounter the error as reported in this issue, use Workaround 1 below, and for a more general fix by patching of the Holoscan SDK in the local env, apply Workaround 2.
-
Supply the group ID on the command line with the
--gid
option to force a non-existent group ID, e.g.
monai-deploy package simple_imaging_app -c simple_imaging_app/app.yaml -t simple_imaging_app:1.0 --platform x64-workstation -l DEBUG --gid 1000
-
This one requires modifying the Dockerfile template that the Packager uses.
- In the logon user’s (virtual) environment, locate the Python distributions and then the Docker template file in holoscan package, e.g.,
.venv/lib/python3.8/site-packages/holoscan/cli/packager/templates/Dockerfile.jinja2
- Open this file to edit, and on line 103, add the -f option, i.e.,
RUN groupadd -f -g $GID $UNAME
- Save the file and run Packager as usual
Additional context
Bug logged with Holoscan SDK.
Workarounds tested in dev env, and had been confirmed working in a user's env.