User Tools

Site Tools


other:win10wsl

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
other:win10wsl [2020/01/16 17:46]
jypeter [Get configuration files]
other:win10wsl [2020/01/21 18:12] (current)
jypeter [Restoring a WSL backup]
Line 248: Line 248:
 /​usr/​bin/​wslview /​usr/​bin/​wslview
 [...]</​code>​ [...]</​code>​
 +
 ==== Using an X server ==== ==== Using an X server ====
  
Line 388: Line 389:
 ===== Advanced configuration ===== ===== Advanced configuration =====
  
-==== Get configuration files ====+==== Get Linux configuration files ====
  
-  * You can either ​use your existing Linux configuration files, or download some example files in your WSL home directory and use (and improve) them as directed ​(or as you wish)+  * You can either ​adapt your existing Linux configuration files (''​.profile'',​ ''​.bashrc'',​ ...) from another Linux computer, or download some example files in your WSL home directory and use (and improve) them as suggested below (or as you wish)
     * <​code>​$ cd     * <​code>​$ cd
 $ scp -pr <​your_login>​@ssh1.lsce.ipsl.fr:/​home/​users/​jypeter/​WSL_config .</​code>​ $ scp -pr <​your_login>​@ssh1.lsce.ipsl.fr:/​home/​users/​jypeter/​WSL_config .</​code>​
     * You get a default ''​.bashrc''​ file in your home directory when your WSL account is created. Add the following line at the end of ''​~/​.bashrc''​ to use what is defined in the downloaded ''​WSL_config''​ directory:​\\ ''​source ~/​WSL_config/​bashrc_extra.sh''​     * You get a default ''​.bashrc''​ file in your home directory when your WSL account is created. Add the following line at the end of ''​~/​.bashrc''​ to use what is defined in the downloaded ''​WSL_config''​ directory:​\\ ''​source ~/​WSL_config/​bashrc_extra.sh''​
 +    * If you use the //emacs// text editor, you can use your own ''​.emacs''​ configuration file, or get an example configuration file the following way:
 +      * <​code>​$ cd
 +$ ln -s WSL_config/​emacs .emacs</​code>​
 +      * Font configuration (type, size, ...): FIXME
   * You can either copy the full ''​.ssh''​ directory of your Linux account, or just get the //private key// files:   * You can either copy the full ''​.ssh''​ directory of your Linux account, or just get the //private key// files:
     * <​code>​$ cd     * <​code>​$ cd
-$ scp -pr your_login@ssh1.lsce.ipsl.fr:​.ssh .</​code>​ +$ scp -pr <your_login>@ssh1.lsce.ipsl.fr:​.ssh .</​code>​ 
-    * Make sure you also read the [[other:​win10wsl#​ssh_agent_and_keys_related_questions|ssh,​ agent and keys related questions]] section!+    * Make sure you **also** read the [[other:​win10wsl#​ssh_agent_and_keys_related_questions|ssh,​ agent and keys related questions]] section ​below! 
 ==== ssh, agent and keys related questions ==== ==== ssh, agent and keys related questions ====
  
Line 406: Line 412:
 == Authorizing ssh to use old dsa keys == == Authorizing ssh to use old dsa keys ==
  
-//dsa// ssh keys are disabled by default (becoming obsolete). ''​ssh''​ will ask for your password even if you have a ''​~/​.ssh/​id_dsa''​ file. ''​ssh -v''​ will print ''​Skipping ssh-dss key /home/jyp/​.ssh/​id_dsa - not in PubkeyAcceptedKeyTypes''​. The solution is to use the user config file to authorize dsa ([[https://​unix.stackexchange.com/​a/​247614|source]]) +//dsa// ssh keys are disabled by default (becoming obsolete). ''​ssh''​ will ask for your password even if you have a ''​~/​.ssh/​id_dsa''​ file. ''​ssh -v''​ will print ''​Skipping ssh-dss key /home/<​your_login>​/​.ssh/​id_dsa - not in PubkeyAcceptedKeyTypes''​. The solution is to generate a new couple of public/​private keys not based on //dsa// encryption, or to use the user ssh ''​config'' ​file to authorize ​//dsa// ([[https://​unix.stackexchange.com/​a/​247614|source]]) 
-    * Add ''​PubkeyAcceptedKeyTypes +ssh-dss''​ to ''​~/​.ssh/​config''​+    * Add ''​PubkeyAcceptedKeyTypes +ssh-dss''​ to ''​~/​.ssh/​config'' ​(**before** the ''​HOST''​ sections)
     * Make sure the config file has the correct access rights: ''​chmod 600 config''​     * Make sure the config file has the correct access rights: ''​chmod 600 config''​
  
 == Using Putty Pageant as an ssh agent == == Using Putty Pageant as an ssh agent ==
  
-This assumes that you have converted your private ssh key with ''​PuTTYgen''​ and unlocked ​it in Pageant+This assumes that you have installed the full [[other:​win10apps#​putty_pageant|Putty]] package (with the //msi// installer), ​converted your private ssh key with ''​PuTTYgen''​and unlocked ​the converted ssh private key in Pageant
 + 
 +<wrap hi>The converted ssh private key is located in a Windows 10 folder</​wrap>​
  
   * Download the required binaries from the [[https://​github.com/​vuori/​weasel-pageant|weasel-pageant github page]] and extract them to a Windows directory, e.g. ''​C:​\Utils\weasel-pageant-x.x''​   * Download the required binaries from the [[https://​github.com/​vuori/​weasel-pageant|weasel-pageant github page]] and extract them to a Windows directory, e.g. ''​C:​\Utils\weasel-pageant-x.x''​
-  * Add the following line to your ''​~/​.bashrc''​ file:\\ ''​eval $(C:\Utils\weasel-pageant-x.x/​weasel-pageant -rb -a $HOME/​.weasel-pageant.sock)''​+  * Add the following line to your ''​~/​.bashrc''​ file:\\ ''​eval $(/mnt/c/Utils/weasel-pageant-x.x/​weasel-pageant -rb -a $HOME/​.weasel-pageant.sock)''​ 
 +      * This is done by default in the ''​~/​WSL_config/​bashrc_extra.sh''​ if you have downloaded and adapted it
   * Open a new terminal:   * Open a new terminal:
     * Type ''​ssh-add -l'':​ it will display either ''​The agent has no identities'',​ or as many lines as you have entered keys in Pageant     * Type ''​ssh-add -l'':​ it will display either ''​The agent has no identities'',​ or as many lines as you have entered keys in Pageant
Line 424: Line 433:
 == Using Ubuntu as an ssh-agent == == Using Ubuntu as an ssh-agent ==
  
-We **do not use this** now, because ​there will be one running ssh-agent per terminal, and the key is stored ​only for the current ​terminal ​+<wrap hi>The ssh key (and other ssh settings) are in the ''​~/​.ssh''​ directory of your WSL+Ubuntu account</​wrap>​ 
 + 
 +This is the most simple setting, ​**but** there will be one running ​//ssh-agent// per terminal, and the key will be stored ​independently ​for each terminal (which means that you will have to type ''​ssh-add''​ and your pass-phrase for each terminal)
  
-  * It's not possible to add a key to ssh-agent'​ssh-add'​ will print ''​Could not open a connection to your authentication agent''​ +  * It's not possible ​by default ​to add a key to ssh-agent ​('​ssh-add'​ will print ''​Could not open a connection to your authentication agent''​) 
-    * type ''​eval `ssh-agent -s`''​ (or ''​eval $(ssh-agent)''​) ​before using ''​ssh-add''​+  If you want to use ''​ssh-add''​ in a terminal, you first need to type ''​eval `ssh-agent -s`'' ​in the (or ''​eval $(ssh-agent)''​) 
 +    * In that case, it's just easier to add ''eval $(ssh-agent)''​ to the ''​.bashrc''​ file! 
 +      * This is done by default in the ''​~/​WSL_config/​bashrc_extra.sh'' ​if you have downloaded and adapted it
  
 == Notes & TODO == == Notes & TODO ==
Line 438: Line 451:
 FIXME FIXME
  
-Need to find way to ssh from the Win10 part of the machine to the WSL part, and from outside the machine to the WSL part+Maybe it could be useful ​to do ''​ssh'' ​from the Win10 part of the machine to the WSL part, and from outside the machine to the WSL part
  
 It would probably already be enough to enable the ssh server on Win10 (the [[https://​devblogs.microsoft.com/​powershell/​using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709/​|ssh 1709 release beta features]] are now officially in Win10) It would probably already be enough to enable the ssh server on Win10 (the [[https://​devblogs.microsoft.com/​powershell/​using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709/​|ssh 1709 release beta features]] are now officially in Win10)
Line 451: Line 464:
  
   * Install [[https://​github.com/​wslutilities/​wslu|wslu]] (A collection of utilities for WSL) if it is not already installed   * Install [[https://​github.com/​wslutilities/​wslu|wslu]] (A collection of utilities for WSL) if it is not already installed
-    * ''​aptget ​install wslu''​+    * ''​apt-get ​install wslu''​
   * Have a quick look at the wslu [[https://​github.com/​wslutilities/​wslu|github]] page and [[https://​github.com/​wslutilities/​wslu/​wiki|wiki]] to find about the available tools (that you may need later)   * Have a quick look at the wslu [[https://​github.com/​wslutilities/​wslu|github]] page and [[https://​github.com/​wslutilities/​wslu/​wiki|wiki]] to find about the available tools (that you may need later)
-  * Create ​a shortcut ​(e.g. to emacs) with: ''​wslusc -g emacs''​+  * You can create ​a shortcut ​by using ''​wslusc''​ in any Linux terminal 
 +    * e.g. you can create a shortcut on the Windows desktop ​to start emacs (in WSL!) with:\\ ''​wslusc -g emacs''​ 
 +      * This will make it easier to start emacs, but since this is a graphical Linux application,​ **you need to have an X server running before you click on the emacs shortcut**!
   * You can optionally get some information about the [[https://​github.com/​Microsoft/​WSL/​issues/​3404|technical details]]   * You can optionally get some information about the [[https://​github.com/​Microsoft/​WSL/​issues/​3404|technical details]]
  
-==== emacs configuration ==== 
- 
-  * [[other:​win10wsl#​get_configuration_files|Get configuration files]] 
-  * Use the provided emacs configuration file (or your own): 
-    * <​code>​$ cd 
-$ ln -s WSL_config/​emacs .emacs</​code>​ 
-  * Use ''​wslusc''​ to create a shortcut to **emacs** **on your Windows desktop**:​\\ ''​wslusc -g emacs''​ 
-    * This will make it easier to start emacs, but since this is a graphical Linux application,​ you need to have an X server running before you click on the shortcut! 
 ==== Mounting disks and network drives ==== ==== Mounting disks and network drives ====
  
-By default, the local disks and the external USB disks available (and decrypted!) when the first WSL terminal is opened are automatically available (//​mounted//​) in ''/​mnt''​ : the content of ''​C:​\''​ is available in ''/​mnt/​c'',​ etc... The list is refreshed when Windows (or just WSLis rebooted ​.+By default, the local disks and the external USB disks available (and decrypted!) ​when WSL is started (i.e. when the first WSL terminal is openedare automatically available (//​mounted//​) in ''/​mnt''​ : the content of ''​C:​\''​ is available in ''/​mnt/​c'',​ etc... The list of available disks is refreshed when the Windows ​session is restarted ​(the user logs out and in, or Windows is rebooted) or when just [[other:​win10wsl#​rebooting_wsl|WSL is restarted]].
  
 Extra local disks or //network drives// (what you can access by opening ''​\\dfshost\dfs\''​ in the file explorer when you are on the LSCE network) can be either mounted on the fly with the ''​mount''​ command, or automatically by configuring the ''/​etc/​fstab''​ file. Extra local disks or //network drives// (what you can access by opening ''​\\dfshost\dfs\''​ in the file explorer when you are on the LSCE network) can be either mounted on the fly with the ''​mount''​ command, or automatically by configuring the ''/​etc/​fstab''​ file.
Line 473: Line 480:
  
 <wrap hi>​Warning!</​wrap>​ In all cases, the owner, groups and permissions displayed may not be accurate (but the actual access rights will apply). <wrap hi>​Warning!</​wrap>​ In all cases, the owner, groups and permissions displayed may not be accurate (but the actual access rights will apply).
-  * the user/group of the files may appear as ''​your_login''/''​your_login''​ or ''​root''/''​root''​ +  * the user/group of the files may appear as ''​your_login''/''​your_login''​ or ''​root''/''​root''​. Example of a local file belonging to the current Windows //jypeter// user, and a system file 
-  * the access rights may appear as ''​rwxrwxrwx''​ even if the actual rights are more restrictive +    * <​code>​$ ls -l /​mnt/​c/​Users/​jypeter/​Desktop/​File_on_Desktop.txt 
-  more details in the //metadata// section+-rwxrwxrwx 1 jypeter jypeter 0 Jan 21 11:50 /​mnt/​c/​Users/​jypeter/​Desktop/​File_on_Desktop.txt 
 + 
 +$ ls -l /​mnt/​c/​Windows/​notepad.exe 
 +-r-xr-xr-x 3 jypeter jypeter 181248 Mar 19  2019 /​mnt/​c/​Windows/​notepad.exe 
 +</​code>​ 
 +  * the access rights may appear as ''​rwxrwxrwx''​ even if the actual rights are more restrictive. Example after mounting the LSCE ''/​home/​scratch01''​ disk 
 +    <​code>#​ File access rights seen from WSL+Ubuntu 
 +$ ls -l /​mnt/​scratch01/​jypeter/​Chrome_backup.zip 
 +-rwxrwxrwx 1 root root 2755154 Jan 13 15:10 /​mnt/​scratch01/​jypeter/​Chrome_backup.zip 
 + 
 +# Actual access rights (on the Linux server) 
 +>ls -l /home/scratch01/jypeter/​Chrome_backup.zip 
 +-rw-r--r-- 1 jypeter lsce 2755154 Jan 13 15:10 /​home/​scratch01/​jypeter/​Chrome_backup.zip 
 + 
 +# You can't change the access rights from WSL+Ubuntu, but you can remove a file, or create a new one 
 +$ chmod 600 /​mnt/​scratch01/​jypeter/​Chrome_backup.zip 
 +chmod: changing permissions of '/​mnt/​scratch01/​jypeter/​Chrome_backup.zip':​ Operation not permitted 
 +$ rm /​mnt/​scratch01/​jypeter/​Chrome_backup.zip 
 +$ ls -l /​mnt/​scratch01/​jypeter/​Chrome_backup.zip 
 +ls: cannot access '/​mnt/​scratch01/​jypeter/​Chrome_backup.zip':​ No such file or directory 
 + 
 +$ touch /​mnt/​scratch01/​jypeter/​new_file_from_wsl.txt 
 +jypeter@lsce5203:/​mnt/​scratch01/​jypeter$ ls -l /​mnt/​scratch01/​jypeter/​new_file_from_wsl.txt 
 +-rwxrwxrwx 1 root root 0 Jan 21 11:37 /​mnt/​scratch01/​jypeter/​new_file_from_wsl.txt 
 + 
 +# The new file has the correct (default) access rights on the Linux server 
 +>ls -l /​home/​scratch01/​jypeter/​new_file_from_wsl.txt 
 +-rw-r--r-- 1 jypeter lsce 0 Jan 21 11:37 /​home/​scratch01/​jypeter/​new_file_from_wsl.txt 
 +</code>
  
 === Enabling metadata === === Enabling metadata ===
  
-Some access rights handling can be partially corrected ​by automatically enabling the ''​metadata''​ mount option. This will allow you to use ''​chmod''/''​chown''​ on local NTFS disks (e.g. ''/​mnt/​c/​Users/​your_login''​). ​''​sudo -s''​ and then create a ''/​etc/​wsl.conf''​ with the following content:+Some access rights handling can be slightly improved ​by automatically enabling the ''​metadata''​ mount option. This will allow you to use ''​chmod''/''​chown''​ on **local NTFS disks** (disks directly connected to your computer, ​e.g. ''/​mnt/​c/​Users/​your_login''​).
  
-<​code>​[automount]+  - become //root// in a terminal with: ''​sudo -s''​ 
 +  - create a ''/​etc/​wsl.conf''​ with the following content:<​code>​[automount]
 options = "​metadata"</​code>​ options = "​metadata"</​code>​
  
 You need to [[other:​win10wsl#​rebooting_wsl|restart WSL+ubuntu]] to activate the new content of ''/​etc/​wsl.conf''​. See below an example of the ''​mount -l''​ output: You need to [[other:​win10wsl#​rebooting_wsl|restart WSL+ubuntu]] to activate the new content of ''/​etc/​wsl.conf''​. See below an example of the ''​mount -l''​ output:
   * Before: ''​C:​ on /mnt/c type drvfs (rw,​noatime,​uid=1000,​gid=1000,​case=off)''​   * Before: ''​C:​ on /mnt/c type drvfs (rw,​noatime,​uid=1000,​gid=1000,​case=off)''​
-  * After: ''​C:​ on /mnt/c type drvfs (rw,​noatime,​uid=1000,​gid=1000,​metadata,​case=off)''​+  * After enabling //​metadata//​: ''​C:​ on /mnt/c type drvfs (rw,​noatime,​uid=1000,​gid=1000,​metadata,​case=off)''​
  
 Optional: more details about [[https://​devblogs.microsoft.com/​commandline/​automatically-configuring-wsl/​|wsl.conf]] and [[https://​devblogs.microsoft.com/​commandline/​chmod-chown-wsl-improvements/​|metadata and access rights management]] Optional: more details about [[https://​devblogs.microsoft.com/​commandline/​automatically-configuring-wsl/​|wsl.conf]] and [[https://​devblogs.microsoft.com/​commandline/​chmod-chown-wsl-improvements/​|metadata and access rights management]]
Line 494: Line 530:
 You have to create a //mount point// in the existing ''/​mnt''​ directory and then use the ''​mount''​ command You have to create a //mount point// in the existing ''/​mnt''​ directory and then use the ''​mount''​ command
  
-<​code>​$ sudo -s+<​code>​# Must be root for most '​mount'​ related commands 
 +$ sudo -s
  
-# Create the mount point (once)+# Create the mount point (once), e.g. for accessing /​home/​scratch01 on the local LSCE servers 
 +# This works when the Windows 10 computer is on the LSCE network
 $ mkdir /​mnt/​scratch01 $ mkdir /​mnt/​scratch01
  
 # Mount the remote disk # Mount the remote disk
 $ mount -t drvfs '​\\dfshost\dfs\scratch01'​ /​mnt/​scratch01 $ mount -t drvfs '​\\dfshost\dfs\scratch01'​ /​mnt/​scratch01
 +
 +# List the mounted disks
 +$ mount -l
 +[...]
 +\\dfshost\dfs\scratch01 on /​mnt/​scratch01 type drvfs (rw,​relatime,​case=off)
  
 # Unmount the disk, or just shutdown Windows or WSL when you are finished # Unmount the disk, or just shutdown Windows or WSL when you are finished
Line 527: Line 570:
  
 # Create the mount points (once) # Create the mount points (once)
-$ mkdir /mnt/home_jyp ​/mnt/scratch_jyp+# The example below is to access the LSCE /home/users and /​home/​scrath01 disks 
 +$ mkdir /mnt/users /mnt/scratch01
  
-# Make a backup copy of /etc/fstab+# Make a backup copy of /​etc/​fstab ​before modifying it (for safety reasons!)
 $ cp -p /etc/fstab /​etc/​fstab.bak $ cp -p /etc/fstab /​etc/​fstab.bak
  
Line 535: Line 579:
 $ cat /etc/fstab $ cat /etc/fstab
 LABEL=cloudimg-rootfs ​  / ​       ext4   ​defaults ​       0 0 LABEL=cloudimg-rootfs ​  / ​       ext4   ​defaults ​       0 0
-\\dfshost\dfs\users\jyp /mnt/home_jyp ​drvfs defaults 0 0 +\\dfshost\dfs\users /mnt/users drvfs defaults 0 0 
-\\dfshost\dfs\scratch01\jyp /mnt/scratch_jyp ​drvfs defaults 0 0+\\dfshost\dfs\scratch01 /mnt/scratch01 ​drvfs defaults 0 0
  
 # Try to mount all the disks in /etc/fstab # Try to mount all the disks in /etc/fstab
-$ mount -a</​code>​+$ mount -a
  
-=== Resources ​===+# Check the result 
 +$ mount -l 
 +[...] 
 +\\dfshost\dfs\users on /mnt/users type drvfs (rw,​relatime,​case=off) 
 +\\dfshost\dfs\scratch01 on /​mnt/​scratch01 type drvfs (rw,​relatime,​case=off) 
 +</​code>​ 
 + 
 +=== Accessing remote file systems with sshfs === 
 + 
 +FIXME 
 + 
 +It seems this can be done with a combination of [[https://​github.com/​billziss-gh/​winfsp|WinFsp]] and [[https://​github.com/​billziss-gh/​sshfs-win|SSHFS-Win]] (see [[https://​superuser.com/​questions/​1423371/​sshfs-remote-directory-mounting-syntax|SSHFS remote directory mounting syntax]] for details 
 + 
 +=== Extra resources ​===
  
 Useful ''​mount''​ options: Useful ''​mount''​ options:
Line 566: Line 623:
  
 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 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 573: Line 631:
 Source: google ''​wsl lxssmanager''​ ([[https://​www.how2shout.com/​how-to/​how-to-reboot-wsl-windows-subsystem-linux-in-windows-10.html|most usable answer]]) Source: google ''​wsl lxssmanager''​ ([[https://​www.how2shout.com/​how-to/​how-to-reboot-wsl-windows-subsystem-linux-in-windows-10.html|most usable answer]])
  
-==== Creating a backup ====+==== Creating a backup of the Linux running in WSL ==== 
 + 
 +There are several types of directories that you may want to back up: 
 +  * Your //home// directory in Linux (''/​home/<​your_login>''​),​ or some specific sub-directories of the Ubuntu running in WSL (sub-directories of ''/''​):​ all these files are located in a [[other:​win10wsl#​location_of_the_files|hidden sub-directory of you Windows directory]],​ and the best way to save them is probably to create a **tar file** from Linux, and put this tar file in a specific Windows folder 
 +    * <​code>​$ cd /home 
 +$ du -sh <​your_login>​ 
 +232K    <​your_login>​ 
 +$ tar cfz /​mnt/​c/​Scratch/<​your_login>/<​your_login>​_home_<​some_date>​.tgz <​your_login>​ 
 +</​code>​ 
 +  * Windows folders that are not in ''/'':​ you can use ''​tar''​ from Linux, as above, or use any usual way of backing up Windows files (drag and drop, some specific backup software) 
 +  * The **full Linux/​Ubuntu installation** running in WSL (following [[https://​docs.microsoft.com/​en-us/​windows/​wsl/​faq#​how-can-i-back-up-my-wsl-distros|How can I back up my WSL distros?​]]). The following steps will save the full installation in a tar file, that can be used later for restoring the full installation (//​restoration//​ not tested yet) 
 +    * Open a Windows terminal (preferably a PowerShell if you need easy copy/​paste) 
 +    * [[other:​win10wsl#​rebooting_wsl|Stop WSL+Linux]] 
 +    * Determine the name of the current Linux installation used in WSL 
 +      * <​code>>​ wsl --list --all 
 +Distributions du sous-système Windows pour Linux : 
 +Ubuntu (par défaut)</​code>​ 
 +    * Export the current Linux to a tar file: ''​wsl %%--%%export Ubuntu C:​\Scratch\<​your_login>​\ubuntu_<​your_login>​_<​some_date>​.tar''​ 
 +    * Get some information about the created file (size and number of saved files/​directories),​ in a Linux terminal 
 +      * <​code>​$ ls -lh /​mnt/​c/​Scratch/<​your_login>/​ubuntu_<​your_login>​_<​some_date>​.tar 
 +2.6G Jan 21 14:25 /​mnt/​c/​Scratch/<​your_login>/​ubuntu_<​your_login>​_200121.tar 
 + 
 +jypeter@lsce5203:/​mnt/​c/​Scratch/​jypeter$ tar tvf /​mnt/​c/​Scratch/<​your_login>/​ubuntu_<​your_login>​_200121.tar | wc -l 
 +105600 
 +</​code>​ 
 + 
 +==== Restoring a WSL backup ====
  
-Best thing is probably ​to create tar file of the user's home directory, ​and get a list of installed applications ​and updated settings (e.g ''​/etc/fstab''​)+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
  
-Check [[https://​askubuntu.com/​questions/​9135/​how-to-backup-settings-and-list-of-installed-packages|How ​to backup settings ​and list of installed packages]]+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''​ 
 +    * Can we use the same ''<​DistributionName>''​ (e.g. ''​Ubuntu''​) as the one we are trying ​to restore without first removing it with ''​unregister''?​ 
 +    * 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? 
 +    * It seems we can use ''<​InstallLocation>''​ to install anywhere! What should we do if we want to restore to the default location (in the hidden directory)?​ 
 +      * Can we install out of the current user's Windows folder? 
 +      * Can we install out of ''​C:​\''?​ 
 +    * Can we restore (//clone//) a backed up Linux distribution on another Windows 10 computer for another user? 
 +      * need to find again how to change the default user
 ==== Uninstalling WSL ==== ==== Uninstalling WSL ====
  
other/win10wsl.1579193215.txt.gz · Last modified: 2020/01/16 17:46 by jypeter