Moving from Ubuntu 18.04 to 20.04 in the WSL subsystem

Introduction

Hi all!

If you are reading this article, you are most likely experiencing problems with your personal or work projects caused by the recent update to VS Code to version 1.86. And it seems like a new version is needed, and it’s scary to lose all the data.

Ubuntu 18.04 uses GLIBC 2.27, so it no longer meets the new requirements.

Ubuntu 18.04 uses GLIBC 2.27, so it no longer meets the new requirements.

Among the recommendations found on the Internet there were two solutions:

And since missing out on further updates to the editor until the next restrictions seemed to me a less advantageous option, below I will give two methods, one of which worked for me, the other found a response among other developers. But first things first.

(almost) Installation

Please read the entire article first and use the Source links below before making any changes.

Installation

When calling the PowerShell command shell, we launch a specific distribution with a specific user:

wsl --distribution <Distribution Name> --user <User Name>

// Например,
// wsl --distribution Ubuntu-18.04 --user root

We can clarify information about the installed distribution before starting work:

lsb_release -a

Then we get the following data:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic

After making sure that this version is suitable for updating, run the following commands one by one:

sudo apt update                         // Раз
sudo apt list --upgradable              // Два
sudo apt upgrade                        // Три
sudo apt --purge autoremove             // Четыре
sudo apt install update-manager-core    // Пять
sudo do-release-upgrade                 // ОШИБКА!

What's happened?

Failure to make changes will certainly result in a message with the following content:

Checking for a new Ubuntu release In /etc/update-manager/release-upgrades Prompt is set to never so upgrading is not possible.

Based on the text, we need to find the file release-updates and at the very end change Prompt=never on Prompt=normal. It seems like nothing complicated, but how can a novice developer decide where it is located and how to edit it?

Solution 1. Via VS Code (worked for others)

No matter how you try, you won’t be able to just get into the content through VS Code or Explorer. Even after going the distance Ubuntu-18.04/etc/update-manager/release-upgradesmaking a change to the value Prompt You will first be prompted to re-login with administrator rights:

Editor warning window, no access rights.

Editor warning window, no access rights.

But this will not solve the problem with access rights:

Error in access to host wsl.localhost

Error in access to host wsl.localhost

It's time to act. To grant access rights to our host (in this case it is wsl.localhost), we need to go to Settings (Ctrl + ,), from there to the Security section and find the section allowedUNCHosts , where we manually enter the name of the host under which we are going to make changes. There are no restrictions, because you can also log in under the name localhost, wsl$, etc.:

Granting access rights to hostnames.

Granting access rights to hostnames.

All. At this point, some users have a unique opportunity to edit files in the WSL subsystem directly in VS Code, which will allow the installation to be completed successfully. However, this method does not always work and not for everyone.

Solution 2: Via GNU Nano (worked for me)

A simple and understandable editor that does not cause difficulties with access rights and other pitfalls. Same PowerShell, we write that we need to edit the file in nano:

nano /etc/update-manager/release-upgrades
Appearance of the GNU Nano editor

Appearance of the GNU Nano editor

Changing the value Prompt c never on normal. Ready! Let's save Ctrl + O, Enter and we go out Ctrl + Xafter which we continue with the installation.

Completion

Now we have every right to update to version 20.04, let's continue where we left off:

sudo do-release-upgrade 

// Получим следующее сообщение: 

Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release 
set Prompt=normal in /etc/update-manager/release-upgrades.

All. We are patient and, depending on the need, we install or refuse the packages offered. I specified an installation based on the existing version, which allowed me to save the work before the update. Don't go away for long! In some places we will need our Yes/No for the corresponding settings. Upon successful completion and reboot, we will receive the following message for the command lsb_release -a :

Checking for version changes.

Checking for version changes.

That's all. Thank you for your attention 🙂

Sources

  1. https://www.nextofwindows.com/how-to-upgrade-existing-wsl-wsl2-ubuntu-18-04-to-20-04

  2. https://stackoverflow.com/questions/76236922/the-host-was-not-found-in-the-list-of-allowed-hosts-do-you-want-to-open-i

  3. https://linuxsheet.com/answers/1315484u/?ysclid=lsohsay3ld583746504

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *