Migrating from 'Legacy' Bash on Ubuntu on Windows to 'Store' Ubuntu on Windows

In the Fall Creators Update release of Windows 10, Windows Subsystem for Linux graduates from beta. You can now install multiple Linux distributions directly from the Windows Store, rather than from a command line.

Unfortunately, that means there's some manual migration work to move from the 'legacy' lxrun-based installation of WSL to the store-based installation. Fortunately the two run side-by-side, which makes migration pretty easy. I thought I'd document the steps I took to move across from the old Bash on Ubuntu on Windows beta to the new RS3-based Ubuntu on Windows installation.

These instructions assume you have a C:\temp directory, and might need other modifications depending on your old setup. Your mileage may vary, no warranties express or implied, etc.

After upgrading to the Fall Creators Update (i.e. RS3), from your 'legacy' WSL instance, run the following commands:

$ sudo apt install apt-clone
$ apt-clone clone legacy-bash
$ mv legacy-bash.apt-clone.tar.gz /mnt/c/temp/
$ mkdir /mnt/c/temp/legacy-home


Now copy any 'dotfiles' you want to keep to /mnt/c/temp/legacy-home, for example:

$ cp .bash_logout .bashrc .gitconfig .profile .viminfo /mnt/c/temp/legacy-home

Install the new store-based Ubuntu if you haven't done so already. Once that's completed, launch the new instance and run the following commands:

$ sudo add-apt-repository ppa:git-core/ppa  # Optionally adds the git repository to get latest version of git

$ sudo apt update
$ sudo apt install apt-clone

$ sudo apt-clone restore /mnt/c/temp/legacy-bash.apt-clone.tar.gz

$ cp /mnt/c/temp/legacy-home/* ~  # Copy back dotfiles

Now for some optional steps:

If you want it, you can install .NET Core from https://www.microsoft.com/net/core#linuxubuntu

The best way to get Node back on your machine (if you had it) is to install nvm from https://github.com/creationix/nvm

Assuming you want to use Visual Studio on Windows to build Linux applications, you'll need to recreate the ssh daemon on the new Linux instance and then delete and recreate the connection from Visual Studio:

$ sudo nano /etc/ssh/sshd_config - PasswordAuthentication yes
$ sudo ssh-keygen -A
$ sudo service ssh start

Lastly, recreate any old symbolic links, for example:

$ ln -s /mnt/c/git ~/git
$ ln -s /mnt/c/Users/tims/Desktop ~/Desktop
$ ln -s /mnt/c/Users/tims/OneDrive ~/OneDrive

Now's a good time to test that the new environment works the way you want it to. When you're fully happy, you can uninstall your legacy Bash on Ubuntu on Windows instance with the following:

C:\> lxrun /uninstall /full  
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.  
Distributions can be installed by visiting the Windows Store:  
https://aka.ms/wslstore

This will uninstall Ubuntu on Windows.  
This will remove the Ubuntu environment as well as any modifications, new applications, and user data.  
Type "y" to continue: y  
Uninstalling...

C:\>  

After deleting the old legacy environment, it looks as if bash.exe (the old command to start WSL) redirects to the new store-based instance, but the 'official' way to start Ubuntu on Windows is now ubuntu.exe.

Hope this is helpful!