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

az container exec: garbage characters inserted at shell prompt #6537

Open
mmacy opened this issue Jun 8, 2018 · 19 comments
Open

az container exec: garbage characters inserted at shell prompt #6537

mmacy opened this issue Jun 8, 2018 · 19 comments
Labels
Container Instances az container Container Service Attention This issue is responsible by Azure service team.

Comments

@mmacy
Copy link
Contributor

mmacy commented Jun 8, 2018

Describe the bug
When exec'ing a shell in an Alpine-based container running in Azure Container Instances, garbage characters are inserted on key press. In the example output below, the ls command is attempted, but [6;5R was inserted when the "l" key was pressed, and the command fails:

$ az container exec -g rg604 -n alpine-test-02 --exec-command "/bin/ash"
/ # [6;5Rls
/bin/ash: [6: not found
/bin/ash: 5Rls: not found
/ # 

To Reproduce

  1. Start Alpine container in ACI:

    $ az container create -g rg604 -n alpine-test-02 --image alpine --command-line "tail -f /dev/null"
  2. Use az container exec to spawn and attach to the ash shell in the container:

    $ az container exec -g rg604 -n alpine-test-02 --exec-command "/bin/ash"
  3. Once inside the container, execute the ls command to list directory contents:

    $ az container exec -g rg604 -n alpine-test-02 --exec-command "/bin/ash"
    / # [6;5Rls
    /bin/ash: [6: not found
    /bin/ash: 5Rls: not found
    / # 

    Note the characters [6;5R were inserted when the "l" key was pressed, causing the ls command to fail.

This above example output was from Bash on Ubuntu 18.04, but this behavior also occurs in the Cloud Shell:

marsh@Azure:~$ az container exec -g rg604 -n alpine-test-02 --exec-command "/bin/ash"
/ # [10;5Rls
/bin/ash: [10: not found
/bin/ash: 5Rls: not found
/ #

Expected behavior
When exec'ed into a container instance, I should be able to enter commands in the terminal without "garbage" characters being inserted on keypress.

Environment summary

  • Install Method : apt on Ubuntu, and the included az on Cloud Shell
  • CLI version: 2.0.34
  • OS: Ubuntu 18.04 and Cloud Shell
  • Shell: bash on Ubuntu and Cloud Shell

Additional context
Exec'ing into a locally run Alpine container does not exhibit this behavior:

$ docker run -d alpine tail -f /dev/null
d375353c5f36d6d1bb799df9d9708d9c2e5ec1bfb39080085948d12c052f3665
$ docker exec -it d375353c5f36 /bin/ash
/ # ls
bin    etc    lib    mnt    root   sbin   sys    usr
dev    home   media  proc   run    srv    tmp    var
/ # 
@tjprescott tjprescott added bug This issue requires a change to an existing behavior in the product in order to be resolved. Container Instances az container labels Jun 11, 2018
@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@jluk
Copy link
Contributor

jluk commented Oct 4, 2018

@tjprescott I don't see this behavior reproduce when we exec into a container with anything besides Azure CLI - it seems like this may be behavior from python/cli? Can you take a look at this or is there any known python output issues?

@patnaikshekhar
Copy link

patnaikshekhar commented Oct 28, 2018

I'm facing the exact same issue with an alpine based container:

`bash

az container exec --name frontend --exec-command /bin/sh
/app # [33;8Rls
/bin/sh: [33: not found
`

@ssaldi
Copy link

ssaldi commented Nov 16, 2018

Mee too, tried from linux and windows 10
But fun fact: in linux, you can delete them by backspace :) Just need to start every command by some backspace.

Pressing backspace also creates some garbage:

[73;29

@ssaldi
Copy link

ssaldi commented Nov 28, 2018

If you use bash in an alpine based container instead of /bin/sh, then there is no garbage :) (from linux)

@rohittidke
Copy link

I am facing the same issue - a lot of garbase, hard to read the terminal

@KEMBL
Copy link

KEMBL commented Dec 20, 2018

try to perform that command after login

env TERM=vt1000 /bin/bash

@mmacy
Copy link
Contributor Author

mmacy commented Dec 20, 2018

@KEMBL Thanks for the tip, however, the Alpine image in its default configuration does not include the Bash shell. The ash and sh shells within the image are provided by busybox, so the cause is likely within how the terminal is handled there.

@brent-robinson
Copy link

I'm experiencing the same issue on an image based on Ubuntu 18.04, specifically mcr.microsoft.com/powershell. The issue occurs for /bin/bash, /bin/sh and /usr/bin/pwsh.

Using the suggested env TERM=vt1000 /bin/bash worked for /bin/bash, but the issue reappeared if I then launched pwsh from it.

@idontsov
Copy link

idontsov commented Aug 12, 2019

I'm experiencing the same issue.

My host is Windows 10:1903 and I'm connecting to a running container built from the mcr.microsoft.com/windows:1809 image.

The console is filled with garbage, command output is almost unreadable.

Update. I've noticed that the Cmder displays output without a garbage. Using it as a workaround.

@jluk jluk assigned dkkapur and unassigned samkreter Aug 12, 2019
@jluk
Copy link
Contributor

jluk commented Aug 12, 2019

@dkkapur can you please take ownership of this issue?

@mbalsam-refind
Copy link

mbalsam-refind commented Aug 17, 2019

Im having the same issues when launching from ubuntu. How come this is taking YEARS to fix?

@dkkapur please look into this!

@mbalsam-refind
Copy link

If you provide a .vimrc containing set nocompatible and use the azure container webgui Connect you can get in there to edit a file. Otherwise the "az container exec" is useless... Why has this taken YEARS to fix. @dkkapur

@SImgrund
Copy link

I'm facing the same error. Is there a fix now?

I connect to the container using
az container exec --name [name] --resource-group [rg_name] --exec-command "/bin/sh"
Every time I press ENTER I've these input in the new line
~ # [54;5R

@mbalsam-refind
Copy link

I just reported this to my azure support account. Ticket number 119091824005018.

@haroldrandom haroldrandom added bug This issue requires a change to an existing behavior in the product in order to be resolved. Service Attention This issue is responsible by Azure service team. Container labels Oct 25, 2019
@gabrielbcn
Copy link

Same is happening to me, container is openjdk:8-jre-alpine3.9 and I get plenty of:

/ # [55;5Rls
sh: [55: not found
sh: 5Rls: not found

Thanks!

@jordotech
Copy link

jordotech commented Jul 17, 2020

Same here as above on windows and osx. The entire experience with az container exec is riddled with bugs and old unresolved issues, please fix!

@maxsatula
Copy link

maxsatula commented Jul 30, 2020

Same problem.
If it contributes to troubleshooting, that seems to be cursor position report sent as ANSI Terminal Control Escape sequence, per docs (googled from multiple places):

Report Cursor Position <ESC>[{ROW};{COLUMN}R

However, I'm not sure how to switch cursor position reporting off yet, is it Azure issue or alpine issue.

@yonzhan yonzhan added the Container Instances az container label Jul 30, 2020
@ghost
Copy link

ghost commented Jul 30, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dkkapur.

@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jul 30, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 30, 2020

container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Container Instances az container Container Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests