DEV Community

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

Collapse
 
haosmos profile image
haosmos • Edited

Thank you for the detailed instruction!

I have installed fedora and the distribution is running. But for some reason, the standard commands are not available:

[haosmos@Haosmos-PC haosmos]$ cd ~/
[haosmos@Haosmos-PC ~]$ nano .bashrc
-bash: nano: command not found
[haosmos@Haosmos-PC ~]$ find find .bashrc
-bash: find: command not found
[haosmos@Haosmos-PC ~]$ clear
-bash: clear: command not found

When trying to download and install any program or utility, the same error is always displayed:

The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Error downloading packages:
Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-33&arch=x86_64 [Could not resolve host: mirrors.fedoraproject.org].

How do I fix these problems?

Collapse
 
bowmanjd profile image
Jonathan Bowman • Edited

I am curious: what does your /etc/resolv.conf look like?

Here is mine:

nameserver 1.1.1.1
nameserver 8.8.8.8
Collapse
 
haosmos profile image
haosmos • Edited

cat: /etc/resolv.conf: No such file or directory
[haosmos@Haosmos-PC ~]$

But file resolf.conf exist:

cloud.mail.ru/public/5BVW/2zYiramvC

Thread Thread
 
bowmanjd profile image
Jonathan Bowman • Edited

OK. That could be the issue. Judging by your screenshot, you may want to first rm /etc/resolv.conf

Then can you follow the "Ensure DNS is functioning" part of the article and make sure that two files have been edited appropriately: /etc/resolv.conf and /etc/wsl.conf. Then restart your machine? I am very curious if that works for you or not.

Thread Thread
 
haosmos profile image
haosmos • Edited

After many attempts (a lot of re-installations and reboots of the computer) I finally installed fedora in wsl and set it up)).

Everything seems to be working. I was able to install everything I needed (my goal was to configure the right working environment for web development).

I don't know what the problem was — why I had to start over many times, but wsl (fedora) worked in a strange way: the standard commands didn't work ("cat", "clear", "nano", etc.), or it was impossible to download and install programs and utilities (Curl error (6): Couldn't resolve host name for mirrors.fedoraproject.org/metalink... [Could not resolve host: mirrors.fedoraproject.org].).

Eventually, I set up fedora according to your tutorial, except that I didn't execute the commands:

echo -e "[network]\ngenerateResolvConf = false" > /etc/wsl.conf

and

echo nameserver 1.1.1.1 > /etc/resolv.conf

Now I have this content of the resolv.conf file:

cat /etc/resolv.conf

// This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
// [network]
// generateResolvConf = false
nameserver 172.29.16.1

In my well-working wsl 2 ubuntu-20.04 the content of the resolv.conf file is exactly the same.

I don't know if this will be a problem in the future (what I didn't specify in the resolv.conf: nameserver 1.1.1 according to your instructions) but so far everything seems to be working fine.

Tell me, please, what do I need to specify in the resolv.conf: nameserver 1.1.1.1 file for?

Maybe I should add it to my resolv.conf file?

Or if everything works as expected I don't have to add or change anything in my resolv.conf file?

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

Thank you for your feedback! I have updated the DNS section to include more specific instructions for removal of the offending link in Fedora 33, and also prefaced that with acknowledgement of the default automatically-configured resolv.conf provided by WSL. I hope this helps!

Collapse
 
bowmanjd profile image
Jonathan Bowman

@haosmos , you were right and I was wrong!

Apparently, Fedora 33 uses systemd-resolvd, and when we upgrade packages with dnf upgrade something was overwriting /etc/resolv.conf with a link to /run/systemd/resolve/stub-resolv.conf which didn't actually exist.

So, I updated the instructions to include a workaround for Fedora 33. Please let me know if it works!

I also added a tip at the end to install findutils and ncurses. Let me know if you think other basic packages should be included. Thanks!

Collapse
 
operation420_net profile image
operation420_net • Edited

Did you try dnf clean packages as suggested?

[root@operation420.net ~]$ dnf clean all && dnf update

PS I dunno nano, VIM is the hardcore editor/IDE!!!

Collapse
 
scottbeamer profile image
Scott Beamer

Vim is ovekill for simple text editing tasks.

Collapse
 
operation420_net profile image
operation420_net

Did you try dnf clean packages as suggested?

[root@operation420.net ~]$ dnf clean all && dnf update

PS I dunno nano, VIM is the hardcore editor/IDE!!!