This is regarding "version one"
![]() |
![]() |
(on Wikipedia)
https://github.com/Microsoft/WSL
https://docs.microsoft.com/en-us/windows/wsl/about
- aka wsl
-
Sometimes known as Bash on Ubuntu on Windows or Bash on Windows
- Not related to Git on Windows.
- 2019-05-14 - Also using VirtualBox in parallel. Windows 10 host, Debian 9.9.0-i386-xfce-CD-1 guest.
-
2018-10-10 - I used to use Git on Windows then Babun.
- I use Debian (Debian in the Microsoft store)
--
--
- https://docs.microsoft.com/en-us/archive/blogs/wsl/ [ 1 ] was blogs.msdn.microsoft.com/wsl/
- See also My Windows Subsystem for Linux scripts.
-
2019-07-17 - alt-space doesn't work
- I can't figure out how to get AutoHotkey to do this.
[fails] - Windows Subsystem for Linux 2 installation ∞
2019-07-19
This is for Windows insiders. Sigh.
I think this is how it's done, but I don't know how to test.
Run Powershell as admin.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux # (You may need to reboot) Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform # Reboot # Learn what you have installed wsl --list # Change to whatever you have installed wsl --upgrade Debian
Note that Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
might make VirtualBox fail to start, with Call to WHvSetupPartition failed.
Windows Subsystem for Linux installation ∞
2018-10-10
0. Preparation
You will be prompted to reboot.
1. Open PowerShell as Administrator
Open cmd
as Administrator and type powershell
.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2. Install Debian
When prompted, choose to launch it. This will complete its installation.
Shortcuts ∞
By default, you will have a new "Debian GNU/Linux" in you start menu.
Shortcut to your home directory ∞
If you want to create a shortcut, you can make it with the target:
%windir%\System32\bash.exe ~
Or
%windir%\System32\wsl.exe ~
Shortcut to the current directory ∞
You can also make the target like the above, without the trailing ~
, like either of these:
%windir%\System32\bash.exe %windir%\System32\wsl.exe
And then make Start in
%V
Make blue on black legible ∞
As of 2019-01-07 this is unnecessary.
- Use ColorTool (downloads)
- they know this
- Introducing the Windows Console Colortool
-
See also 24-bit Color in the Windows Console!
The easy way:
Add context menu ∞
It's supposed to be there, but isn't..
-
- This has been modified to use Zsh as a shell. It's a bit hackish.
-
Unfortunately, due to the nature of WindowsApps, I cannot provide something that will work unmodified. Change
SOMETHING
to your appropriate code.- I used Process Lasso, then did
--right-click
> Locate > Locate executable on disk ...
- I used Process Lasso, then did
Note that there is no simple way to expand something like %windir%
in a .reg file. The default is a REG-SZ
type, but you have to encode it as hex to make it a REG_EXPAND_SZ
type.
Usage ∞
Locating the files from Windows ∞
For Debian it will be something like:
C:\Users\$USERNAME\AppData\Local\Packages\TheDebianProject.DebianGNULinux_$CODE\LocalState\rootfs
Replace $USERNAME
and $CODE
as appropriate.
Visit C:\Users\$USERNAME\AppData\Local\Packages\
to figure out your installation code. Why is it done like this? Who knows! Maybe it's for the same reason Firefox does it: To make it (somehow) difficult for attacks to find that directory.
Using the files from Windows [DO NOT DO THIS!] ∞
Due to the nature of Microsoft's fuckery, you can sort of access things, but DO NOT ADD ANYTHING AND DO NOT MAKE CHANGES or you will corrupt the everloving fuck out of your whole thing.
TODO - One possible solution: https://docs.microsoft.com/en-us/archive/blogs/wsl/wsl-file-system-support [ 2 ] was logs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/
Running GUI software on Windows Subsystem for Linux ∞
Thanks to https://seanthegeek.net/234/
- Download https://sourceforge.net/projects/vcxsrv/
- Install
- Run the icon from your desktop
- Accept all defaults
- Deny network access
-
In your Windows Subsystem for Linux shell, do
\export DISPLAY=localhost:0.0
.. now you can run a GUI app. Install something like Leafpad.
\sudo \apt-get install leafpad
Now leafpad
will launch the GUI text editor.
Mounting a USB drive ∞
\sudo \mkdir /mnt/d # You may need to try this multiple times. # Be sure to not be in this directory. \sudo \mount -t drvfs d: /mnt/d
Why isn't this possible by default? Who knows!
Mounting a network drive ∞
If it does not already have a drive letter, but does have a UNC path, you'd do:
\sudo \mkdir /mnt/share \sudo \mount -t drvfs '\\server\share' /mnt/share
Issues ∞
-
2020-05-20 -- I can't run a script if it's already in use.
-
2019-02-17 -- For some time I haven't been able to properly run some scripts. They seem to be mangled or chopped up somehow, and the attempt to execute them only sees some of the text in the file.
- I expect that this is some sort of encoding difference. Maybe it's line endings, but
dos2unix
didn't work. I think perhaps it's some sort of international character encoding thing, like UTF-8 versus whatever. - Everything looks fine with less and Nano. Scripts which I create with Nano work as-expected. Maybe I have to re-create all magically-broken files.
- I expect that this is some sort of encoding difference. Maybe it's line endings, but
-
While I figured out how to create a shortcut with a hotkey, I cannot open multiple terminal instances with that hotkey.
- For some time, the development team has been overhauling their terminal, and they are aware of the desire for a tabbed terminal.
-
Permissions are not retained, and chmod is either ignored or has an error.
- This must be fixed within Windows itself. I set all permissions as inheritable for all objects I'm trying to access (and subdirectories).
- Doesn't prompt when you close the terminal.
-
Cannot use a hotkey to paste into a terminal
- Supposedly solved by Windows Insider build 17643
- https://insider.windows.com/en-us/
- You can edit the preferences, and turn insert mode on, and then
right-click
to paste.
Mounting a USB drive. Yes, something as simple as that actually required research and documentation.
`alt-space` still doesn't work to open the top-left menu..