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

Terminal behaves strange with --x11 option #152

Open
AndreasAZiegler opened this issue Jun 17, 2021 · 3 comments
Open

Terminal behaves strange with --x11 option #152

AndreasAZiegler opened this issue Jun 17, 2021 · 3 comments

Comments

@AndreasAZiegler
Copy link

When I start rocker with the --x11 option, I observe the following unexpected behavior:

  • When I press the backspace key, blanks are added instead of the text removed
  • When I press the arrow to the left, nothing happens
  • When I press the arrow to the right, nothing happens
  • When I press the left arrow and afterwards the right arrow, I get ziegler@c729.......:/$ aziegler@c7s9.....:/$ a where a is the key I pressed before the left arrow key
@tfoote
Copy link
Collaborator

tfoote commented Aug 4, 2021

I can't reproduce any of these issues testing rocker --x11 ubuntu The X11 plugin only adds some extra runtime mounting devices. Are you running an X based terminal on top?

Please provide the full set of commands that you're running to produce this problem. And possibly a recording of the behavior. Also any information about your keyboard setup.

@AndreasAZiegler
Copy link
Author

AndreasAZiegler commented Aug 5, 2021

Thanks @tfoote for investigating this issue.

My problem comes from the fact that TERM is not set. The problem is now, that if I set TERM with

rocker --nvidia --x11 --user --home --privileged --env TERM=xterm --volume /dev/bus/usb:/dev/bus/usb --volume
/data:/data -- prophesee-ros

this results in

docker run --rm -it -e TERM=xterm -v /home/ziegler:/home/ziegler   --gpus all --privileged -v /dev/bus/usb:/dev/bus/usb -v /data:/data  -e DISPLAY -e TERM   -e QT_X11_NO_MITSHM=1   -e XAUTHORITY=/tmp/.docker4k4p15ro.xauth -v /tmp/.docker4k4p15ro.xauth:/tmp/.docker4k4p15ro.xauth   -v /tmp/.X11-unix:/tmp/.X11-unix   -v /etc/localtime:/etc/localtime:ro  5ba210881fbd

and therefore, TERM is not set as it is overwritten. My workaround is to set TERM manually with export TERM=xterm, but this is obviously annoying. Is there a way to set TERM without having it overwritten?

@tfoote
Copy link
Collaborator

tfoote commented Aug 10, 2021

Currently there's not. When injecting the argument here:

return " -e DISPLAY -e TERM \
it would need to be able to check for other environment variables set and only set it if unset.

There's a possibilty that you could use parameter substitutions: https://unix.stackexchange.com/a/122848/83370

However looking back at it, the x11 is passing through your host TERM settings. So the trivial solution is to prepend TERM=xterm to your command like this. Or set your TERM variable in your environment.

TERM=xterm rocker --nvidia --x11 --user --home --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /data:/data -- prophesee-ros

Example adding TERM at the beginning passing through.
$ TERM=xterm rocker  --x11 -- ubuntu bash
Extension volume doesn't support default arguments. Please extend it.
Active extensions ['x11']
Writing dockerfile to /tmp/tmpsf0rjxn9/Dockerfile
vvvvvv
# Preamble from extension [x11]


FROM ubuntu
USER root
# Snippet from extension [x11]


^^^^^^
Building docker file with arguments:  {'path': '/tmp/tmpsf0rjxn9', 'rm': True, 'nocache': False, 'pull': False}
building > Step 1/2 : FROM ubuntu
building >  ---> 1318b700e415
building > Step 2/2 : USER root
building >  ---> Using cache
building >  ---> 5da8b17d3e78
building > Successfully built 5da8b17d3e78
Executing command: 
docker run --rm -it  -e DISPLAY -e TERM   -e QT_X11_NO_MITSHM=1   -e XAUTHORITY=/tmp/.dockersuqlq__h.xauth -v /tmp/.dockersuqlq__h.xauth:/tmp/.dockersuqlq__h.xauth   -v /tmp/.X11-unix:/tmp/.X11-unix   -v /etc/localtime:/etc/localtime:ro  5da8b17d3e78 bash
root@79d0b45173a2:/# env | grep TERM
TERM=xterm
root@79d0b45173a2:/# exit
tfoote@snowman5:~ Last: [0] (13s Seconds)
$ TERM=foo rocker  --x11 -- ubuntu bash
Extension volume doesn't support default arguments. Please extend it.
Active extensions ['x11']
Writing dockerfile to /tmp/tmpeshhsjed/Dockerfile
vvvvvv
# Preamble from extension [x11]


FROM ubuntu
USER root
# Snippet from extension [x11]


^^^^^^
Building docker file with arguments:  {'path': '/tmp/tmpeshhsjed', 'rm': True, 'nocache': False, 'pull': False}
building > Step 1/2 : FROM ubuntu
building >  ---> 1318b700e415
building > Step 2/2 : USER root
building >  ---> Using cache
building >  ---> 5da8b17d3e78
building > Successfully built 5da8b17d3e78
Executing command: 
docker run --rm -it  -e DISPLAY -e TERM   -e QT_X11_NO_MITSHM=1   -e XAUTHORITY=/tmp/.dockeryq2fx1e6.xauth -v /tmp/.dockeryq2fx1e6.xauth:/tmp/.dockeryq2fx1e6.xauth   -v /tmp/.X11-unix:/tmp/.X11-unix   -v /etc/localtime:/etc/localtime:ro  5da8b17d3e78 bash
root@a1cf74fa2317:/#                                                                                                                                            root@a1cf74fa2317:/# env | grep TERM
TERM=foo

Also #130 might help with this issue too, but putting the user envs later in the evaluation logic.

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

2 participants