Make Windows Productive Again with WSL 2
TL;DR
Windows Terminal
(Terminal Emulator) + Ubuntu
(20.04 latest LTS) via WSL
2 + winget
makes Windows 10 productive for Linux / macOS power users.
main()
I was given a Dell Latitude 5300 2-in-1 by a customer for a project. First impression: the build quality is not bad. What? it can be flipped to be a tablet, but no pencil (can’t find it attached).
It runs Windows 10, hmm…
- BIOS is secured with password.
- No local Administrator priviledge.
- VPN needs to stay ON.
- Seamless Active Directory integration and SSO.
- Tight Domain security policies enforced.
NOTE: tight security control -
give users no choice
makes a lot of sense for a non-IT company, which can efficiently reduce helpdesk workload and operational cost.
I planned to install Ubuntu 20.04 in WSL 2 to run Ansible
(which does not support Windows as control node) before getting the laptop.
It took a week to get approval to be given Power User
.
Then the fun began
- Added the domain user to local Administrators group (opted out for helpdesk as a result) - this needs to be repeated after each power cycle (domain security poilicy).
- Installed Windows Terminal
- Enabled WSL 2
- Failed to install Ubuntu 20.04 from MicroSoft Store (not provisioned yet based on error message -
PUR - not augumented
) - Installed
winget
(instead ofscoop
)
Store doesn’t sell, one can still install from Ubuntu 20.04 focal wsl rootfs tarball
, fine ;-)
1 | # wsl --import <DistributionName> <InstallLocation> <FileName> |
NOTE: the default login is
root
, bad even for WSL use case. Create a new user and launch WSL as non-root user:
1 | # create user |
Set Ubuntu Focal as default
1 | wsl -s Ubuntu-20.04 |
winget
works well (early stage) as basic package manager installing required software.
1 | winget install terminal |
NOTE:
winget
is known to be a AppGet fork, hopefully with Microsoft backed development, I won’t doubt that it’ll soon becomehomebrew
equivalent existence on Windows. Good for users, sad for AppGet,scoop
(may still have its place to install CLI utils) andChocolatey
.
Know Just Enough WSL to be Productive
Fun facts
Windows
%userprofile%
is mounted as/mnt/c/Users/<username>
asFSTYPE
—>drvfs
.\\wsl$
leads to the parent directory of the list of Linux distributions installed.In Windows Terminal
explorer.exe .
launches Windows Explorer in current working directory.Equivalent to
open .
on macOSxdg-open .
,dolphin .
orother_file_manager .
on Linux.
Copying files from Windows to Linux (WSL 2), produces weird
<filename>.Zone.Identifier
files (NTFS related bug) which it should not, wtf…Never mind, just get rid of it
find ~ -type f -iname '*.Identifier' -exec rm -rfv {} +
Use
fd
if more comfortable with it ;-)Don’t forget to symlink to Windows
%userprofile%
to make life in WSL easierln -sf /mnt/c/Users/<username> ~/userprofile cd ~/userprofile
Overall Windows Terminal user experience is OK, it has huge room for improvements though, long way to go.
Last but not least, Linux in WSL 2 is NOT real Linux virtual machne. It is highly customised light-weight Hyper-V VM running customised kernel (Ubuntu 20.04 uses 4.4.0
). It doesn’t use systemd
as init
to initialise userspace, as a result none of the systemd *ctl
commands works. Some other GNU or open source utils may not work either, compatibility will improve for sure.
Ubuntu in WSL is definitely NOT perfect.
It definitely won’t replace Linux on workstations and laptops for me in any sense, however, I won’t look back at Cygwin
or running Linux VM using VirtualBox if I have to use Windows machines to get things done and deliver.
NOTE: Cygwin popularity declines with the rise of WSL. It is still the preferred choice for people running Windows 7 or older who needs quick & dirty light-weight
POSIX
-compatible programming and runtime environment.
EOF