Ubuntu WSL2 could not resolve hostname for GIT clone - windows-subsystem-for-linux

I have gitlab local repository and VPN to connect with it. I already installed WSL and it worked well before with clone repository (I've done add ssh pub). After updating kernel from WSL and change to WSL2. I cannot clone repository anymore and it returns:
ssh: Could not resolve hostname gitlab.local.id: Name or service not
known
I've done creating /etc/wsl.conf file
[network]
generateResolvConf = true
and /etc/resolv.conf file
nameserver 8.8.8.8
NOTE:
I can clone repo through GIT Bash
Restart the WSL, terminal and even reboot laptop. But still cannot clone the repository through SSH. I followed others suggestion but still no luck. Maybe your suggestion may help. many thanks!

It took me almost 3 days to try others workaround to solve it and it's just solved by re-installed the updated distro. I have no clue why origin resolv.conf (generated by WSL) before was gone after updated to WSL2 and suddenly does not resolve any hostname.
After re-install distro and re-added new SSH key to gitlab, WSL generate new resolv.conf file and git back to works again.
UPDATE:
As per request from #Philippe, The new resolve.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.19.144.1
This configuration comes automatically and without wsl.conf at /etc/ directory.
NOTES:
Please make sure you working on the right WSL version before you doing something on your distro or you will probably ended up with the same problem above.
Comment form #torek above was right. Git has nothing to do with the problem, but the problem causing git and other servername does not resolve. My problem begun with updating the kernel then change the wsl version in the middle of working on current distro.

Related

Direnv not allowing me to allow

I've installed direnv (v2.18.2) onto my Ubuntu 16.04 machine using:
sudo snap install direnv
as per the website, and added the line:
eval "$(direnv hook bash)"
to my ~/.bashrc file as per the instructions. When I navigate into the directory with my .envrc file, the following message shown:
direnv: error .envrc is blocked. Run `direnv allow` to approve its content.
Sweet. So I run direnv allow, and I'm immediately hit with exactly the same error. I've also tried using direnv allow . but that doesn't seem to help. Also, completely restarting my laptop hasn't helped either.
All the advice I've seen is for direnv not finding the .envrc file, but here it is finding it, it's just not allowing me to allow it.
I know this is not a propper solution, but I encountered this aftering installing from a snap on Linux Mint.
After I uninstalled the snap and installed it from aptitude I did not have any issues.
While the OP is on Ubuntu I ran into the same problem with the snap installed binary on CentOS 7.7.
I worked around the problem by installing a go binary and then building direnv from source: git clone https://github.com/direnv/direnv.git; cd direnv; make; make install which got me direnv 2.21.2 in /usr/local/bin

How to pass password to scp? (without root)

I need to download a file over SSH (scp) from Ubuntu machine A to ubuntu machine B.
I don't have a root access on the machine from I am downloading the file (machine B), so I cannot install anything like sshpass etc...Just clear Ubuntu.
I need to use password authentication because the command will be called inside TeamCity plugin which does not support downloading over SSH (just uploading) or plain bash. I don't have priviledge to read SSH private keys from command line.
Finally, I found that Docker is a solution for it. I was lucky that docker is installed on this machine and I can install anything (including scp) inside docker even if I am not root on the host machine.

Vagrant 1.9.6 hangs on command "vagrant ssh"

I have vagrant 1.9.6 and oracle virtual box 5.1.22 installed on my system. when I ran vagrant up and tried to switch into vagrant ssh on GIT bash it hangs there and nothing get it to work on me.
screenshot:
I solved mine by adding this line export VAGRANT_PREFER_SYSTEM_BIN=1 in my .bash_profile file. You can manually create this file on windows and place it on your home directory.
Take a look at this thread

dpkg sent over SSH on Mac App not working

So I am facing a very strange peculiarity. I am trying to run dpkg on a remote server via SSH. My code works perfectly if I click Run through Xcode, but if I click Build > Archive then Export as a Mac Application, all SSH commands sent to the server work, other than "dpkg". Any ideas why this might happen?
Apparently, after many days of facing that issue, I tried installing via dpkg a Deb that was already located on my server and it worked. What's even more strange is that while scp would transfer the file, dpkg would just not use it! What made the trick was getting the file via curl and then running dpkg normally. No idea why that's the case though, as both Deb files had the same owner, group and permissions. And both were running by root, so it wasn't a permission error.

Boot2Docker start up fails in windows

I am trying to start docker from winodws7 enterprise edition.
boot2docker start
results
Waiting for VM and Docker daemon to start...
..........................................................................oooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
Started.
Trying to get Docker socket one more time
Error requesting socket: exec: "ssh": executable file not found in %PATH%
Docker client does not run on Windows for now. Please use
"boot2docker" ssh
to SSH into the VM instead.
I tried this link. But All answers doesn't help me. I have re-installed the boot2docker and powered off boot2docker-vm in Virtual machine and restarted. Virtualisation is enabled in my bios. My Sys has better capabilities.
Using 1.4.1 version.
Please Some Suggestions?
As boot2docker complained, you don't have ssh in your path. Please add ssh.exe into Windows path (it might not be visible, but boot2docker installation includes msys-git installation which includes ssh.exe, so you need to add Git installation directory in path, e.g.
c:\Program Files (x86)\Git\bin