expoweb/handbook/computing/wsllaptop.html

80 lines
6.0 KiB
HTML
Raw Normal View History

2022-04-01 22:10:31 +01:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CUCC Expedition Handbook: Windows expo laptop</title>
<link rel="stylesheet" type="text/css" href="../../css/main2.css" />
</head>
<body>
<h2 id="tophead">CUCC Expedition Handbook - Computers/WSL</h2>
<h1>WSL on a Windows laptop</h1>
<p>First read the generic instructions for all the software installations you will need:
<br>
<a href="basiclaptop.html">Setting up a basic Expo laptop</a>
<br>
<a href="yourlaptop.html">Setting up a machine for Expo data maintenance</a>
<br>
<a href="winlaptop.html">Setting up a Windows machine for Expo data maintenance</a>
</p>
<h3>WSL1 and WSL2</h3>
<p>WSL now installs as WSL2 by default, but older machines (mostly laptops) may not have the Hyper-V Virtualization hardware and may have to run WSL1.
This is fine: the behaviour is nearly identical so far as an expo laptop is concerned, where you just want to use rsync and scp. An old 2011-era PC has
been doing troggle development happily using WSL1.
<p>For some laptops though, WSL1 does not install properly and you have to use WSL2. The symptom is two error messages when you run <var>dmesg</var> in
the Linux bash terminal window. However, if all you want to use it for is rsync, this may still be fine.
<h3>WSL2 - things to watch for</h3>
<p>On some Windows 10 laptops WSL1 fails to install properly and you have to use WSL2.
<p>When running a full troggle development laptop (see separate <a href="../troggle/troglaptop.html">troggle documentation</a>)
you will want to use <var>python venv</var>. This barfs untidily if you have the code on NTFS, e.g. if mounted on <var>/mnt/c/</var>. You almost
certainly have to move all your code to the internal network share e.g. <var>\\wsl$\Ubuntu-20.04\home\expo\troggle\</var> which
is how it looks when you are browing from Windows.
(No, don't try to be cute and keep it on <var>/mnt/c/</var> and just put a soft link in <var>/home/expo/</var>. That doesn't work either.)
This means that the code is actually living on a Linux <var>ext4</var> filesystem hidden away on your disc where you can only see it using the
'network' method <var>\\wsl$\Ubuntu-20.04\home\expo\troggle\</var>. This means that file access is somewhat faster too but you probably won't notice.
<p>rsync doesn't work with NTFS partitions the way that WSL1 does. See <winlaptop.html>Windows laptop</a> for a bit of detail. [Work in progress.]
2022-04-01 22:10:31 +01:00
<p>Read <a href="https://code.visualstudio.com/blogs/2019/09/03/wsl2">WSL & Visual Studio Code</a> and go back and read the bits about VS Code
running remotely in the &#8251;Windows data maintenance laptop page.
<h3>WSL1 gotchas and tips</h3>
<p>WSL using files on NTFS unfortunately introduces a wonderful new problem of file permissions. Every file on the Windows filesystem NTFS has a set of
permissions managed by the filesystem. Every NTFS file that WSL knows about (if mounted with -o metadata) acquires a completely parallel set of file
permissions that are fundamentally different things and are never in sync in any sense. <a
href="https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/">All sorts of fun</a> results. The alternative is to store all your data
in the \\wsl$\ ext4 filesystem (WSL2 only, not WSL1).
<p>If you are disturbed by the instructions to produce an entirely different key for WSL to use when your PC already has a perfectly good PuTTy key installed on the server, then you are right. It is inelegant. But it works, the instructions are shorter and there are fewer things that go wrong. If you are terribly offended by that then you can set your PC up to use one key shared between WSL and normal-Windows as described in <a href="https://devblogs.microsoft.com/commandline/sharing-ssh-keys-between-windows-and-wsl-2/">this October 2019 article</a>. (Don't set up a password on the key because then you don't need to install keychain.) But beware, this sort of thing goes out of date quite rapidly.
<p>Links to useful articles to help you work this out for yourself:
<ul>
<li><a href="https://www.hanselman.com/blog/CoolWSLWindowsSubsystemForLinuxTipsAndTricksYouOrIDidntKnowWerePossible.aspx">Cool WSL tricks</a> - running Windows commands from WSL environment and running Linux commands from Windows terminal.
<li><a href="https://code.visualstudio.com/blogs/2019/09/03/wsl2">deep integration</a> - Don't use gitforwindows, install the linux git client in WSL2
<li><a href="https://blog.anaisbetts.org/using-github-credentials-in-wsl2/">using-github-credentials-in-wsl2</a> - How to use gitforwindows and WSL to connect to GitHub.
</ul>
<p>When things go wrong when trying to sort this out, you may find these pages useful. I did.
<tt><a href="https://serverfault.com/questions/423075/rsync-failed-to-set-permission-operation-not-permitted">rsync - failed to set permission - operation not permitted</a></tt>
<tt><a href="https://blogs.msdn.microsoft.com/wsl/2017/04/18/file-system-improvements-to-the-windows-subsystem-for-linux/">file-system-improvements-to-the-windows-subsystem-for-linux/</a></tt>
<tt><a href="https://stackoverflow.com/questions/48328446/id-rsa-pub-file-ssh-error-invalid-format">id-rsa-pub-file-ssh-error-invalid-format</a></tt>
<tt><a href="https://stackoverflow.com/questions/42863913/key-load-public-invalid-format">key-load-public-invalid-format</a></tt>
<tt><a href="https://superuser.com/questions/1370877/ssh-error-loading-key-id-rsa-invalid-format">ssh-error-loading-key-id-rsa-invalid-format</a></tt>
<tt><a href="https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/">chmod-chown-wsl-improvements</a></tt>
<tt><a href="https://www.scivision.dev/mount-usb-drives-windows-subsystem-for-linux/">mount-usb-drives-windows-subsystem-for-linux</a></tt>
<tt><a href="https://man.openbsd.org/ssh">ssh command line</a></tt>
<h3>Installing and Configuring the rest of the software you need on Windows</h3>
<p>Now return to &#8251;<a href="winlaptop.html">the Windows data maintenance laptop</a> page to configure all the rest of the software you need.&#8258;
<hr /></body>
2022-04-01 22:10:31 +01:00
</html>