Windows commands inside WSL hang a very long time - windows-subsystem-for-linux

wsl --version
WSL version: 0.60.0.0
kernel version: 5.10.102.1
WSLg version: 1.0.34
MSRDC version: 1.2.2924
Direct3D version: 1.601.0
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.160
Distro Version
Ubuntu 20.04.4 LTS
This issue is found when I upgrade my windows to 10.0.22621.160
Reproduce steps:
execute "wsl.exe --version" (a windows command)
--> the console output the result and frozen for dozens of seconds that I can't input next command.
execute "wsl.exe --version | cat" (windows command with pipe)
--> the console output the result and ready for next command normally.
execute "uname -a" (a native linux command)
--> the console output the result and ready for next command normally.
execute "wsl.exe --version > /proc/self/fd/1 (pipe to standard output)
--> same as "wsl.exe --version", the console will frozen dozens of seconds
So I think there must be something wrong with the standard output for windows command running in WSL session.
PS: I've raised a case to microsoft feedback hub and the github.
https://github.com/microsoft/WSL/issues/8544
https://aka.ms/AAhd1ld

Related

WSL after trying all the steps to upgrade to version 2 if get a failure: WslRegisterDistribution failed with error: 0x80370102

Launch any WSL from within VS Code "No WSL distros found. New distros can be installed from the Microsoft Store.
Source Remote - WSL (Extensions)
BUTON: "Add Distro" --> takes you to the store. Install the version of Linux, and try to start it and you get the following. I've had WSL working before and now cannot get it back to the original working WSL.
I tried some things to update to version 2 and I could list version with command "WSL -l -v" it showed up but not anymore. I've got the features set properly. WSL feature is enabled. I did try setting a bios "Virtualization Technology" this is on a HP laptop with AMD 64 bit cpu. That is off now after finding it doesn't help.
Features on: "Virtual Machine Platform", "Windows Hypervisor Platform" "Windows Subsystem for Linux" There are others but these seem relevant.
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.
Press any key to continue...
This had to have the bios setting. Also because of being Windows 10 Home didn't have Hyper V feature, but there is a batch that can add this. There is a msi to install WSL 2 so wsl.exe was upgraded. This got the results to show WSL version 2 for ubuntu-20-04 install Also there was some resets needed to get the "WSL -l -v" command to have running.
I don't know 100% certain that these are the cure to the issue. But may help someone who cannot get the Linux to start w/out various error running on windows subsystem Linux. Took me better part of a day to fix.
find the following by googling "del hyper-v.txt" you will hit a page telling you "How to activate Hyper-V in Windows 10 Home"
source of batch command
https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/915
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause
Reboot, still not running, but needed the following sequence.
wsl --shutdown
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns
wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
initially there was a root user only. Updated new user with the following in %userprofile% folder. Omit the dash and dot.
Ubuntu2004 config --default-user addedUsername
The WSL now is seen by VS Code extensions and no longer flagging to update to version 2. Now on to RxJS tutorial under VS Code.
Make sure all related settings in the bios are enabled.
Make sure all related features in the windows features are turned on.
Alright, if there is an error:
Turn off all related features
Restart it.
Turn on.
Restart it.
related features = ( virtualization )

Qemu 5.2 - nothing shows up after VNC running

i'm trying to use QEMU 5.x for research.
I got QEMU 5.2 source code from qemu.org and installed following instructions.
However, when i tried to run VM by this command:
qemu-system-x86_64 \
-monitor stdio \
--enable-kvm \
-m 4096 \
-cdrom ubuntu-20.04.iso \
-drive file=img.qcow,if=virtio \
-boot c
-rtc base=localtime \
-device virtio-keyboard-pci \
-vga virtio \
then the following texts are printed:
QEMU 5.2.0 monitor - type 'help' for more information
(qemu) VNC server running on 127.0.0.1:5900
then nothing shows up, while QEMU 4.x (used before) pops up a window showing guest ubuntu's GUI.
I'm using ubuntu 20.04. Hope anyone has breakthrough for this..
The message says that this QEMU is using the VNC protocol for graphics output. You can connect a VNC client to the 127.0.0.1:5900 port that it tells you about to see the graphics output.
If what you wanted was a native X11 window (GTK), then the problem is probably that you didn't have the necessary libraries installed to build the GTK support. QEMU's configure script's default behaviour is "build all the optional features that this host has the libraries installed for, and omit the features where the libraries aren't present". So if you don't have any of the GTK/SDL etc libraries when you build QEMU, the only thing you will get in the resulting QEMU binary is the lowest-common-denominator VNC support. If you want configure to report an error for a missing feature then you need to pass it the appropriate --enable-whatever option to force the feature to be enabled (in this case, --enable-gtk).
If you're running on Ubuntu and your apt sources.list file has deb-src lines in it, the easiest way to install all the dependencies that would get you the same feature list as the real Ubuntu QEMU package is to run "apt build-dep qemu". I recommend that you do that and then re-build QEMU, passing --enable-gtk to configure so you can confirm that the necessary dependencies were installed.

Unison fails with "ill-formed message" error, same remote & local versions

I'm trying to get unison working after upgrading to Mac OS X Catalina. Unfortunately, macports installs a more recent version of ocaml (4.08.1), which means that the unison 2.51.2 release won't compile.
Well, that's no problem, I just update to git master on unison, and recompile. Unfortunately, this fails at sync time because the version of ocaml used to compile on the mac (4.08.1) is different from the one used to compile on the other machine (4.07.1). Sigh. Okay, use opam magic to install 4.07.1 on my machine. Everything should be fine, right? No!
Here's the error:
Connected [//zzzmyhost//home/clements/unison-home -> //zzzmyotherhost//Users/clements/clements]
Looking for changes
Uncaught exception Failure("input_value: ill-formed message")
Raised at file "/private/tmp/unison/src/lwt/lwt.ml", line 126, characters 16-23
Called from file "/private/tmp/unison/src/lwt/generic/lwt_unix_impl.ml", line 102, characters 8-23
Called from file "/private/tmp/unison/src/update.ml" (inlined), line 2105, characters 2-69
Called from file "/private/tmp/unison/src/uitext.ml", line 978, characters 16-56
Called from file "/private/tmp/unison/src/uitext.ml", line 1066, characters 6-90
Called from file "/private/tmp/unison/src/uitext.ml", line 1088, characters 19-66
Called from file "/private/tmp/unison/src/uitext.ml", line 1144, characters 21-43
What's going on?
Sigh... the problem here (very non-obvious) is actually with a corrupted/wrong-format syncronization file, created when doing the failed sync in the earlier test.
The solution is just to go into ~/Library/Application Support/Unison (on a UNIX machine this path would presumably live in ~/.unison and delete the archive file that's causing the problem (probably the most recent one). In a pinch, just delete all of the archive files and start over.
I've got the same problem between Windows and Ubuntu 20.04 after upgrading from Ubuntu 18.04. I tried the binary from Ubuntu 18.04 in 20.04, which still fails, so the incompatibility is likely inside one of the dependencies.
As a workaround I created a Docker image based on Ubuntu 18.04:
FROM ubuntu:18.04
RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get install unison -y
RUN useradd martin --home /home/martin
WORKDIR /home/martin
USER martin
Building it with docker build -t unison:18.04 .
And then I added a wrapper to ~/bin/unison-2.48.4-docker:
#!/bin/bash
docker run --rm -i \
-v /home/martin/dirtosync:/home/martin/dirtosync \
-v /home/martin/.unison:/home/martin/.unison \
--hostname $(hostname) \
unison:18.04 unison "$#"
Setting the --hostname is important, since the hostname is part of the archive file.
Inside the profile on my Windows machine I configured:
servercmd = ~/bin/unison-2.48.4-docker
In my setup with two windows clients and one Ubuntu 18.04 server, connected by ssh, the problem startet with a second server running on Ubuntu 20.04. Neither the old server nor the windows clients could sync with the new machine.
My solution: Copying the binary from Ubuntu 18.04 to a new directory in the Ubuntu 20.04 machine. This new file is referenced in the "authorized_keys" file of ssh on the new machine.
So far, everything works great with unison 2.48.4.

Run WSL command in non-interactive mode (Fall Creators Update)

Before Fall Creators Update I could run Ubuntu binaries in one-liner via such command:
%WinDir%\system32\bash.exe -c "echo 123"
But after the update, I can't find how to do the same thing with MarketPlace-installed distro. Is there a way to run such commands in cmd.exe?
Why can't? Bash.exe and wsl.exe always run your default distro.
Change default distro by wslconfig.exe
Or use ubuntu.exe to run Ubuntu, opensuse.exe to run OpenSUSE.
Open
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
to see all your distro launcher.

Can't install SPECjvm2008

Specification:
OS: RHEL6 x86_64
JRE: jre-6u30-linux-x64-rpm.bin - downloaded from oracle java website
SPECJVM2008: downloaded from http://www.spec.org/jvm2008/
To install SPECJVM2008, I run this command:
java -jar SPECjvm2008_1_01_setup.jar
but nothing happens after that, the command line just hangs.
I tried java -verbose -jar SPECjvm2008_1_01_setup.jar, and found out that it stops at:
....
[Loaded com.zerog.ia.installer.actions.InstallUninstaller from file:/root/specjvm/SPECjvm2008_1_01_setup.jar]
[Loaded ZeroGbq from file:/root/specjvm/SPECjvm2008_1_01_setup.jar]
[Loaded ZeroGd3 from file:/root/specjvm/SPECjvm2008_1_01_setup.jar]
Any idea?
Thanks
Use the -i console option to install it command line:
$ java -jar SPECjvm2008_1_01_setup.jar -i console
In case you prefer a graphical installer:
Since you probably don't want to install a X server on your server just for this install process you can:
Install Xming on your windows client and start it (Xming will show up as a notification icon on the taskbar)
Allow X forwarding on the ssh daemon on your server. Edit /etc/ssh/sshd_config and make set "X11Forwarding yes"
Enable X11 forwarding in your putty client;
Check the "Enable X11 forwarding" checkbox at Connection => SSH => X11
Set "X display location" to localhost:0
Login on your server using those settings with putty.
Now start the SPECjvm2008 install (java -jar SPECjvm2008_1_01_setup.jar)
The graphical installer will now popup on your windows client.
(There are some prerequisites which I didn't describe here. You will find more information on the Xming website.)