Please help me figure out what the problem is and how to fix it. I'm using Ubuntu 22.04.
The problem is that when I try to clone the repository
~ git clone git@bitbucket.org:some_user/some_rep.git
Cloning into 'some_rep'...
ssh: Could not resolve hostname bitbucket.org.somehost.local.: Temporary failure in name resolution
ssh: Could not resolve hostname bitbucket.org.sh-dev.local.: Temporary failure in name resolution
Receiving objects: 100% (23/23), 8.21 KiB | 8.21 MiB/s, done.
Resolving deltas: 100% (8/8), done
I am getting warnings Could not resolve hostname
. As far as I understand, this is due to dns search domains .somehost.local
and .sh-dev.local
appended to host while doing dns resolving.
These are the search domains of my former employer and they are no longer needed. I can't figure out where they are managed and how to get rid of them.
~ grep hosts /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns
~ clone nmcli connection show
NAME UUID TYPE DEVICE
myWifiName b81dd4e6-1bd3-4659-8a36-713bfe1fd7aa wifi wlp0s20f3
br-ce3f272b0bd1 8e917327-20e3-419d-8b2e-a22e86cbdc83 bridge br-ce3f272b0bd1
br-e3bb71106bfa d10a83ad-bb4e-4fed-88b9-15e8ac1a9483 bridge br-e3bb71106bfa
docker0 dfa05eee-2bae-4c49-afd8-7f5b5de0cdeb bridge docker0
enp0s31f6 54ec474d-eb2a-4eea-8f29-8f25fe325210 ethernet enp0s31f6
office_vpn 7eea950c-a520-423a-8804-9d1907f590ca vpn --
Wired connection 1 e2683831-e13a-3dd5-9db4-4f414fad75bf ethernet --
~ nmcli con show myWifiName | grep ipv4.dns
ipv4.dns: --
ipv4.dns-search: --
ipv4.dns-options: --
ipv4.dns-priority: 0
~ sudo lsof -i :53
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 23016 systemd-resolve 13u IPv4 164764 0t0 UDP localhost:domain
systemd-r 23016 systemd-resolve 14u IPv4 164765 0t0 TCP localhost:domain (LISTEN)
cat /etc/resolv.conf
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
# blah-blah-blah ....
nameserver 127.0.0.53
options edns0 trust-ad
search .
UPDATE:
I figured out some more:
These search domains are injected by networkmanager when i turn on vpn nmcli con up myVPN
systemd-resolved[45936]: tun0: Bus client set search domain list to: somehost.local, sh-dev.local
event is logged
~ sudo resolvectl domain
Global:
Link 2 (wwan0):
Link 3 (enp0s31f6):
Link 4 (wlp0s20f3):
Link 5 (br-ce3f272b0bd1):
Link 6 (br-e3bb71106bfa):
Link 7 (docker0):
Link 15 (tun0): sj-dev.local sj-dev.ru
When i turn off vpn with nmcli con down myVPN
systemd-resolved[45936]: tun0: Bus client reset search domain list.
event is logged and
~ sudo resolvectl domain
Global:
Link 2 (wwan0):
Link 3 (enp0s31f6):
Link 4 (wlp0s20f3):
Link 5 (br-ce3f272b0bd1):
Link 6 (br-e3bb71106bfa):
Link 7 (docker0):
But somehow these dns search domains are still being used when resolving domains.
What could be the reason and how to fix it?
UPDATE2:
Problem was in ~/.ssh/config
deleting this option resolved the problem
Host *
CanonicalDomains ...