`yadm.os` does not resolve as "WSL" but as "Linux" in WSL2 on Windows 11
edouardberthe opened this issue · comments
Hello,
First thank you for this amazing lib which I've been using for years now.
Describe the bug
The template functionnality seems not to work on Windows Subsystem for Linux 2 (WSL2), on Windows 11.
.config/yadm/alt/.zshrc##template
:
{% if yadm.os == "WSL" %}
# Hello I am on WSL2
{% endif %}
{% if yadm.os == "Linux" %}
# Hello I am on Linux
{% endif %}
The file which is generated by yadm is:
.zshrc
# Hello I am on Linux
To reproduce
Can this be reproduced with the yadm/testbed docker image: [No]
Expected behavior
As stated in the documentation, the yadm.os
variable is expected to resolve as "WSL"
when used from inside WSL:
Environment
- Operating system:
- Windows 11
- WSL: output of
wsl.exe --status
:Default Distribution: Ubuntu Default Version: 2 Windows Subsystem for Linux was last updated on 05/07/2022 WSL automatic updates are on. Kernel version: 5.10.102.1
- Version yadm:
2.3.0
- Version Git:
2.25.1
Many thanks
What is the output of
cat /proc/version
?
yadm checks for the string 'Microsoft' in the output here.
The output of
uname -a
may prove helpful as well. Perhaps we move to that, if it's more reliable.
Can you let me know the contents of /proc/version? This is how yadm figures this out.
Thanks for your answers.
From inside WSL2, the output of cat /proc/version
is:
Linux version 5.10.102.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Mar 2 00:30:59 UTC 2022
and the output of uname -a
is:
Linux Edouard-PC 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
So it's very weird, the string microsoft
does seem to be present in the output..
Ok I got it, my version of yadm is 2.3.0
, in which we only check for "Microsoft"
(with a capital M), so I simply need to install a more recent version!
apt update && apt upgrade yadm
does not seem to install anything more recent than 2.3.0
though.
Once Ubuntu makes a release, the versions of all the packages are frozen (except for very serious bug fixes). To get a newer version you have to move to a newer Ubuntu release, which in your case is even one more step removed because it will have to propagate to WSL as well.
This is the unfortunate trade-off of distribution-packaged software: it's a lot more convenient to install and there is some effort into keeping it stable so you're not surprised by changes, but the price is that it's often out-of-date. If you need a newer version, you may need to download and install it yourself rather than using the packaged version.
Upgrade to Jammy Jellyfish ongoing :) many thanks
Upgraded my Ubuntu version (inside WSL2), which led to an upgrade of yadm to 3.1.1, everything works like a charm. Thanks!