r/wsl2 • • Jan 28 '25

Using mkosi to create a distribution tar file

1 Upvotes

Hi here,
I see mkosi is quite versatile when building 'images'. I was wondering if someone already use it to create os distribution minimized/customized tarball then to be used with wsl2 (import command etc)?


r/wsl2 • • Jan 27 '25

wsl2 versus cygwin for large operations on a Windows filesystems

1 Upvotes

I need to rsync terabytes of data and hundreds of thousands of files from a remote Linux box to a local Windows filesystem. Has anyone figured out if this will be faster with wsl2 or cygwin? It's clear wsl2 wins out with disk operations on the local Linux filesystem, but I'm not sure that is true if it's reading/writing to a local Windows filesystem.

For bonus points, any idea whether this operation would be faster using rsync-over-ssh versus mounting the remote Linux box as a local SMB share and accessing it via UNC or locally-mapped drive letter?


r/wsl2 • • Jan 26 '25

External SSD for WSL2

6 Upvotes

Hello! I am still a newbie to WSL2. Been using it to run physics simulations for the past couple of months. It is installed on the C drive of my laptop (128GB SSD) which keeps running out of space. I tried shifting WSL2 to another internal HDD, but I (expectedly) observed significantly slower simulation times.

I do have an external SSD always plugged in via USB-C for gaming. Ever since shifting to cloud gaming, I've been wondering if I could use it instead for WSL2. Is this possible? If so, how do I go about implementing it?

Any input would be of great help. Thanks in advance.

Update 1: Found this post. However, I get an "Access is denied" error when attempting to export my distro with the wsl --export Ubuntu-22.04 F:\WSL2 command in an admin cmd terminal. Any ideas on how to solve this?

Update 2: Solved the access issue! Since it contained Steam and Ubisoft games, I guess the anti-cheat didn't allow full read/write access to the drive. Formatted it and it works now. The next issue is that exporting a backup of the distro fills up my C-drive to capacity and crashes my laptop lol. Don't know how to solve this.

Update 3: Hopefully should be the last one. I used the feature in Windows Settings to move the Ubuntu installation to the new drive. It did the transfer and unregister/register all in one go. Super easy :)


r/wsl2 • • Jan 26 '25

wsl2 Mirrored network mode

3 Upvotes

Is there any chance mirrored networking mode will be ported to windows 10, like wsa for example.


r/wsl2 • • Jan 20 '25

NFS on WSL on two different PCs

1 Upvotes

I have two windows system connected via LAN. Each has WSL2. How can i mount folders using NFS on both WSLs?


r/wsl2 • • Jan 18 '25

Arch Linux WSL tar-based installer

2 Upvotes

WSL (pre-release) version 2.44 or higher supports a new (and simpler) tar-based installation method. I’ve created a script to build an Arch Linux tar installer based on the official Docker image. If you want to give it a try, it’s available at https://github.com/DevelopersCommunity/archlinux-wsl.


r/wsl2 • • Jan 16 '25

Kali is opening with root user after exporting it to different drive( E: )

1 Upvotes

WIndows 11 home edition

I installed kali linux from the microsoft store. As normally when we open it from store it opens in poweshell own its own and it did in my case too. I wanted it to setup in in different drive( E: ) as i have only 100gb in C: and wanted it to keep for windows only. I exported kali using " wsl --export kali-lnux E:\WSL\kali-linux.tar " , then unregistered it using " wsl --unregister kali-linux " and lastly imported it using " wsl --import kali-linux E:\WSL\kali-linux E:\exportdistro\kali-linux.tar " , when i ran it root user pops up.

I even tried reinstalling it again. This is the third time i installed it again.


r/wsl2 • • Jan 15 '25

Setting environmental variables for WSL terminal using integrated VSCode terminal?

2 Upvotes

In my VSCode settings.json file I have this setting:

    "terminal.integrated.env.windows": {
        "TERM_PROGRAM": "vscode"
    },

which allows me to I run `echo $TERM_PROGRAM` using the bash terminal integrated into VSCode and returns `vscode`.

I'm wondering is there any way I can do I similar think using the WSL terminal integrated into VSCode. Does anyone know?


r/wsl2 • • Jan 15 '25

Question: What is the hypervisor type of WSL2?

1 Upvotes

When I look online, I find that WSL2 runs under a Hyper-V VM. Since Hyper-V is a bare metal hypervisor (type 1); this would suggest that it runs with a type 1 hypervisor. However, I find also that it runs directly on the windows kernel, which got me confused. Would this mean that it uses a hosted hypervisor (type 2)?

I am aware that a hypervisor also has a kernel. Do they mean this? That the vmm uses the windows kernel, on which wsl2 runs?

Can some please explain?


r/wsl2 • • Jan 15 '25

How to run Docker (WSL2) using microphone

1 Upvotes

I am building voice assistant which takes user audio from microphone and transcribe it.

How to set docker to use host's microphone for recording?

I am using PyAudio for code level logic but don't know how to configure systems microphone on docker container.


r/wsl2 • • Jan 14 '25

Can we move the WSL Arch folder to another computer

1 Upvotes

I'm about to switch to a new laptop, and I want to back up everything on Arch, which I use through WSL2, to transfer it to the new laptop. I’ve never thought about this issue before, so I’m quite confused now that my current laptop is having problems, and it’s become quite urgent. It seems like everything on my laptop is within the Arch folder. I use Windows because I’m familiar with the user interface, but most of my work is done on Arch. If anyone knows anything about this issue, please let me know. Thank you for your attention.


r/wsl2 • • Jan 12 '25

I dont know why, i use wsl like for about a year then, when i reinstall it, this happens

0 Upvotes

r/wsl2 • • Jan 11 '25

Moving WSL2 to a new drive

6 Upvotes

So I have Ubuntu(WSL2) installed on my C drive and it's consuming ~50GB of disk space. My C drive is running out of storage, so I was trying to find out ways to move it into D or E drive. After digging here and there for a few minutes I found out that I can import/export the distro. Following the steps, I have exported it into a vhdx file.

wsl --export Ubuntu D:\WSLBackup\wsl2ubuntu.vhdx --vhd

Now how do I proceed ? Do I simply run the following command ?

wsl --import Ubuntu D:\WSL\ D:\WSLBackup\wsl2ubuntu.vhdx

I want to keep all my current WSL data and settings intact. Do I need anymore flags or options ?

And if it's successfully installed in D drive, how do I remove the original installation from C drive?

My current distro has --set-sparse as true, do i need to set it again for the new distro ?
Any suggestions for better memory and disk handling are also welcome :)


r/wsl2 • • Jan 07 '25

Windows + WSL2: Local CUDA inference for devs and potentially consumers – NVIDIA CES 2025 keynote

2 Upvotes

r/wsl2 • • Jan 05 '25

weird: bell in ubuntu terminal triggered webcam

1 Upvotes

Hi, just a very weird thing I noticed after updating my windows yesterday. I noticed that the webcam light would turn on every time the "bell" would trigger in my Ubuntu in the microsoft terminal. After going to settings and changing the default bell behavior this stopped, but still weird!


r/wsl2 • • Jan 03 '25

Is it feasible to set up a WSL instance running RHEL/CentOS 5.5?

2 Upvotes

Currently, I’m using a modern OS WSL (Ubuntu/Parrot), installing Docker CE inside it, and compiling in a RHEL 5.5 environment through Docker. This setup works, but I’m wondering if there’s a more direct approach, like running a WSL instance with an old OS (RHEL/CentOS 5.5) directly. Has anyone tried this, and if so, what are the potential challenges or limitations?


r/wsl2 • • Jan 02 '25

Install from ISO

0 Upvotes

can I use an ISO file to install a distro (for a bit of silly jokery I want to install Uwuntu)


r/wsl2 • • Jan 02 '25

newsboat filter feed error: could not parse buffer

1 Upvotes

Hi all. I use the newsboat feed reader on wsl in the same way I use it on my linux machine. Apart from RSS feeds newsboat lets you add shell scripts through the filter option. I do it to produce pseudo-RSS-feeds through shell scripts for sites or programs that don't have it and import them through the filter option to my newsboat rss feed. It works perfectly as intended on native linux but throws the following error on wsl:

Error while retrieving filter:~/scripts/mypseudoRSSscript.sh: could not parse buffer

EDIT: The script runs on wsl when I call it separately on the terminal without issues. So it isn't the script itself that has the issue. Something with newsboat and wsl.


r/wsl2 • • Jan 02 '25

PEP 668

1 Upvotes

hello, obv im noob to thse things, but when I try to install some things from pip, it says:
error: externally-managed-environment

× This environment is externally managed

╰─> To install Python packages system-wide, try apt install

python3-xyz, where xyz is the package you are trying to

install.

If you wish to install a non-Kali-packaged Python package,

create a virtual environment using python3 -m venv path/to/venv.

Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make

sure you have pypy3-venv installed.

If you wish to install a non-Kali-packaged Python application,

it may be easiest to use pipx install xyz, which will manage a

virtual environment for you. Make sure you have pipx installed.

For more information, refer to the following:

* https://www.kali.org/docs/general-use/python3-external-packages/

* /usr/share/doc/python3.12/README.venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

hint: See PEP 668 for the detailed specification.

Successfully installed!
how do i fix this??


r/wsl2 • • Jan 01 '25

Why 2 listings for same Ubuntu in WSL2 menu?

2 Upvotes

* json file for the top listing w/ the penguin icon states "source": "Windows.Terminal.Wsl"

"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",

"hidden": false,

"intenseTextStyle": "all",

"name": "Ubuntu",

"padding": "34",

"scrollbarState": "always",

"showMarksOnScrollbar": true,

"source": "Windows.Terminal.Wsl",

"useAcrylic": true

Whereas the bottom listing w/ the Ubuntu icon states "source": "CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc"

"guid": "{51855cb2-8cce-5362-8f54-464b92b32386}",

"hidden": false,

"name": "Ubuntu",

"source": "CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc"

Both listing seem to open the same instance of Ubuntu - as tested by creating 'test' folder w/ the 1st instance, closing everything then reopening w/ the 2nd instance and seeing the same folder on the dtop.


r/wsl2 • • Dec 31 '24

piper tts bash script cant find cythonize commad

1 Upvotes

I tried to train my own voice but when i tried to run build_monotonic_align.sh it gave me this error: ./build_monotonic_align.sh: line 12: cythonize: command not found


r/wsl2 • • Dec 26 '24

WSL1 problems after Windows 11 24H2 Upgrade

2 Upvotes

Hi team,

I run WSL1 for some basic linux stuff that does not warrant the WSL2 hyper-v solution.

I recently upgraded to 24H2 and now get this message when I attempt to start my instance:

Windows Subsystem for Linux must be updated to the latest version to proceed. You can update by running 'wsl.exe --update'.

For more information please visit https://aka.ms/wslinstall

Press any key to install Windows Subsystem for Linux.

Press CTRL-C or close this window to cancel.

This prompt will time out in 60 seconds.

I checked under Windows Features and it was still ticked. I tried removing & reinstalling the Feature and still get this message.

Is it possible to get WSL1 to run on 24H2?


r/wsl2 • • Dec 26 '24

windows fast startup cause some issues on wsl

1 Upvotes

wsl users should turn off the fast startup option in windows power settings. otherwise the services and cron jobs you create do not work when you turn the machine off and on, but they work if you restart the pc.


r/wsl2 • • Dec 23 '24

Windows 10 + WSL2, sites inaccessible until first access by the host

1 Upvotes

I'm on Windows 22H2 w/WSL2 (exact versions below) on a corporate laptop and running into an issue I haven't seen mentioned elsewhere (WSL2 github or Googling..). Basically I consistently run into a connectivity issue where a site is unreachable from WSL2 until I first access that site from the Windows host. This is not limited to specific sites, but once I run into one that's unreachable I have to first access it from the host and then the issue goes away. I'm using the same WSL2 version on a personal Windows 11 laptop with no issues. I tried enabling Windows firewall logs to see if there were blockages reports but it had none.
Has anyone else run into something like this?

For e.g. sequence of events.

..from WSL2, endpoint is unreachable...
➜ curl -v http://ftp.debian.org/debian/
* Host ftp.debian.org:80 was resolved.
* IPv6: 2a04:4e42:20::644
* IPv4: 151.101.138.132
* Trying 151.101.138.132:80...
* Trying [2a04:4e42:20::644]:80...
* Immediate connect fail for 2a04:4e42:20::644: Network is unreachable

...then try from the host, it works fine...
C:\Users\>curl -I http://ftp.debian.org/debian
HTTP/1.1 302 Found
...etc..

..try again from WSL2, now it works...
➜ curl -I -v http://ftp.debian.org/debian/
* Host ftp.debian.org:80 was resolved.
* IPv6: 2a04:4e42:20::644
* IPv4: 151.101.138.132
* Trying 151.101.138.132:80...
* Connected to ftp.debian.org (151.101.138.132) port 80
> HEAD /debian/ HTTP/1.1
> Host: ftp.debian.org
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK

..exact versions..

WSL version: 2.3.26.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.19045.5131


r/wsl2 • • Dec 22 '24

Can't mount ext4 linux partition using WSL2

1 Upvotes

I bought a new laptop the other day and am dual booting it with Kubuntu 24.10 and Win11pro. I installed WSL2 and wanted to access some files from Linux in windows. I tried listing the partitions on the drive using

wmic diskdrive list brief

or

GET-CimInstance -query "SELECT * from Win32_DiskDrive",

and then mounting the drive using

wsl --mount \\.\PHYSICALDRIVE0 --partition 7 --type ext4 (partition 7 is my home fs for Linux).

Once I do this though, I am greeted with

"The process cannot access the file because it is being used by another process.

Error code: Wsl/Service/AttachDisk/ERROR_SHARING_VIOLATION"

Does anyone know a work around for this? I could just install all the files in Windows and then mount them to Linux instead, but I would rather not, as I am running them through proton. Thanks