How do I pass a path with spaces to WSL for Windows Terminal

I want to start WSL at a specific path /mnt/c/Users/My User/repos. I know we can do wsl.exe ~ for example, but the main complication here is that the space terminates the option.

I can wrap the path into an escaped string, but WSL won’t take a string as a default parameter, so wsl.exe "/mnt/c/Users/My User/repos" doesn’t work.

There is no -p or --path option that accepts a string, and I have looked at the WSL options
and the WSL error/help CLI and haven’t found a solution.

{
    "colorScheme": "One Half Dark",
    "commandline": "wsl.exe '/mnt/c/Users/My User/repos' -d Ubuntu-20.04",
    "icon": "ud83dudc40",
    "name": "My Windows Terminal Profile",
    "tabTitle": "Windows Terminal"
}

windows subsystem for linux – How to upgrade ubuntu 18.04 to 20.04 in WSL when “wsl –export” fails

I’m trying to follow the directions to upgrade my WSL 1 Ubunutu (18.04) release to WSL 2 Ubuntu-20.04 and the first step gives me an error message I don’t know how to work around.

wsl --set-version ubuntu 
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.
bsdtar: Couldn't read link data: I/O error
bsdtar: Error exit delayed from previous errors.

I have also tried doing it the “normal” Ubuntu way and get different “errors”:

$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:    18.04
Codename:   bionic
cfclark@p53:
~
$ sudo apt update

Hit:1 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
cfclark@p53:
~
$ sudo apt upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libdumbnet1
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
cfclark@p53:
~
$ sudo do-release-upgrade

Checking for a new Ubuntu release
Get:1 Upgrade tool signature (1554 B)                                                                                                                                                                       
Get:2 Upgrade tool (1340 kB)                                                                                                                                                                                
Fetched 1342 kB in 0s (0 B/s)                                                                                                                                                                               
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg' 
extracting 'focal.tar.gz'
(4l>7(r(?1;3;4;6l87(4l=)0(1;66rlspci: Cannot find any working access method.

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu bionic InRelease
Hit http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease
Hit http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit http://security.ubuntu.com/ubuntu bionic-security InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done

Restoring original system state

Aborting
Reading package lists... Done
Building dependency tree
Reading state information... Done
=== Command detached from window (Sun May 23 13:26:05 2021) ===
=== Command terminated with exit status 1 (Sun May 23 13:26:15 2021) ===

windows 10 – WSL and VHDX file size discrepency

On my Windows system, I have WSL2 with Ubuntu installed. I found the ubuntu vhdx file is about 64 GB in size. However, when I try to compact it, the size does not shrink.

df -h shows:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sdd        251G  215G   24G  91% /

sudo du / -x -d 1 -h shows:

346M    /home
4.0K    /srv
7.1M    /etc
4.0K    /opt
20K     /root
4.0K    /mnt
2.4G    /usr
4.0K    /media
4.0K    /boot
4.0K    /snap
220M    /tmp
586M    /var
16K     /lost+found
3.6G    /

I suspect something is holding those space in the VM so Windows cannot compact the VHDX file.

display – installation of kde in WSL

recently i got some problems with PC so i formatted hdd and installed win10 (ofcourse beta). to make some personal things i need to have ubuntu with FULL DESKTOP (gui). i decided to choose that it’d be KDE. yesterday it worked for a few whiles but i accidentally deleted my own script to execute xserver from linux. today i tried to something similar (i think cause i forgot what was in script :/ ) and today it : knows where and how to connect to xserver but… throws about a ton of errors and normal desktop doesn’t start. is there any way to run gui normally without any errors and this X as cursor?

things i have installed :

  • kde-full
  • vcxsrv (xserver)
  • ( + default windows apps like rdc)
  • wsl version now is 1 but i can change it to 2 (i have it also installed) 🙂

at me simply

sudo -s
export DISPLAY=:0.0
export LIBGL_ALWAYS_INDIRECT=1
plasma_desktop

doesn’t work. any ideas? i dont also want to mess up with vnc…

my setup for xserver:

  • one large window
  • display 0
  • “start no client”
  • clipboard enabled, native GL enabled, “disable access control” does just nothing both enabled and disabled

thank for answer (if any :/)

18.04 – Running Python script on WSL causes error due to ^M

Running Ubuntu 18.04 under WSL, I have one .py file that if I do:

$ ls -la foo.py 
-rwxrwxrwx 1 ken ken 6778 Apr 25 15:16 foo.py
$ ./foo.py
bash: ./foo.py: /usr/bin/python3^M: bad interpreter: No such file or directory

If I do the full:

$ python ./foo.py

The script runs as normal. Also, this works:

$ touch bar.py
$ chmod +x bar.py
$ ./bar.py

This happens both in the raw bash shell and the VSCode terminal window. Why might my file cause such an error?

linux – How to specify startup directory for WSL (Ubuntu) in ConEmu in Windows 10

I have installed WSL2 with Windows 10 and downloaded and set up Ubuntu successfully.

I have installed and set up ConEmu terminal to run Ubuntu successfully.

But ConEmu opens Ubuntu in C:UsersMyUsers

I want to start up in Linux (Ubuntu) HomeMyUsers Directory

I tried to used each of these commands in ConEmu – Settings – Tasks – 6- Bash (or 7- Ubuntu) but none of them worked:

%windir%system32wsl.exe -cur_console:pm:/mnt --distribution Ubuntu -c "cd"
%windir%system32wsl.exe -cur_console:p -c "cd"
%windir%system32wsl.exe -cur_console:p -c "cd /home"
%windir%system32wsl.exe -cur_console:pm:/mnt --distribution Ubuntu -c "~"
set "PATH=%ConEmuBaseDirShort%wsl;%PATH%" & %ConEmuBaseDirShort%conemu-cyg-64.exe --wsl -cur_console:pm:/mnt -C "~"
wsl.exe -cur_console:pm:/mnt -C "~"

apt – WSL G++ Unable to fetch some archives

A lot of people have asked very similar questions to this but none of those worked for me. I am trying to install g++ on WSL (windows subsystem for linux). I tried to use root and turned of my firewall but it still does not work. I tried update and upgrade but that did not help. I used sudo apt-get install g++ (I tried using –fix-missing but that also did not help)

Errors:

Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.3.0-17ubuntu1~20.04
Ign:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.3.0-17ubuntu1~20.04
  Connection failed (IP: 91.189.88.142 80)
Err:2 http://security.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04
  Connection failed (IP: 91.189.88.142 80)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-9/gcc-9_9.3.0-17ubuntu1~20.04_amd64.deb  Connection failed (IP: 91.189.88.142 80)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-9/g++-9_9.3.0-17ubuntu1~20.04_amd64.deb  Connection failed (IP: 91.189.88.142 80)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Full Log:

sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++-9 gcc gcc-9 gcc-9-base libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev
  libctf-nobfd0 libctf0 libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev manpages-dev
Suggested packages:
  binutils-doc cpp-doc gcc-9-locales g++-multilib g++-9-multilib gcc-9-doc gcc-multilib make autoconf automake libtool flex bison gdb gcc-doc gcc-9-multilib glibc-doc
  libstdc++-9-doc
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++ g++-9 gcc gcc-9 gcc-9-base libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0
  libcrypt-dev libctf-nobfd0 libctf0 libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev
  manpages-dev
0 upgraded, 31 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.6 MB/38.7 MB of archives.
After this operation, 169 MB of additional disk space will be used.
Do you want to continue? (Y/n) Y
Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.3.0-17ubuntu1~20.04
Ign:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.3.0-17ubuntu1~20.04
  Connection failed (IP: 91.189.88.142 80)
Err:2 http://security.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04
  Connection failed (IP: 91.189.88.142 80)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-9/gcc-9_9.3.0-17ubuntu1~20.04_amd64.deb  Connection failed (IP: 91.189.88.142 80)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-9/g++-9_9.3.0-17ubuntu1~20.04_amd64.deb  Connection failed (IP: 91.189.88.142 80)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

git – Unable to update submodule from Github within WSL

I’m having trouble updating the submodules I use for my vim configuration despite everything else working from a GitHub perspective.

I have already followed github’s “generating SSH keys” as well as “adding SSH keys to github” article multiple times and have re-added my SSH key multiple times. I have tried the ed protocol, as well as the RSA and neither seems to work.

Strangely enough, all other tests for whether or not i’m connected work. I’m able to git clone a raw repository without a problem, even private repositories using ssh links.

I can also use the ssh -T git@github.com command fine and it says i’m authenticated with my proper user account and everything.

ssh -T git@github.com
Hi ca-mantis-shrimp! You've successfully authenticated, but GitHub does not provide shell access.

Literally the only thing that is broken is recursively updating submodules and it is driving me crazy, everything i’m reading say I just need to replace the public key but I really don’t think that’s the problem or i’m missing something

and yes, i’m add the ssh key and ensure the agent is running in the background.

I get

/usr/lib/git-core/git-submodule: 88: gettext: Permission denied
/usr/lib/git-core/git-submodule: 1: envsubst: Permission denied
/usr/lib/git-core/git-submodule: 88: envsubst: Permission denied
/usr/lib/git-core/git-submodule: 1: envsubst: Permission denied
/usr/lib/git-core/git-submodule: 88: gettext: Permission denied
/usr/lib/git-core/git-submodule: 88: envsubst: Permission denied
...

when trying to update

i’ve deleted the repo and tried cloning it back, i really can’t think of what could be wrong here.