This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
other:win10wsl [2020/01/22 10:39] jypeter [Location of the files] |
other:win10wsl [2020/04/27 10:51] jypeter Link to WIn10 notes |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Windows Subsystem for Linux (WSL), and Ubuntu ====== | ====== Windows Subsystem for Linux (WSL), and Ubuntu ====== | ||
- | <note warning>What is described on this page was tested with **WSL v1**, and not WSL2 (WSL2 will be available for testing mid-2019, and maybe available for actual use in 2020). It should be possible to install both WSL v1 and v2 on the same computer and WSL v2 will theoretically have faster I/O, but we recommend you use WSL v1 for now</note> | + | [[other:index#windows_10_notes|Other Windows 10 related notes]] |
+ | |||
+ | <note warning>What is described on this page was tested with **WSL v1**, and not WSL 2 ([[https://docs.microsoft.com/en-us/windows/wsl/wsl2-index|WSL 2]] will be available for testing mid-2019 through the //Windows Insider Program//, and maybe available for actual use in 2020). | ||
+ | |||
+ | It should be possible to install both WSL v1 and v2 on the same computer and WSL v2 will theoretically have faster I/O, but **we recommend you use WSL v1 for now**</note> | ||
Read just the top of the [[https://docs.microsoft.com/en-us/windows/wsl/about|Windows Subsystem for Linux Documentation]] for a quick **WSL** description on the Microsoft site | Read just the top of the [[https://docs.microsoft.com/en-us/windows/wsl/about|Windows Subsystem for Linux Documentation]] for a quick **WSL** description on the Microsoft site | ||
Line 15: | Line 19: | ||
* Note: there is sometimes a delay between the official release and the time when Windows Update will actually tell you that a major update is available for **your** computer (e.g. the //September YY09// update may become available for you only in December) | * Note: there is sometimes a delay between the official release and the time when Windows Update will actually tell you that a major update is available for **your** computer (e.g. the //September YY09// update may become available for you only in December) | ||
* //Enough// space on ''C:\''. Microsoft instructions say //The Windows Subsystem for Linux only runs on your system drive (usually this is your C: drive)// | * //Enough// space on ''C:\''. Microsoft instructions say //The Windows Subsystem for Linux only runs on your system drive (usually this is your C: drive)// | ||
- | * The initial installation of Ubuntu does not //seem// to use much disk space (< 1 Gb), but you will get a basic Linux with no graphics, and you will probably need space for installing more applications | + | * Exporting a //simple// Ubuntu configuration (after doing everything from //Base installation// to //Advanced configuration// below) with the [[other:win10wsl#creating_a_backup_of_the_linux_running_in_wsl|wsl --export]] command generated a 2.7 Gb tar file (uncompressed), so it's probably good to **start with at least 3 Gb of free space on ''C:\''** (and you always need to keep enough free space on ''C:\'' for regular Windows operation) |
* The Linux ''/'' and ''/home'' partitions will always be on ''C:'', but the data files can be on any Windows disk/partition (or external drive) of the computer | * The Linux ''/'' and ''/home'' partitions will always be on ''C:'', but the data files can be on any Windows disk/partition (or external drive) of the computer | ||
* the Windows partitions will be available and accessible in ''/mnt/'', so you can store data on other partitions (e.g. the content of the Windows ''D:\'' partition will be available in ''/mnt/d'' in Linux) | * the Windows partitions will be available and accessible in ''/mnt/'', so you can store data on other partitions (e.g. the content of the Windows ''D:\'' partition will be available in ''/mnt/d'' in Linux) | ||
Line 21: | Line 25: | ||
* Checking the properties of ''C:\Users\<your_login>'' will **not** report an accurate size and number of files, because lots of files and directories are hidden! On the test laptop, the reported size of the user backed up directory (with [[other:win10apps#syncbackfree|SyncBackFree]]) was ~20 Gb (user data, WSL+Ubuntu, custom install of the CDAT 8.1 python distribution) | * Checking the properties of ''C:\Users\<your_login>'' will **not** report an accurate size and number of files, because lots of files and directories are hidden! On the test laptop, the reported size of the user backed up directory (with [[other:win10apps#syncbackfree|SyncBackFree]]) was ~20 Gb (user data, WSL+Ubuntu, custom install of the CDAT 8.1 python distribution) | ||
* Be sure to monitor the remaining free space on ''C:''! | * Be sure to monitor the remaining free space on ''C:''! | ||
+ | * Note: it seems that [[other:win10wsl#restoring_a_wsl_backup|wsl --import]] can restore a backed-up Linux to a user specified location. Maybe this can be used for moving Ubuntu... | ||
===== Base installation ===== | ===== Base installation ===== | ||
Line 28: | Line 33: | ||
* Follow **closely** the steps listed in [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|WSL Windows 10 Installation Guide]]. <wrap hi>Open this [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|WSL Windows 10 Installation Guide]] in another window, so that you can **read the useful hints below at the same time!**</wrap> | * Follow **closely** the steps listed in [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|WSL Windows 10 Installation Guide]]. <wrap hi>Open this [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|WSL Windows 10 Installation Guide]] in another window, so that you can **read the useful hints below at the same time!**</wrap> | ||
* When you have to //Open PowerShell as Administrator//, go to ''Start''=>''W''=>''Windows PowerShell'' then right-clik on ''Windows PowerShell'' and select //Run as Administrator// | * When you have to //Open PowerShell as Administrator//, go to ''Start''=>''W''=>''Windows PowerShell'' then right-clik on ''Windows PowerShell'' and select //Run as Administrator// | ||
+ | * FIXME At this stage, we could try to restore/clone a previously installed/customized/backed-up version of Ubuntu if we have one (see [[other:win10wsl#restoring_a_wsl_backup|Restoring a WSL backup]]) | ||
* In the //Install your Linux Distribution of Choice//, we will use the very easy //install from the Microsoft Store// option | * In the //Install your Linux Distribution of Choice//, we will use the very easy //install from the Microsoft Store// option | ||
* Open the **Microsoft Store** with: ''Start''=>''Microsoft Store'' | * Open the **Microsoft Store** with: ''Start''=>''Microsoft Store'' | ||
Line 124: | Line 130: | ||
=== Linux files seen from Windows === | === Linux files seen from Windows === | ||
- | You can access the Linux files in ''/'' from Windows by opening the ''\\wsl$'' path in the Windows explorer (since [[https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-18342|Windows build 18342]]) | + | * You can access the Linux files in ''/'' from Windows by opening the //virtual// ''\\wsl$'' path in the Windows explorer (since [[https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-18342|Windows build 18342]]) |
+ | * Your Linux //home// directory is located in ''\\wsl$\Ubuntu\home\<your_login>'' | ||
- | The content of the Ubuntu ''/'' directory is actually located in the following //hidden// sub-directory of the user's Windows //home// directory: ''C:\Users\<your_login>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs'' | + | * The content of the Ubuntu ''/'' directory is actually located in the following //hidden// sub-directory of the user's Windows //home// directory: ''C:\Users\<your_login>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs'' |
- | <note important>[[https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/|Do not change Linux files in '/' from Windows!]] (it's safe only if you use the ''\\wsl$'' path) | + | <note important>[[https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/|Do not change Linux files in '/' from Windows!]] (it's safe **only** if you use the ''\\wsl$'' path) |
- | If you need to update files from both Linux and Windows, put them in a regular Windows directory (not in the hidden directory mentioned above, where the Linux system is installed)</note> | + | If you need to easily update files from both Linux and Windows, put them in a regular Windows directory (not in the hidden directory mentioned above, where the Linux system is installed)</note> |
=== Windows files seen from Linux === | === Windows files seen from Linux === | ||
Line 156: | Line 163: | ||
==== Linux version installed ==== | ==== Linux version installed ==== | ||
- | <code>$ lsb_release -a | + | <code>$ date |
+ | Thu Feb 20 11:18:57 CET 2020 | ||
+ | |||
+ | $ lsb_release -a | ||
No LSB modules are available. | No LSB modules are available. | ||
Distributor ID: Ubuntu | Distributor ID: Ubuntu | ||
- | Description: Ubuntu 18.04.3 LTS | + | Description: Ubuntu 18.04.4 LTS |
Release: 18.04 | Release: 18.04 | ||
Codename: bionic | Codename: bionic | ||
Line 268: | Line 278: | ||
</code> | </code> | ||
- | === Installing an X server === | + | ==== Installing an X server ==== |
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
Line 276: | Line 286: | ||
</WRAP> | </WRAP> | ||
- | == Installing VcXrsv == | + | === Installing VcXrsv === |
<note tip>VcXrsv is pre-installed on the LSCE computers!</note> | <note tip>VcXrsv is pre-installed on the LSCE computers!</note> | ||
Line 284: | Line 294: | ||
Download the installer from [[https://sourceforge.net/projects/vcxsrv/|VcXrsv]] | Download the installer from [[https://sourceforge.net/projects/vcxsrv/|VcXrsv]] | ||
- | **VcXrsv Configuration** | + | == VcXrsv Configuration == |
You need to configure your VcXrsv to work in multiple windows mode. The following steps will show you how to create a shortcut on your desktop to start VcXrsv in the apropriate mode | You need to configure your VcXrsv to work in multiple windows mode. The following steps will show you how to create a shortcut on your desktop to start VcXrsv in the apropriate mode | ||
Line 301: | Line 311: | ||
- | == Installing x410 == | + | === Installing x410 === |
Type: <wrap em>commercial</wrap> | Type: <wrap em>commercial</wrap> | ||
Line 311: | Line 321: | ||
* You can configure (and exit) X410 by right clicking on its **X** icon | * You can configure (and exit) X410 by right clicking on its **X** icon | ||
- | == Installing MobaXterm == | + | === Installing MobaXterm === |
Type: <wrap em>commercial</wrap> | Type: <wrap em>commercial</wrap> | ||
Line 317: | Line 327: | ||
Available at [[https://mobaxterm.mobatek.net/|MobaXterm]], not tested. This seems to be more than just an X server, and may be an overkill if you just need an X server | Available at [[https://mobaxterm.mobatek.net/|MobaXterm]], not tested. This seems to be more than just an X server, and may be an overkill if you just need an X server | ||
- | === Configuration (in your local Linux account) === | + | ==== Configuration (in your local Linux account) ==== |
* Set the DISPLAY variable in the shell (by hand, or in the bash shell init file) | * Set the DISPLAY variable in the shell (by hand, or in the bash shell init file) | ||
Line 326: | Line 336: | ||
* it breaks ''glxgears'' with x410 | * it breaks ''glxgears'' with x410 | ||
- | === Resources === | + | ==== Resources ==== |
You can skip this! m( | You can skip this! m( | ||
Line 627: | Line 637: | ||
WSL can be rebooted (all the terminals and processed will be closed/killed) by restarting the //WSL service// (''LxssManager'') | WSL can be rebooted (all the terminals and processed will be closed/killed) by restarting the //WSL service// (''LxssManager'') | ||
- | * from a //Windows PowerShell// (no need to run as administrator):\\ type ''wsl --terminate Ubuntu'' | + | * from a //Windows PowerShell// (no need to run as administrator):\\ type ''wsl %%--%%terminate Ubuntu'' |
* from the //Services// tab of the Task manager or the //Services// program (launch ''services.msc'') | * from the //Services// tab of the Task manager or the //Services// program (launch ''services.msc'') | ||
* Right-click on the ''LxssManager'' service and select //Restart// | * Right-click on the ''LxssManager'' service and select //Restart// | ||
Line 664: | Line 674: | ||
FIXME Read [[https://www.howtogeek.com/426562/how-to-export-and-import-your-linux-systems-on-windows-10/|How to Export and Import Your Linux Systems on Windows 10]] and [[https://winaero.com/blog/export-import-wsl-linux-distro-windows-10/|Export and Import WSL Linux Distro in Windows 10]] and similar threads | FIXME Read [[https://www.howtogeek.com/426562/how-to-export-and-import-your-linux-systems-on-windows-10/|How to Export and Import Your Linux Systems on Windows 10]] and [[https://winaero.com/blog/export-import-wsl-linux-distro-windows-10/|Export and Import WSL Linux Distro in Windows 10]] and similar threads | ||
+ | |||
+ | FIXME Check if [[https://wslhub.com/|WSL Manager]] is maintained and can be useful | ||
This assumes that you have followed the steps above to create a full backup of your Linux distribution in a ''ubuntu_<your_login>_<some_date>.tar'' file. This file can theoretically be restored with: | This assumes that you have followed the steps above to create a full backup of your Linux distribution in a ''ubuntu_<your_login>_<some_date>.tar'' file. This file can theoretically be restored with: | ||
* ''wsl %%--%%import <DistributionName> <InstallLocation> ubuntu_<your_login>_<some_date>.tar'' | * ''wsl %%--%%import <DistributionName> <InstallLocation> ubuntu_<your_login>_<some_date>.tar'' | ||
+ | * Note: found a page mentioning that you should be in a terminal with admin rights when using ''%%--%%import'' | ||
* Can we use the same ''<DistributionName>'' (e.g. ''Ubuntu'') as the one we are trying to restore without first removing it with ''unregister'' ([[https://docs.microsoft.com/en-us/windows/wsl/wsl-config#unregister-and-reinstall-a-distribution|Unregister and reinstall a distribution]])? | * Can we use the same ''<DistributionName>'' (e.g. ''Ubuntu'') as the one we are trying to restore without first removing it with ''unregister'' ([[https://docs.microsoft.com/en-us/windows/wsl/wsl-config#unregister-and-reinstall-a-distribution|Unregister and reinstall a distribution]])? | ||
* If we use a new distribution name, it will probably not appear anymore in the Microsoft Store and will not be updated. Is this a problem? | * If we use a new distribution name, it will probably not appear anymore in the Microsoft Store and will not be updated. Is this a problem? | ||
Line 682: | Line 695: | ||
* and then disable WSL??? | * and then disable WSL??? | ||
===== Other WSL resources and links ===== | ===== Other WSL resources and links ===== | ||
+ | |||
+ | * [[https://docs.microsoft.com/en-us/windows/wsl/release-notes|Release Notes for Windows Subsystem for Linux]] | ||
* [[https://docs.microsoft.com/en-us/windows/wsl/faq|Frequently Asked Questions]] | * [[https://docs.microsoft.com/en-us/windows/wsl/faq|Frequently Asked Questions]] |