User Tools

Site Tools


windows_subsystem_for_linux_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
windows_subsystem_for_linux_setup [2022/04/09 20:39] – [Update plus basic packages] tkbletscwindows_subsystem_for_linux_setup [2024/12/22 19:54] (current) tkbletsc
Line 4: Line 4:
  
 ===== Enabling WSL ===== ===== Enabling WSL =====
-First, to enable WSL at all ([[https://docs.microsoft.com/en-us/windows/wsl/install-win10|from here]]), in adminstrator powershell: + 
-  Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux +First, to enable WSL at all, in adminstrator powershell: 
-Then, it still being Windows, you have to restart.+ 
 +<code> 
 +wsl --install 
 + 
 +</code> 
 + 
 +Then, it still being Windows, you have to restart. If it hangs or is weird, restart and try again. If it is then weird in a new way, restart, and try again.
  
 ===== Installing distro ===== ===== Installing distro =====
-Windows Store is a garbage zone. Here's the spell for skipping that part ([[https://docs.microsoft.com/en-us/windows/wsl/install-manual|from here]]). Just download this URL and double click what you get:  
  
-https://aka.ms/wsl-ubuntu-1804+To get Ubuntu 24.04:
  
-https://aka.ms/wslubuntu2004+<code> 
 +wsl --install ubuntu-24.04
  
-Other URLs exist for other distros; you're on your own for that.+</code>
  
 +To see other distros:
 +
 +<code>
 +wsl --list --online
 +
 +</code>
 ===== Making it Launchy-launchable ===== ===== Making it Launchy-launchable =====
 +
 The distro will be installed as an "app", which is Windows 10 speak for "dumbed down program that's treated in special ways that break normal workflows". If you have classic Start and Launchy, to make it work with Launchy: The distro will be installed as an "app", which is Windows 10 speak for "dumbed down program that's treated in special ways that break normal workflows". If you have classic Start and Launchy, to make it work with Launchy:
 +
   * Make a shortcut of the "app", then put the shortcut into the classic start menu programs list.   * Make a shortcut of the "app", then put the shortcut into the classic start menu programs list.
  
 ===== Update plus basic packages ===== ===== Update plus basic packages =====
 +
 The default package set is actually not bad. But this will update and install what's missing: The default package set is actually not bad. But this will update and install what's missing:
-  sudo apt update + 
-  sudo apt dist-upgrade +<code> 
-  sudo apt install lynx links binutils zip unzip gdb build-essential dos2unix+sudo apt update 
 +sudo apt dist-upgrade 
 +sudo apt install lynx links binutils zip unzip gdb build-essential dos2unix 
 + 
 +</code> 
 + 
 +Bigger list: 
 + 
 +<code> 
 +sudo apt install at bc bzip2 default-jdk dos2unix fdisk ffmpeg build-essential gdb hashdeep valgrind lynx links wget curl ltrace strace manpages-dev mdadm nasm net-tools netcat nmap pv spim zip unzip whois x11-apps 
 + 
 +</code>
  
 ===== Symlinks ===== ===== Symlinks =====
 +
 To get to places easily: To get to places easily:
-  ln -s /mnt/c/Users/$USER ~+ 
 +<code> 
 +ln -s /mnt/c/Users/$USER ~ 
 + 
 +</code>
  
 ===== "Open Linux Shell Here" context menu ===== ===== "Open Linux Shell Here" context menu =====
-It turns out there already is one by default, but it only shows if you //shift// right click. To make it always visible ([[https://winaero.com/blog/make-open-linux-shell-always-visible/|per here]]):+ 
 +It turns out there already is one by default, but it only shows if you //shift//  right click. To make it always visible ([[https://winaero.com/blog/make-open-linux-shell-always-visible/|per here]]): 
   * Download and run "[[https://winaero.com/blog/execti-run-programs-trustedinstaller/|ExecTI]]" to allow you to run regedit as TrustedInstaller (more privileges than admin)   * Download and run "[[https://winaero.com/blog/execti-run-programs-trustedinstaller/|ExecTI]]" to allow you to run regedit as TrustedInstaller (more privileges than admin)
   * Run regedit using the tool   * Run regedit using the tool
Line 38: Line 71:
  
 ===== Run explorer from this directory in bash ===== ===== Run explorer from this directory in bash =====
-I'm used to saying ''start .'' to open an explorer in this directory. Using [[https://stackoverflow.com/questions/44245721/launching-explorer-from-wsl|this recipe]], you can add the following to ~/.bashrc to restore this functionality: 
-  alias start="powershell.exe /c start" 
  
 +I'm used to saying ''start .''  to open an explorer in this directory. Using [[https://stackoverflow.com/questions/44245721/launching-explorer-from-wsl|this recipe]], you can add the following to ~/.bashrc to restore this functionality:
 +<code>
 +
 +alias start="powershell.exe /c start"
 +
 +</code>
  
 ===== Keyboard scrolling ===== ===== Keyboard scrolling =====
 +
 By default, there's no keyboard shortcut to scroll the Windows terminal. Per [[https://superuser.com/questions/1408859/windows-subsystem-linux-terminal-scrolling-using-keyboard|here]], a quick duct tape solution is to use the following script in [[https://www.autohotkey.com/|AutoHotKey]]: By default, there's no keyboard shortcut to scroll the Windows terminal. Per [[https://superuser.com/questions/1408859/windows-subsystem-linux-terminal-scrolling-using-keyboard|here]], a quick duct tape solution is to use the following script in [[https://www.autohotkey.com/|AutoHotKey]]:
 <code> <code>
 +
 #IfWinActive ahk_class ConsoleWindowClass #IfWinActive ahk_class ConsoleWindowClass
  
Line 56: Line 95:
  
 #IfWinActive #IfWinActive
 +
 +</code>
 +
 +===== Ensure Windows drives are writable =====
 +
 +I just upgraded to Ubuntu 22.04 WSL, and found that some IO requests to /mnt/c were getting permission denied. Upon investigating, I found that the old WSL (which worked) had this output for mount:
 +
 +<code>
 +C:\ on /mnt/c type drvfs (rw,noatime,uid=1000,gid=1000,case=off)
 +
 +</code>
 +
 +And the new one had:
 +
 +<code>
 +C:\ on /mnt/c type drvfs (rw,noatime,uid=0,gid=0,case=off)
 +
 +</code>
 +
 +The fix is to set UID for the WSL mounts. This can be done by editing /etc/wsl.conf and adding:
 +
 +<code>
 +[automount]
 +options = "uid=1000,gid=1000"
 +
 </code> </code>
  
 ===== Script to mount *all* drives ===== ===== Script to mount *all* drives =====
 +
 By default, WSL just mounts physical drives around at boot. This script mounts all drives Windows knows about to directories under /mnt: By default, WSL just mounts physical drives around at boot. This script mounts all drives Windows knows about to directories under /mnt:
  
Line 71: Line 136:
     fi     fi
 done done
 +
 </code> </code>
 +
  
windows_subsystem_for_linux_setup.1649561944.txt.gz · Last modified: 2022/04/09 20:39 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki