Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chroot: cannot change root directory to '/': Operation not permitted #92

Closed
wuxiaohua1011 opened this issue Jul 30, 2020 · 6 comments
Closed
Assignees

Comments

@wuxiaohua1011
Copy link

Hi,
I've been trying to run this new updated version. However, I encountering the issue of
chroot: cannot change root directory to '/': Operation not permitted

Here's a screenshot of what i did:
Screenshot from 2020-07-30 13-11-05

I am wondering how should i go about solving this issue?

Thanks!

@wuxiaohua1011
Copy link
Author

Actually, I looked into this issue a bit, and it seems like this stack overflow says that you actually cannot start a docker at the root directory or something like that
https://stackoverflow.com/questions/40636618/how-to-start-a-chrooted-directory-as-a-docker-container

Which means that the docker file might have a small problem?

@charles-lei
Copy link

charles-lei commented Aug 4, 2020

I have the same problem.

@twada-cats
Copy link

I also have same problem when run.sh is executed. I changed user as root before execution.
$ sudo su
$ ./run.sh
It did not works. Can you tell us how to solve it?

@mrm-mmh
Copy link

mrm-mmh commented Aug 11, 2020

I've been able to find a workaround by adding sudo rights to the user in the run.sh and launching with sudo:

#!/bin/bash

XSOCK=/tmp/.X11-unix
XAUTH=$HOME/.Xauthority

VOLUMES="--volume=$XSOCK:$XSOCK:rw
         --volume=$XAUTH:$XAUTH:rw
         --volume=$(pwd)/autoware-contents:/home/autoware/autoware-contents:ro"

RUNTIME=""
DOCKER_VERSION=$(docker version --format '{{.Client.Version}}' | cut --delimiter=. --fields=1,2)
if [[ $DOCKER_VERSION < "19.03" ]] && ! type nvidia-docker; then
    RUNTIME="--gpus all"
else
    RUNTIME="--runtime=nvidia"
fi

docker run \
    -it --rm \
    $VOLUMES \
    --env="XAUTHORITY=${XAUTH}" \
    --env="DISPLAY=${DISPLAY}" \
    --privileged \
    --net=host \
    --user $(id -u ${USER}):$(id -g ${USER}) \
    --group-add sudo \
    $RUNTIME \
    carla-autoware:latest

sudo ./run.sh

However, I agree with wuxiaohua1011 that the container should be adapted so that sudo is not required.

Hope that helps for now!

@wuxiaohua1011
Copy link
Author

I've been able to find a workaround by adding sudo rights to the user in the run.sh and launching with sudo:

#!/bin/bash

XSOCK=/tmp/.X11-unix
XAUTH=$HOME/.Xauthority

VOLUMES="--volume=$XSOCK:$XSOCK:rw
         --volume=$XAUTH:$XAUTH:rw
         --volume=$(pwd)/autoware-contents:/home/autoware/autoware-contents:ro"

RUNTIME=""
DOCKER_VERSION=$(docker version --format '{{.Client.Version}}' | cut --delimiter=. --fields=1,2)
if [[ $DOCKER_VERSION < "19.03" ]] && ! type nvidia-docker; then
    RUNTIME="--gpus all"
else
    RUNTIME="--runtime=nvidia"
fi

docker run \
    -it --rm \
    $VOLUMES \
    --env="XAUTHORITY=${XAUTH}" \
    --env="DISPLAY=${DISPLAY}" \
    --privileged \
    --net=host \
    --user $(id -u ${USER}):$(id -g ${USER}) \
    --group-add sudo \
    $RUNTIME \
    carla-autoware:latest

sudo ./run.sh

However, I agree with wuxiaohua1011 that the container should be adapted so that sudo is not required.

Hope that helps for now!

Nice, it works great, thank you so much!

@joel-mb
Copy link
Contributor

joel-mb commented Oct 8, 2020

Hi! The issue should be fixed now (#103). Feel free to re-open the issue if needed.

@joel-mb joel-mb closed this as completed Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants