Difference between revisions of "Talk:Windows Subsystem for Linux"

From Funtoo
Jump to navigation Jump to search
(need this to start the process of pointing wsl2 to load debian kernel. =))
 
(→‎user setup: clean up hostname from when loaded in from sudo)
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
https://blog.dan.drown.org/replacing-the-wsl-kernel/
https://docs.microsoft.com/en-us/windows/wsl/wsl-config


need this to start the process of pointing wsl2 to load debian kernel.  =)
* copy debian kernel to windows system:
cp /boot/kernel-debian-sources-x86_64-6.4.13_p1-r1 /mnt/c/Users/*your user name*/
 
https://www.reddit.com/r/bashonubuntuonwindows/comments/141n0c0/instructions_for_using_kernel_63y_on_wsl2_you/
 
*gwsl in the microsoft store can run graphical applications that are installed.
 
Xming uses ssh x11 forwarding to render x11 under windows:
*http://www.geo.mtu.edu/geoschem/docs/putty_install.html
 
== Bind USB to WSL ==
*https://learn.microsoft.com/en-us/windows/wsl/connect-usb
to attach usb devices to wsl you need to add usbipd.
*https://github.com/dorssel/usbipd-win/releases
 
{{console|body=
###i## emerge usbip
}}
 
== using scoop to fetch 7z git etc in powershell. ==
 
i propose that we use https://scoop.sh/ package management for windows in our WSL tutorial.  it cleans things up, and reduces hunting for packages on the web.  it's basically apt/text synaptic for windows powershell in windows mode.
 
*install git & 7z in powershell:
{{console|body=
%PowerShell>% Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
%PowerShell>% Invoke-RestMethod -Uri https://get.scoop.sh {{!}} Invoke-Expression
%PowerShell>% scoop install git
}}
 
now we should be able to pull stage tarballs from git servers also from powershell7z is bundled with git as scoop uses 7z to decompress archives hosted on their git package repos.
 
*to show git man page under powershell:
{{console|body=
%PowerShell>% C:\Users\paul> git
}}
 
*working example of the code shift:
{{console|body=
%PowerShell>% .\scoop\apps\7zip\current\7z.exe x stage3.tar.xz
}}
 
== user setup ==
* setup a privileged user
{{console|body=
###i## useradd funtoo
###i## gpasswd -a funtoo wheel
###i## emerge sudo
###i## echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/wheelnopass
}}
 
* delete hostname process from init so wsl root stays named from windows
{{console|body=
###i## rc-update del hostname boot
}}
 
* set the user to be loaded by default
{{file|name=/etc/wsl.conf|desc=switch user loaded by default|body=
[user]
default=funtoo
}}
 
* restart wsl
 
{{console|body=
%PowerShell>% C:\> wsl --terminate funtoo
}}

Latest revision as of 14:34, April 12, 2024

https://docs.microsoft.com/en-us/windows/wsl/wsl-config

  • copy debian kernel to windows system:

cp /boot/kernel-debian-sources-x86_64-6.4.13_p1-r1 /mnt/c/Users/*your user name*/

https://www.reddit.com/r/bashonubuntuonwindows/comments/141n0c0/instructions_for_using_kernel_63y_on_wsl2_you/

  • gwsl in the microsoft store can run graphical applications that are installed.

Xming uses ssh x11 forwarding to render x11 under windows:

Bind USB to WSL

to attach usb devices to wsl you need to add usbipd.

root # emerge usbip

using scoop to fetch 7z git etc in powershell.

i propose that we use https://scoop.sh/ package management for windows in our WSL tutorial. it cleans things up, and reduces hunting for packages on the web. it's basically apt/text synaptic for windows powershell in windows mode.

  • install git & 7z in powershell:
PowerShell> # Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
PowerShell> # Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
PowerShell> # scoop install git

now we should be able to pull stage tarballs from git servers also from powershell. 7z is bundled with git as scoop uses 7z to decompress archives hosted on their git package repos.

  • to show git man page under powershell:
PowerShell> # C:\Users\paul> git
  • working example of the code shift:
PowerShell> # .\scoop\apps\7zip\current\7z.exe x stage3.tar.xz

user setup

  • setup a privileged user
root # useradd funtoo
root # gpasswd -a funtoo wheel
root # emerge sudo
root # echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/wheelnopass
  • delete hostname process from init so wsl root stays named from windows
root # rc-update del hostname boot
  • set the user to be loaded by default
   /etc/wsl.conf - switch user loaded by default
[user]
default=funtoo
  • restart wsl
PowerShell> # C:\> wsl --terminate funtoo