User Tools

Site Tools


windows:linux

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:linux [2019/02/11 13:09] slackwindows:linux [2021/08/13 12:16] (current) – [WSL 2] slack
Line 1: Line 1:
 +====== WSL 2 ======
 +
 +As of 13.8.21, WSL 2 is also available, with a currently more complicated install: https://docs.microsoft.com/en-us/windows/wsl/install-win10
 +
 +WSL 2 uses a virtual machine in order to run the actual Linux kernel, this is meant to improve performance across the board.  Probably best to use this.
 +
 +Resolve issues: as of Aug 2021 the WSL machine can connect to external IPs but not resolve names.
 +
 +Check out /etc/resolv.conf -- you can disable autoupdating, then remove it (it's a symlink) and replace it with something sane (''nameserver 8.8.8.8'' for a start).
 +
 +But that may not help.  This did: https://gist.github.com/sivinnguyen/8bc0125b274250683a97e149cf270040 but it nuked my Windows network settings, which can be reapplied from ''run'' -> ''ncpa.cpl'' For some reason the new Win 10 network settings couldn't change the IP address.
 +
 +Install Windows Terminal from the Windows Store.  Hopefully you have saved a profile at some point or can export it(''settings.json'').
 +====== WSL 1 ======
 +
 [[https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/|HowTo]] [[https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/|HowTo]]
  
Line 7: Line 22:
   * Launch from the start menu   * Launch from the start menu
   * [[stretch:basics|Stretch basics]]   * [[stretch:basics|Stretch basics]]
 +  * Fix [[https://superuser.com/questions/1195962/cannot-make-directory-var-run-screen-permission-denied|screen]]:
 +
 +
 +The directory ''/var/run/screen/'' is the socket directory for screen.
 +
 +Fortunately, screen reads a environment variable ''SCREENDIR'' to get an alternative socket directory.
 +
 +So to work around it, you can create a directory, such as ''~/.screen'':
 +
 +''mkdir ~/.screen && chmod 700 ~/.screen''
 +
 +and export the ''SCREENDIR'' to point to that directory:
 +
 +''export SCREENDIR=$HOME/.screen''
 +
 +You can also put this line into your ''~/.bashrc'' so that it will also take effect afterwards.
 +
 +
 +====== Samba ======
 +
 +You can't automatically access Windows network drives, even if they are mapped to a letter (20.6.20).
 +
 +''/etc/fstab'':
 +
 +    \\alan\huge  /mnt/ drvfs  user,uid=1000,gid=1000  0  0
 +
 +This ought to automount when WSL is fired up, but something[TM] needs to start it if you want to run ''rsync'' from ''cron''.
 +
 +====== cron ======
 +
 +Add to the end of ''/etc/sudoers'':
 +
 +    %sudo   ALL=NOPASSWD: /etc/init.d/cron start
 +
 +Roughly, follow https://blog.snowme34.com/post/schedule-tasks-using-crontab-on-windows-10-with-wsl/index.html although I think there was a lot of fighting to create the link:
 +
 +    Next, type shell:startup in the Run and explorer will open the startup folder.
 +
 +    Create a shortcut to wsl.exe and edit the properties as following:
 +
 +    C:\Windows\System32\wsl.exe sudo /etc/init.d/cron start
windows/linux.1549890589.txt.gz · Last modified: 2019/11/07 17:58 (external edit)