windows errors in daily use

Error1

  • Steps to reproduce the error:

    1
    2
    $ cp winpty.exe /usr/bin
    cp: cannot create regular file '/usr/bin/winpty.exe': Permission denied
    1
    2
    $ sudo cp winpty.exe /usr/bin
    bash: sudo: command not found
    1
    2
    $ whoami
    eshibij

    As above I have already been a root user (no need to run with sudo), so the only answer for this error is that the destination directory /usr/bin does not exists. Check:

    1
    2
    PS C:\Users\eshibij\Downloads\winpty-0.4.3-cygwin-2.8.0-x64\bin> cd /usr/bin
    cd : Cannot find path 'C:\usr\bin' because it does not exist.
  • Solution: give up coping this file.

Error2

  • Steps to reproduce the error:

    1
    2
    $ kubectl exec -it <pod> bash
    Unable to use a TTY - input is not a terminal or the right kind of file
  • Solution:
    download winpyt.exe file from https://github.com/rprichard/winpty/releases and do the copy it to /usr/bin

    Note: do not use winpty-0.4.3-cygwin-2.8.0-ia32.tar.gz as the above link provided, cuz it will cause new issues missing ddl: C:/Program Files/Git/usr/bin/winpty.exe: error while loading shared libraries: cygwin1.dll: cannot open shared object file: No such file or directory.
    Using the other version winpty-0.4.3-msys2-2.7.0-x64.tar.gz

    After install winpty, you can use winpty kubectl exec -it <pod> -c <container> sh to access containers inside pods.