bug: Need to update path twice to `PATH` environment variable for root to correctly find the executable file
oubotong opened this issue · 1 comments
oubotong commented
Description
When adding one path to PATH
environment variable using updateEnvPath
interface only one time, the root still can not find the corresponding executable binary.
For example, when we add the julia binary path /opt/julia/bin
:
DEBU[2023-01-11T20:18:15-05:00] setting image config: {"architecture":"amd64","os":"linux","config":{"User":"envd","ExposedPorts":{"2222/tcp":{}},"Env":
["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","JULIA_DEPOT_PATH=/opt/julia/user_packages","USER=envd","SHELL=/usr/bin/bash","ENVD_WORKDIR=/home/envd/envd-quick-
start","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/julia/bin","LC_ALL=en_US.UTF-8","LANG=C.UTF-8"],"Entrypoint":["horust"],"WorkingDir":"/","Labels":{"ai.tensorchord.envd.apt.packages":"
[]","ai.tensorchord.envd.build.context":"/home/bou/envd-quick-start","ai.tensorchord.envd.build.digest":"506b28357bdd473307683f3379848e84","ai.tensorchord.envd.container.name":"envd-quick-start","ai.tensorchord.envd.ports":"[{\"name\":\"ssh\",\"port\":2222}]","ai.tensorchord.envd.pypi.commands":"
[]","ai.tensorchord.envd.r.packages":"[]","ai.tensorchord.envd.repo":"{}","ai.tensorchord.envd.runtimeGraph":"{\"environ\":{\"JULIA_DEPOT_PATH\":\"/opt/julia/user_packages\",\"PATH\":\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\"SHELL\":\"/usr/bin/bash\",\"USER\":\"envd\"},\"env_paths\":
[\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\"/opt/julia/bin\"]}","ai.tensorchord.envd.vendor":"envd"}},"rootfs":{"type":"layers","diff_ids":null}} language-version=v1 tag="envd-quick-start:dev"
It's clearly already in the path variable as shown above. However, the root still can not find julia
binary:
#23 [internal] installing Julia pacakges: Example Random
#23 0.229 container_linux.go:380: starting container process caused: exec: "julia": executable file not found in $PATH
DEBU[2023-01-11T20:18:16-05:00] stopping session
ERRO[2023-01-11T20:18:16-05:00] Buildkit error: failed to solve: process "julia -e using Pkg; Pkg.add([\"Example\",\"Random\"])" did not complete successfully: exit code: 1
However, after using updateEnvPath
the second time and add the path twice, the root is able to find the binary file which is very weird.
Reproduction
To reproduce it, simply comment out the line root = g.updateEnvPath(root, juliaBinDir)
in file julia.go
and use the following build file:
def build():
base(dev=True)
install.julia()
install.julia_packages(names=["Example"])
Message from the maintainers:
Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.