/r/bashonubuntuonwindows
This is the Windows Subsystem for Linux
(WSL, WSL2, WSLg) Subreddit where you can get help installing, running or using the Linux on Windows features in Windows 10.
Visit the wiki
Docker On WSL
GUIs/Graphical Interface
Important Links & Documentation
Learn about Windows Console and Bash/WSL
Microsoft GitHub - Bash on Windows
Community powered list of programs that work and don't work
Friends
/r/Linux
/r/Windows+Windows10
/r/Ubuntu
/r/bash
General rules
https://www.reddit.com/r/bashonubuntuonwindows/about/rules/
(Thanks /r/Windows10 for some rules)
/r/bashonubuntuonwindows
When podman is installed on Windows it creates wsl
with a user called "user
" - this looks to me like a normal user. In wsl
logged in as this user I get:
$ id
uid=1000(user) gid=1000(user) groups=1000(user),10(wheel)
Can I login as this user and use it for my normal Linux work in wsl
or are there some ramifications with this podman-created user?
When I enter a pristine wsl (Ubuntu 22.04) I am seem to be root by default. And /etc/passwd
seem to my untrained eye not list any "normal" default user (only root
and system users like sys
, lp
and similar).
Should I add a "normal" user to my WSL Ubuntu and login it at that user for my everday Linux work?
I've been looking for a guide on how to do this but I'm not finding it.
The only thing I can find is to...
Thanks
Hello,
I am pretty new to this line of work. I have installed matlab onto my windows 11.
Now there is a toolbox that is widely used throughout my area of study. This toolbox, field trip, prefers the mac/linux environment with some functions (field trip-20240110/external/freesurfer), but can run on windows.
The function of interest, ft_read_headshape(), reads the freesurfer output and plots them inside a matlab figure.
I downloaded wsl onto my laptop, and moved the freesurfer functions onto wsl folder.
My thought process is that I could use the wsl environment to run the particular function and then get what I need for the windows environment.
Is there a way to do so?
There is a lot of great burning software in linux. I want to use them in wsl2 with my usb burner. I tried using usbipd-win. I did bind and attach but I don't see it in wsl devices. Do I need to do anything else or is this not possible?
Is there a way to set a default location for WSL distributions? I know how to move distribution after they are installed, but it is very irritating having to go through that process each time I install a new distro or set Docker Desktop to use WSL. It would be nice to have WSL place the images in the desired location from the get-go.
Hi all,
Old laptop was damaged and will no longer boot. I have successfully managed to access the SSD and all its files on my new laptop. I wish to install WSL2 and Ubuntu on my new laptop and have all my old Ubuntu files accessible on this new laptop, any advice?
I have tried taking the C:\Users\"user"\AppData\\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4 from my old files and mounting the drive to transfer files to my new installation but the drive comes up with an error saying it cant be mounted due to it not being initialized.
Thanks for any help in advance.
I have a Windows 11 computer (upgraded from Windows 10) where I am running WSL. Here I can check my upgraded WSL version (+ kernel version etc.) running the command `wsl --version` and get this:
```
WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
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.22631.4317
```
On a newer Window 11 computer where WSL i pre-installed this command is not allowed and I have no idea of how to check the version. Why the the difference...and why don't MS want me to see the version details?
Specifically, I cloned the "stock" Debian system and modified it a couple times with --export followed by --import. Can I run both at once somehow?
If I have mirrored networking, where does 127.0.0.1 go?
I've tried to put my C#.NET-4.5 git repo on the Windows filesystem and using WSL2 to access it through /mnt/c, but it's so slow, if you got a big repo.
I then put my repo inside WSL2, but Visual Studio 2022 went bananas trying to use it. By bananas, I mean it's not working at all, because Visual Studio cannot run solutions stored on WSL2. It's not supported and that's probably why VS Code needs a plugin.
I also tried to create a VHD, which someone told me to, but that couldn't be mounted inside Windows and WSL2 at the same time, so that kind of went the same way as repo inside WSL2.
I'm stuck.
I need to work on my repo directly in WSL2, but I also need Visual Studio.
One way is to just use git, but that's time waste delux.
I need to know how I can access an instance running on my windows host at 127.0.0.1
I've tried bridging the WSL and my windows network, didn't worked.
I tried port forwarding, didn't work.
I sick of this f*cking idiotic system. Why the f*ck didn't they just use the same networking system as WSL 1?! When using WSL 1, it works PERFECTLY fine. But of course, using WSL 1 isn't an option for my project...........
PLEASE help me!
EDIT: Please note that the instance running on windows, is ONLY accessible at http:127.0.0.1:[port]
I made this a minute ago as I was running out of physical space on Ubuntu 24.04 and wanted to see how much disk I actually had left.
function Get-WSLSize {
param (
[string]$DistroName = $(
# Display available WSL distros
$availableDistros = wsl.exe -l --all
Write-Host "Available WSL distros:" -ForegroundColor Cyan
$availableDistros | ForEach-Object { Write-Host $_ }
# Prompt user to enter the distro name
Read-Host -Prompt 'Please enter the WSL distro name'
)
)
# Ensure the distro name is not empty
if (-not $DistroName) {
Write-Host "Distro name cannot be empty." -ForegroundColor Red
return
}
# Run the WSL df command for the entered distro name
try {
wsl.exe --system -d $DistroName df -h /mnt/wslg/distro
}
catch {
Write-Host "Error: Failed to execute WSL command for distro '$DistroName'." -ForegroundColor Red
}
}
Just add this to your PowerShell Profile and call it by entering 'Get-WSLSize' and it will display the list of available distro's which you can quickly copy to the clipboard and paste in the prompt and hit then enter to see the results.
You can also find it on my GitHub here.
Cheers Guys!
Hello, in the last few years I have grown very fond of wsl2 and linux in general as a dev environment. I would like to explore linux more but still need windows for a few things, works and games really.
my setup
500gb ssd - storage
2tb ssd - storage
256gb ssd - windows 11 ( nothing else for easy formats)
500gb ssd - linux
Is it possible to have access to the same project files on both windows and linux? I don't need access to everythin on both sides, that would be nice but seem unnecessary. Can I mount the linux bare metal drive into WSL to get access to the files on the windows side?
Can I mount the two storage drives to linux to get access to general media?
What would a system like this be called?
I am gearing up to do a full home server setup where I can run a NAS and have VMs for this. But for now I would like to at least use more of linux than wsl.
thanks (:
I wanted to switch from windows to Linux, but slightly, so i installed wsl. But now i think I’m ready to switch the system, so i want to ask: is it possible to transfer files to other disk or something and boot from that disk? Will it work?
I was talking to my friend with a mac and they mentioned that they only had to enter their password once per ssh-key and never had to worry about it again. I used to have my ssh-agent launch and add my keys when I first start WSL but I found it annoying that I needed to enter my passphrase every time for each key. I did find this solution from this medium article https://nazmul-ahsan.medium.com/how-to-prevent-ssh-key-passphrase-prompt-every-time-you-launch-wsl-6856eae31add and it seemed to work until until I was dealing with a new host/an unknown host in which case things would hang forever for example git would say cloning but would never go past there. I eventually came to my current solution which I'll post below but I was wondering if there's a better way.
My current steps:
On windows make sure you have OpenSSH-client and OpenSSH-server, if you don't this can be enabled in settings from optional features
Open an admin PowerShell terminal and run the following commands
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service sshd
In a non-admin powershell generate your ssh-key(s) and store the key pair somewhere like the .ssh folder and then add them to the agent with ssh-add
Once you have added your keys, you can verify that the agent is running with Get-Service ssh-agent
or usessh-add -l
to see which keys the agent has
Run the following lines in PowerShell to modify your .gitconfig on windows
git config --global credential.provider generic
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
Set up an alias on WSL to use git.exe instead of git
Now you should be able to clone via ssh without needing to enter your password even after rebooting your machine and it should work on WSL.
***edit
I found it via the terminal but it's not visible to Windows even with show hidden files enabled etc. Why is that?
I know I checked the box for it to use WSL2 under the hood but if the project is in Windows File System does it affect performance ?
or if i want a dockerized app, i should just put it from the start in a wsl2 file system ?
I have a Plex server running on Ubuntu Server 24.04 so I formatted my brand new 8 TB NAS drive as EXT4 to store all my media files. I've set up WSL on my Windows 11 machine and can access the drive. Now I am trying to copy files to the storage mount I made but constantly get an error:
"There is not enough space on Ubuntu. You need an additional 2.02 TB to copy these files."
If I run df -h, you can see my HDD has 6.9 TB (Nice.) available.
tom@Toms-Desktop:~$ df -h
Filesystem Size Used Avail Use% Mounted on
none 16G 0 16G 0% /usr/lib/modules/5.15.153.1-microsoft-standard-WSL2
none 16G 4.0K 16G 1% /mnt/wsl
drivers 931G 527G 405G 57% /usr/lib/wsl/drivers
/dev/sdc 1007G 1.2G 955G 1% /
none 16G 76K 16G 1% /mnt/wslg
none 16G 0 16G 0% /usr/lib/wsl/lib
rootfs 16G 2.2M 16G 1% /init
none 16G 520K 16G 1% /run
none 16G 0 16G 0% /run/lock
none 16G 0 16G 0% /run/shm
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
none 16G 76K 16G 1% /mnt/wslg/versions.txt
none 16G 76K 16G 1% /mnt/wslg/doc
C:\ 931G 527G 405G 57% /mnt/c
D:\ 1.9T 662G 1.2T 36% /mnt/d
tmpfs 3.2G 16K 3.2G 1% /run/user/1000
/dev/sdd1 7.3T 28K 6.9T 1% /mnt/wsl/PHYSICALDRIVE2p1
The drive only has 1 partition:
tom@Toms-Desktop:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 388.4M 1 disk
sdb 8:16 0 8G 0 disk [SWAP]
sdc 8:32 0 1T 0 disk /mnt/wslg/distro
/
sdd 8:48 0 7.3T 0 disk
└─sdd1 8:49 0 7.3T 0 part /mnt/wsl/PHYSICALDRIVE2p1
Mount point:
/dev/sdd1 on /mnt/wsl/PHYSICALDRIVE2p1 type ext4 (rw,relatime)
I tried creating a folder named plexfiles under /home/tom/plexfiles, set ownership permissions, and then tried to copy the files and again got the same "needs 2.02 TB" error.
If I create a new text file there, it creates with no issues. If I try to copy over a couple terabytes of data I get the above error. So I am having a space issue but am not sure what to do, this is my first time working with EXT4.
EDIT:
I reformatted and created two partitions, gave 10 GB to the OS and 7.3 TB for storage.
Bash
tom@Toms-Desktop:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 388.4M 1 disk
sdb 8:16 0 8G 0 disk [SWAP]
sdc 8:32 0 1T 0 disk /mnt/wslg/distro
/
sdd 8:48 0 7.3T 0 disk
├─sdd1 8:49 0 9.8G 0 part
└─sdd2 8:50 0 7.3T 0 part /mnt/wsl/PHYSICALDRIVE2p2
PowerShell
PS C:\WINDOWS\system32> wsl --mount \\.\PHYSICALDRIVE2 --partition 2
The disk was successfully mounted as '/mnt/wsl/PHYSICALDRIVE2p2'.
Note: The location will be different if you have modified the automount.root setting in /etc/wsl.conf.
To unmount and detach the disk, run 'wsl.exe --unmount \\.\PHYSICALDRIVE2'.
Result of df -i
tom@Toms-Desktop:~$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
none 4103210 4 4103206 1% /usr/lib/modules/5.15.153.1-microsoft-standard-WSL2
none 4103210 3 4103207 1% /mnt/wsl
drivers 999 -999001 1000000 - /usr/lib/wsl/drivers
/dev/sdc 67108864 49395 67059469 1% /
none 4103210 40 4103170 1% /mnt/wslg
none 4103210 5 4103205 1% /usr/lib/wsl/lib
rootfs 4102356 12 4102344 1% /init
none 4103210 565 4102645 1% /run
none 4103210 2 4103208 1% /run/lock
none 4103210 1 4103209 1% /run/shm
tmpfs 1024 19 1005 2% /sys/fs/cgroup
none 4103210 52 4103158 1% /mnt/wslg/versions.txt
none 4103210 52 4103158 1% /mnt/wslg/doc
C:\ 999 -999001 1000000 - /mnt/c
D:\ 999 -999001 1000000 - /mnt/d
E:\ 999 -999001 1000000 - /mnt/e
tmpfs 820642 34 820608 1% /run/user/1000
/dev/sdd2 243871744 11 243871733 1% /mnt/wsl/PHYSICALDRIVE2p2
I can create a file on it but again get the 2.02 TB free error. So I am confused, everything looks like it's mounted correctly and using the sdd2 partition, but acting like it's using the OS? The file location I'm in is \\wsl.localhost\Ubuntu\mnt\wsl\PHYSICALDRIVE2p2 in File Explorer.
I'm trying to track my dotfiles using Git, both from WSL (like .bashrc
) and from Windows (like my .obsidian
for note-taking). My plan was to create a .dotfiles
folder on the Windows side and put all the dotfiles in there. Then, I’d use symbolic links to place them where each app expects them. This worked well until I ran into an issue: Windows doesn’t always handle symbolic links properly. For example, GlazeWM (a window manager) refuses to accept a symlink to .glzr
—it needs the actual folder. Does anyone know a smart way to track both WSL and Windows dotfiles using Git without running into these problems?
Hello, i am already using my System drive (C:) for awhile now. and because i am using docker, the image files already big enough and i need to move my wsl files onto different drive. how can i do that while retaining all of my file permissions?
i have many solutions but i want your opinions before i run them.
thank you for your help.
Edit: I am gonna export wsl and then installing it to another drive. But before that, i will backup my files first as tar files.
I'm increasingly using WSL2 + my Nvidia card as my main server for LLMs etc. However, I'm having a slightly hard time keeping WSL2 up.
What works:
What doesn't work:
Do folks have a best practice for this?
EDIT: I realized that uptime thinks the Ubuntu instance has been up for the last 2 days, even though the instance wasn't ssh-able until I woke it back up by logging in via RDP. Does windows put the instance to sleep instead of killing it?
I am not a dev by trade or education, if I use incorrectly technical lingo please don't jump me.
Problem: I use Fork as Git GUI (and I wish to keep doing so). I have the repository folder in wsl2 (standard ubuntu distro). My problem is that Fork is installed in Windows 10 and it can't access the ubuntu directory with open folder (copy pasting the path leads to the error "impossible to access the desired path with this program". I tried googling it, seems like I am not the first having this problem but I don't understeand the workarounds.
Could someone help me? Thanks in advance
Hello Everyone!
As the title suggests, I am trying to install ROS2 and Gazebo on WSL2, as shifting from dual boot is very time-consuming. I tried going through yt but no luck on the version that I was looking for. I have installed Ubuntu 22.04 LTS on WSL2 and wanted to install ROS2 Humble and Gazebo. But no luck, as it isn't running; the gazebo is, but ROS2 isn't.
I'm fairly new to wsl2. I'm messing around to see what I can do. I'm on windows 10 with nvidia gtx 950. I tried playing 1080p mp4 video and it's a little choppy. I'm I suppose to install video drivers to make things smooth? 720p video is much smoother so I'm thinking it's not gpu accelerated? Any help would be greatly apreciated.
Hello everyone,
Up until now I used to access my Google Drive from the /mnt/g path. But for some reason, I am unable to do that anymore. The path exists, but if I ls nothing appears.
I have to run mount -t drvfs G: /mnt/g in order to get it working again. And if I reboot, I have to run it again to get it working.
This was not the normal behavior until yesterday when I shutdown my computer. Any helps on this?
Best regards
I am trying to run this command from the Laravel documentation for Windows, but nothing works when it comes to Linux commands, neither in the WSL prompt.
curl -s https://laravel.build/example-app | bash
Error:
<3>WSL (10) ERROR: CreateProcessEntryCommon:505: execvpe /bin/bash failed 2
<3>WSL (10) ERROR: CreateProcessEntryCommon:508: Create process not expected to return
We have a linux image we deploy through WSL2 at numerous sites. It has some hard-to-setup tools and environments ready to go. However, at one site, while it can access the public internet it cannot access lan. When running wsl hostname -I
it outputs:
172.28.232.228 172.18.0.1 172.17.0.1
None of these IP addresses are on the 172.17.147.1 subnet the host machine is on, which is what we need this device on. None of these networks have DHCP. Im confused as to how this hasnt been an issue before.
Where is WSL getting these IPs from and how can I tell it what IP space or address to use?