I was afraid for missing my files, configurations and much other staff that I had in Linux filesystem of WSL2 (Windows 10). But I had to upgrade because of compatibility with an application that I need. So, finally, I decided to upgrade the Ubuntu 18.04 that I installed in WSL2 to a newer version 20.04. Yes, I know that there is 22.04 available nowadays, but I wasn’t comfortable jumping to many versions.
I followed simple steps that I found at:
How To Upgrade Existing WSL/WSL2 Ubuntu 18.04 to 20.04
The steps in a nutshell were:
sudo apt update sudo apt upgrade -y sudo apt --purge autoremove sudo apt install update-manager-core sudo do-release-upgrade
When I answered all the questions and after stopping the WSL2 VM with:
# command that I ran from 'cmd.exe' (Windows console) wsl --shutdown
I had and issue rebooting, WSL2 didn’t boot and it gave this message:
wsl/usr/sbin/enter-systemd-namespace: line 10: /usr/sbin/daemonize: No such file or directory
I resolved the problem, shutting down the WSL and running the command:
wsl -u root -e bash --noprofile --norc
It gave me a root console where I could modify the file:
specifically, in line 10, I changed:
And when I accessed to WSL2 everything worked perfectly. I used to access WSL2 from Windows Terminal which uses the command:
C:\WINDOWS\system32\wsl.exe -d Ubuntu-18.04
But it has small issues with bybou, finally I changed this command to:
C:\WINDOWS\system32\bash.exe ~ -login
I love to use a console with byobu enabled when access the shell, but with my former command, the command ‘byobu-enable’ was ignored. I didn’t find why, in the end the solution was to change the command that I use for accessing Linux console (WSL2).
Likewise, I hope these notes can help someone.