Migrate Bash on Windows to Store app Creators Update

7

2

I've been using Bash on Ubuntu on Windows since its been announced in beta and have tools installed, bashrc configurations, etc. From what I understand, its not really supported anymore and I have to move to the official store app for Canonical updates and support. What is a sure way routine of doing this without having the reinstall tools and packages?

bl4kh4k

Posted 2017-10-31T02:11:29.130

Reputation: 171

You shouldn't have to reinstall anything. The current version should continue to work, you will have to either update WSL yourself manually, or continue using the version you already have installed. I think you mean the Fall Creator Update since WSL was still beta on Creators Update (1703) – Ramhound – 2017-10-31T02:17:54.303

What is the process to update WSL manually? is this update part of updating within Ubuntu or within Windows? – bl4kh4k – 2017-10-31T02:20:24.187

A small level of research is expected: https://superuser.com/questions/1103675/update-linux-subsystem-on-windows-ubuntu-to-16-04 do-release-upgrade. You shouldn't have to reinstall, you have WSL Ubuntu installed, I suspect even if you installed WSL Ubuntu from the Store your current environment would be saved.

– Ramhound – 2017-10-31T02:21:19.633

Thank you for your help. Looks like a batch script can make this automated as well. Cheers. – bl4kh4k – 2017-10-31T02:24:24.027

While upgrading might indeed work, MS officially suggests the following, "We recommend that you migrate your files off the legacy instance and replace it with a store-delivered instance, so that you receive the support of Canonical and Microsoft moving forward.. I’d recommend copying any files you want to keep to somewhere on your Windows filesystem, e.g.: /mnt/c/temp/backups and then copying them back into your new instance" – Ramhound – 2017-10-31T02:29:17.563

I confirmed if you install WSL Ubuntu from the Store it will be a new installation. My suggestion just reconfigure a new installation. The file system location for WSL is hidden. It used to be located at %LocalAppData%\lxss but as of 1709 it isn't located there. – Ramhound – 2017-10-31T02:32:38.107

Answers

5

As Ramhound mentioned, MS officially suggested migrating files to the new store-delivered instance (I guess the legary lxrun-installed instance will never receive 18.04 LTS or any later version). I have yet to do the migration, but I think the reasonable way of moving into new instance is like this:

  1. Start sshd on the old instance: sudo /usr/sbin/sshd -D

  2. Run scp from the new instance: scp -r localhost:~/* /tmp/ - this will keep your file modes, while copying to a Windows filesystem will destroy them (setting everything to 0777)

  3. Replace, with sudo, the directory tree in the new instance with what you just copied.

Be sure that nothing is running in the background of WSL if you're going to replace system directories. You will need to copy /bin, /etc, /home, /opt, /sbin, /usr, and /var if you want a full recovery, but only doing /home, /opt, and /usr/local (which contains libraries installed or compiled manually) and install repository packages again with apt might be a safer option.

Chang Qian

Posted 2017-10-31T02:11:29.130

Reputation: 409