DEV Community

Discussion on: Install Fedora 37 or earlier on Windows Subsystem for Linux (WSL)

 
timfw profile image
TimFW

Ok I just did a fresh Win 10 install fully updated Windows Linux subsystems and Windows Virtual Machine Features added. Installed wsl 2 thru the linx update package I linked to. Set WSL 2 as default thru PS. Created the
"C:\Users\WSL\fedora" folder in the user profile root. Downloaded and renamed the fedora-32-rootfs.tar file. (I chose Fedora 32) Imported it. Ran it with "wsl -d fedora" But as Miguel Quintero posted it did not open a bash promote. Just had the same Powershell "PS C:\Users\Username> " prompt.

Next I checked to confirm it was running with "wsl -l --running" with output of:

"Windows Subsystem for Linux Distributions:
fedora (Default)"

Thus that confirms wsl fedora was running. ( I actually tried all of this before activating Windows VM or thte WSL 2 Linus package update to emulate a user running your instructions but not knowing about the WSL 2 package or activation of Windows VM add on. When I checked for running instances the output was " no running linux distro" or something to that effect. But it did install etc.

So there is still something hinky going on as with everything done on a fresh install fully updated and all installs and upgrades down while WSL 2 claims its running there is no bash prompt to run inside fedora linux.

I wonder if with the last win update MS made it so you can only install distro roots thru the Store. After all to download the Fedora Remix they state is from upstream its $10. Nice they are monetizing for open source freeware. You had to know that was the entire reason they got into the Linux game in the first place. Pulling a google on opensource projects.

Thread Thread
 
timfw profile image
TimFW

I tried installing Ubuntu 18.04 LTS and it worked and bash opened without issue. So something is is different doing it thru this manual way.

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

Wow, thank you for testing this! I will seek to replicate, and adjust the article accordingly.

Thread Thread
 
bowmanjd profile image
Jonathan Bowman • Edited

@timfw , I am unable to replicate this. I believe you, though. Indeed something strange must be going on.

Could you verify what rootfs version you downloaded, and what tool you used to unpack? Not sure that will be fruitful, but thought I would check. I suspect you are right that this has something to do with WSL configuration.

Also, curious what happens if you wsl -d fedora -- bash or similar?

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

@timfw , I have made some changes to the article as you suggested, giving a bit more detail about upgrading to WSL version 2 and also detailing multiple options for rootfs download. I don't think this resolves the issue you are identifying, unless perhaps a newer rootfs fixes it?

Thread Thread
 
timfw profile image
TimFW

I used the fedora 32 x64 you linked to here
this is the file name it downloaded Fedora-Container-Base-32-20201205.0.x86_64.tar.xz I used7zip to decompress it to a tar.

Something weird though. The first time I downloaded it the file ended with the .tar.xz. But now since I originally decompressed it everytime I download it comes as just .tar not .tar.xz in the download directory. I assume its because of 7zip already decompressing it to just a .tar. I hate programs deciding for me how to help grrr...

I insured wsl 2 was the default.

I renamed the decompressed .tar to fedora-32-rootfs.tar
I then created the folder mkdir C:\users\username\wsl\fedora

Next imported the .tar to \wsl\fedora with "wsl --import c:\user\username\download\unzip\fedora-32-rootfs.tar c:\user\username\wsl\fedora\"

I checked and confirmed it was installed in that directory.

Next ran "wsl -d fedora" and after a pause it just returns me to the next line standard prompt in PS. I tried running both as user and admin.

I run "wsl -l -running" and it shows fedora default is running.

I check inside ~\wsl\fedora in Win Explorer and it now shows a ext4 virtual drive

But thats it.

Now I went thru the Win Store and downloaded Ubuntu 18.04 LTS and thru whatever auto .msi it installs it with I get an immediate bash window .Windows installs the ubuntu1804.exe in C:\Users\Username\AppData\Local\Microsoft\WindowsApps directory

It also installed a entire user directory set for Ubuntu in C:\Users\Lenovo\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc

Thread Thread
 
timfw profile image
TimFW • Edited

after a reboot

in PS going to ~\wsl\fedora here is the output of a dir cmd

These are c&p of the text in PS:


PS C:\Users\Lenovo\wsl\fedora> dir
Directory: C:\Users\Lenovo\wsl\fedora
Mode LastWriteTime Length Name


-a---- 12/7/2020 12:00 AM 246415360 ext4.vhdx
PS C:\Users\Lenovo\wsl\fedora>


Then a check to confirm no running distributions followed by the "wsl -d fedora" cmd and as you can see it just returns a standard PS Windows prompt.

These are c&p of the text in PS:

PS C:\Users\Lenovo> wsl -l --running
There are no running distributions.
PS C:\Users\Lenovo> wsl -d fedora
PS C:\Users\Lenovo>
PS C:\Users\Lenovo> wsl -l --running
Windows Subsystem for Linux Distributions:
fedora (Default)

PS C:\Users\Lenovo>

No bash window opened nothing

But if I wait about a minute and then rerun the wsl -l --running I get this


PS C:\Users\Lenovo> wsl -d fedora
PS C:\Users\Lenovo> wsl -l --running
Windows Subsystem for Linux Distributions:
fedora (Default)

PS C:\Users\Lenovo>

The Ubuntu thru the store works fine. In fact I just git gcc compiled and produced a binary for CryFS encryption program which is a updated and secured version EncFS.

I just do not get why Fedora installed manually does not work?? It even shows it as a virtually mounted drive.

Thread Thread
 
timfw profile image
TimFW • Edited

Finally SUCCESS!!!!

I took your recommendation about it maybe an issue with the roofs downloaded. I downloaded the one form the docker link you provided.

I terminated and then unregistered the current not working fedora 32 from December 5,your link in here:

"Find the right "xz" file for your platform (likely x86_64). Such as this one for the December 5, 2020 build of Fedora 33. Or, if you were still wanting Fedora 32, this Fedora 32 build from December 5 should work."

Not sure if you updated that when you edited the article. The one from that link prior to it may be bad as its what did not work.

I followed the docker github link to github.com/fedora-cloud/docker-bre...
and it produced a successful install finally.
PS C:\Users\Lenovo>wsl -t fedora
PS C:\Users\Lenovo>wsl --unregister fedora
PS C:\Users\Lenovo>
PS C:\Users\Lenovo> wsl --import fedora c:\Users\Lenovo\wsl\fedora c:\Users\Lenovo\Downloads\fedora-33-rootfs.tar

PS C:\Users\Lenovo> wsl -l
Windows Subsystem for Linux Distributions:

Ubuntu-18.04 (Default)

fedora

PS C:\Users\Lenovo> wsl --set-default fedora
PS C:\Users\Lenovo> wsl -l --running
There are no running distributions.

PS C:\Users\Lenovo> wsl -l --verbose
NAME STATE VERSION

  • fedora Stopped 2

Ubuntu-18.04 Stopped 2

PS C:\Users\Lenovo> wsl -d fedora

[root@Lenovo-THINK Lenovo]#

Yes finally a bash prompt.

Thank you very much Jonathan for a well written set of instructions and improving it. Maybe check that current linked fedora 32 download I mentioned and see if it creates a working rootfs. If it works maybe something got corrupted during my download is all I can think of. I did download it twice though and tried both copies but anything is possible I guess. But no matter I have positive results now thanks to your suggestions.

BTW I am using this to see if Qubes OS Ver 4.0 series can be compiled and binary produced using the Windows linux subsystem. It works 100% on a real Fedora 32+ install with all necessary programs loaded. Want to see if it works here as its a rather complex tool and script system for the build environment.

Again thank you!

Cheers,

Tim

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

Excellent! I am glad it is working for you now. I hope your Qubes OS task goes well.