If you run the sudo command in Bash on Ubuntu in Windows 10, you might face the issue that it shows an error message unable to resolve host followed by your computer name. Here is a quick fix for this issue.
Under Windows 10, Bash on Ubuntu can't resolve the host name defined in the standard configuration file /etc/hostname. To fix it, you need to specify the IP address manually which matches the host name.
This can be done with the following commands. Execute them one by one.
sudo su echo 127.0.0.1 your_pc_name >> /etc/hosts
The first command switches the user context to the root user.
The second adds a new line to the file /etc/hosts which tells that your_pc_name should be resolved to the local computer. Replace the your_pc_name portion with the actual PC name.