Error: wsl.exe exited with code 4294967295 on Installing Rancher Desktop - kubernetes

I am getting the below error when installing the latest stable Rancher Desktop in my Virtual Machine.
Could someone please help?
Error:
Error: wsl.exe exited with code 4294967295
Command:
wsl --distribution rancher-desktop --exec mkdir -p /mnt/wsl/rancher-desktop/run/data
Logs:
2022-02-02T09:58:39.490Z: Running command wsl --distribution
rancher-desktop --exec wslpath -a -u
C:\Users\VIVEK~1.NUN\AppData\Local\Temp\rd-distro-gGd3SG\distro.tar...
2022-02-02T09:58:40.641Z: Running command wsl --distribution
rancher-desktop --exec tar -cf
/mnt/c/Users/VIVEK~1.NUN/AppData/Local/Temp/rd-distro-gGd3SG/distro.tar
-C / /bin/busybox /bin/mount /bin/sh /lib /etc/wsl.conf /etc/passwd /etc/rancher /var/lib... 2022-02-02T09:58:42.628Z: Running command wsl
--import rancher-desktop-data C:\Users\Vivek.Nuna\AppData\Local\rancher-desktop\distro-data
C:\Users\VIVEK~1.NUN\AppData\Local\Temp\rd-distro-gGd3SG\distro.tar
--version 2... 2022-02-02T09:58:44.025Z: Running command wsl --distribution rancher-desktop-data --exec /bin/busybox [ ! -d /etc/rancher ]... 2022-02-02T09:58:44.025Z: Running command wsl
--distribution rancher-desktop-data --exec /bin/busybox [ ! -d /var/lib ]... 2022-02-02T10:03:54.533Z: Running command wsl
--terminate rancher-desktop... 2022-02-02T10:03:54.534Z: Running command wsl --terminate rancher-desktop-data...
2022-02-02T10:03:54.971Z: Running command wsl --distribution
rancher-desktop --exec mkdir -p /mnt/wsl/rancher-desktop/run/data...
2022-02-02T10:04:03.418Z: WSL: executing: mkdir -p
/mnt/wsl/rancher-desktop/run/data: Error: wsl.exe exited with code
4294967295

I met the same issue in Windows 10.
Below solution helped me:
1. Quit Rancher Desktop
2. Run below command in Windows command line:
wsl --update
3. After update completed, open Rancher Desktop again.
Rancher Desktop works well now.
After completed installing Rancher desktop, you can use the docker and kubectl commands in Windows command line successfully.
References:
Error: wsl.exe exited with code 4294967295 #1328 - github

I resolved the issue by following steps 4 and 5 here:
https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
I found this answer by looking in %USERPROFILE%\AppData\Local\rancher-desktop\logs\wsl-exec.log which revealed:
"WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel"

Right click Rancher Desktop Icon in Task bar, And Select "Quit Rancher Desktop"
Done below in cmd.exe or powershell
> wsl --unregister rancher-desktop
> wsl --unregister rancher-desktop-data

In my case :
1.The Virtualization in BIOS was not enabled
2.You can check yours in Task manager > Performance Tab > CPU Section
Task Manager Picture
Once i enabled from BIOS it started working.

Related

VSCode Remote SSH Extension + tmux = -bash: __vsc_prompt_cmd_original: command not found

Maybe about a week or so ago I noticed a weird problem when I use the Remote SSH Extension with tmux. After opening a terminal and starting tmux the following is printed to the console after every command:
-bash: __vsc_prompt_cmd_original: command not found
If I check the Log (Remote Pty Host) section of the Output tab I see the following:
[2022-08-19 14:48:23.822] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q --header='Metadata:true' -O - http://169.254.169.254/metadata/instance?api-version=2019-03-11\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s --header='Metadata:true' http://169.254.169.254/metadata/instance?api-version=2019-03-11\n\tfi\nfi\nexit 0"]
[2022-08-19 14:48:23.890] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q -O - http://169.254.169.254/latest/meta-data/instance-id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s http://169.254.169.254/latest/meta-data/instance-id\n\tfi\nfi\nexit 0"]
[2022-08-19 14:48:23.896] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q -O - http://169.254.169.254/metadata/v1/id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s http://169.254.169.254/metadata/v1/id\n\tfi\nfi\nexit 0"]
[2022-08-19 14:48:23.900] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/sh" and args ["-c","wget --version > /dev/null\nif [ $? -eq 0 ]\nthen\n\twget --connect-timeout=7 --tries=1 --dns-timeout=7 -q --header='Metadata-Flavor:Google' -O - http://metadata.google.internal/computeMetadata/v1/instance/id\nelse\n\tcurl --version > /dev/null\n\tif [ $? -eq 0 ]\n\tthen\n\t\tcurl --connect-timeout 7 -s --header='Metadata-Flavor:Google' http://metadata.google.internal/computeMetadata/v1/instance/id\n\tfi\nfi\nexit 0"]
[2022-08-19 14:52:08.838] [ptyhost] [warning] Shell integration cannot be enabled for executable "/bin/tmux" and args undefined
The last line seems concerning, and if I use the Remote SSH extension for a different host (where tmux works) that line does not appear (leading me to believe the behavior is potentially connected).
Both remote hosts have terminal integration enabled (and disabling terminal integration doesn't seem to do anything). Looking in the settings for VSCode terminal integration, I noticed that tmux is not listed as a supported shell for terminal integration (only bash, pwsh, and zsh are). I also see a warning that a complex bash PROMPT_COMMAND might also break things (and I have edited my PS1 to print the github branch I'm on, though that works on the other remote host just fine). The link in the settings (which I've reproduced here) is busted, there's no #_complex-bash-promptcommand anchor on that page so that might be a red herring anyway.
Any thoughts? Should I submit a VSCode issue? Am I totally lost here?
You can test the following method.
Using an editor such as nano or vim, Add the line
unset PROMPT_COMMAND
to your .bashrc file, and it will take effect on the next session.
To apply the change immediately for the life of the current shell session, type
unset PROMPT_COMMAND
in your terminal window.

WSL PowerShell always returns Processing fstab with mount -a failed

I've installed WSL for my Windows 11 distribution and also Ubuntu 20.04. I saw that many people say that I can use commands without opening a distro with the wsl command.
Somehow that does not work for me. As soon as I type in a command with wsl the result is:
Processing fstab with mount -a failed.
So for example: wsl rsync -r -v /mnt/d/DUMMY_SOURCE/ /mnt/e/DUMMY_DESTINATION
The only wsl command that really works is wsl -l -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
docker-desktop Stopped 2
Ubuntu-20.04 Stopped 2
What is wrong with my setup?
As I posted this question here I was already recognizing this star before the docker-desktop-data distro. And that is where the problem comes from.
The star here signalizes that this one is the standard distro which is wrong of course. You need to check with wsl -l --all which one is the current default distro. For me it was:
Windows Subsystem für Linux-Distributionen:
docker-desktop-data (Standard)
docker-desktop
Ubuntu-20.04
After that change it to the right one (for me Ubuntu):
wsl --setdefault Ubuntu-20.04
Now the commands work as they should!

cannot connect to "workspaceMount" at container launch from vscode

using vscode and wsl2, I have tried to launch a container using the default method and no customization. This generated the same error as below.
so following vscode docs I set a "workspaceMount" in devcontainer.json
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/myRepo,type=bind,consistency=delegated",
"workspaceFolder": "/workspaces",
I select Reopen in container, the launch sequence happens but an error is generated
a mount config is invalid, make sure it has the right format and a source folder that exists on the machine where the Docker daemon is running
the log error is
Command failed: docker run -a STDOUT -a STDERR --mount source=d:\git\myRepo,target=/workspaces/myRepo,type=bind,consistency=delegated --mount type=volume,src=vscode,dst=/vscode -l vsch.quality=stable -l vsch.remote.devPort=0 -l vsch.local.folder=d:\git\myRepo --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --entrypoint /bin/sh vsc-myRepo-a878aa9edbcf04f717c76e764dabcde6 -c echo Container started ; trap "exit 0" 15; while sleep 1 & wait $!; do :; done
by launching the container from docker desktop I can confirm
cd /workspaces
ls -l
drwxr-xr-x 2 root root 4096 Dec 3 11:48 myRepo
Is this issue due to owner root:root ?
Should this be changed by chown in the Dokerfile? if so could you provide a sample code to do this, is it by RUN chown ...?
I guess you followed the documentation in https://code.visualstudio.com/docs/remote/containers-advanced
The source should contains the subfolder "myRepo" and the target only "workspaces"
"workspaceMount": "source=${localWorkspaceFolder}/myRepo,target=/workspaces,type=bind,consistency=delegated",
"workspaceFolder": "/workspaces",

docker exec -it returns "cannot enable tty mode on non tty input"

docker exec -it command returns following error "cannot enable tty mode on non tty input"
level="fatal" msg="cannot enable tty mode on non tty input"
I am running docker(1.4.1) on centos box 6.6.
I am trying to execute the following command
docker exec -it containerName /bin/bash
but I am getting following error
level="fatal" msg="cannot enable tty mode on non tty input"
Running docker exec -i instead of docker exec -it fixed my issue. Indeed, my script was launched by CRONTAB which isn't a terminal.
As a reminder:
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Run a command in a running container
-i, --interactive=false Keep STDIN open even if not attached
-t, --tty=false Allocate a pseudo-TTY
If you're getting this error in windows docker client then you may need to use the run command as below
$ winpty docker run -it ubuntu /bin/bash
just use "-i"
docker exec -i [your-ps] [command]
If you're on Windows and using docker-machine and you're using GIT Bash or Cygwin, to "get inside" a running container you'll need to do the following:
docker-machine ssh default to ssh into the virtual machine (Virtualbox most likely)
docker exec -it <container> bash to get into the container.
EDIT:
I've recently discovered that if you use Windows PowerShell you can docker exec directly into the container, with Cygwin or Git Bash you can use winpty docker exec -it <container> bash and skip the docker-machine ssh step above.
I get "cannot enable tty mode on non tty input" for the following command on windows with boot2docker
docker exec -it <containerIdOrName> bash
Below command fixed the problem
winpty docker exec -it <containerIdOrName> bash
docker exec runs a new command in an already-running container. It is not the way to start a new container -- use docker run for that.
That may be the cause for the "non tty input" error. Or it could be where you are running docker. Is it a true terminal? That is, is a full tty session available? You might want to check if you are in an interactive session with
[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'
from https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch
I encountered this same error message in Windows 7 64bit using Mintty shipped with Git for Windows.
$docker run -i -t ubuntu /bin/bash
cannot enable tty mode on non tty input
I tried to prefix the above command with winpty as other answers suggested but running it showed me another error message below:
$ winpty docker run -i -t ubuntu /bin/bash
exec: "D:\\Git\\usr\\bin\\bash": executable file not found in $PATH
docker: Error response from daemon: Container command not found or does not exist..
Then I happened to run the following command which gave me what I want:
$ winpty docker run -i -t ubuntu bash
root#512997713d49:/# ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
root#512997713d49:/#
I'm running docker exec -it under jenkins jobs and getting error 'cannot enable tty mode on non tty input'. No output to docker exec command is returned. My job login sequence was:
jenkins shell -> ssh user#<testdriver> -> ssh root#<sut> -> su - <user> -> docker exec -it <container>
I made a change to use -T flag in the initial ssh from jenkins. "-T - Disable pseudo-terminal allocation". And use -i flag with docker exec instead of -it. "-i - interactive. -t - allocate pseudo tty.". This seems to have solved my problem.
jenkins shell -> ssh -T user#<testdriver> -> ssh root#<sut> -> su - <user> -> docker exec -i <container>
Behaviour kindof matches this docker exec tty bug: https://github.com/docker/docker/issues/8755. Workaround on that docker bug discussion suggests using this:
docker exec -it <CONTAINER> script -qc <COMMAND>
Using that workaround didn't solve my problem. It is interesting though. Try these using different flags and under different ssh invocations, you can see 'not a tty' even with using -t with docker exec:
$ docker exec -it <CONTAINER> script -qc 'tty'
/dev/pts/0
$ docker exec -it <CONTAINER> 'tty'
not a tty
$ docker exec -it <CONTAINER> bash -c 'tty'
not a tty

Automation of Cygwin configuration with PowerShell

I have installed Cygwin using PowerShell scripting.
I am doing the following step manually:
Running a new cygwin bash shell (after the edit of cygwin.bat) and enter:
mount --change-cygdrive-prefix /
chmod +r /etc/passwd /etc/group
chmod 755 /var
Start Cygwin bash shell and run ssh-host-config. Answer yes to all the key generation questions.
Is it possible to automate these things in PowerShell scripts, like installing Cygwin, then doing steps 1 and 2 in a single shot?
Use this command:
bash.exe ssh-host-config --yes -u "Cygwinuser" -c "binmode ntsec tty" -w "pwd#123"
cygrunsrv -S sshd
Later go to services.msc to check if the service is running or not