Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Portage/git can't resolve github.com
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 171
Location: Ancient Rome

PostPosted: Thu Sep 28, 2023 2:44 pm    Post subject: [SOLVED] Portage/git can't resolve github.com Reply with quote

I have no clue what happened, but one of my machines can't access github.com. This machine works headlessly and wasn't updated for about mount. Meanwhile I had Internet breakdown in my house, after calling ISP they said that they can't access antenna on our roof. They arrived and did something to roof's antenna, factory restarted router upstairs (they didn't touch my router connected to router upstairs) and Internet is back. But, since then one of my machines have problem with accessing github.com:
Code:
nas ~ # emerge --sync 
>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'... 
/usr/bin/git fetch origin --depth 1
fatal: unable to access 'https://github.com/gentoo-mirror/gentoo.git/': Could not resolve host: github.com 
!!! git fetch error in /var/db/repos/gentoo
 
Action: sync for repo: gentoo, returned code = 128

Code:
nas ~ # emerge -1 yt-dlp 
Calculating dependencies... done!
Dependency resolution took 18.03 s.
 
>>> Verifying ebuild manifests 
>>> Emerging (1 of 1) net-misc/yt-dlp-9999::gentoo 
>>> Failed to emerge net-misc/yt-dlp-9999, Log file: 
>>>  '/var/tmp/portage/net-misc/yt-dlp-9999/temp/build.log'
>>> Jobs: 0 of 1 complete, 1 failed Load avg: 4.52, 4.01, 3.43 
 * Package:  net-misc/yt-dlp-9999:0
 * Repository: gentoo
 * Maintainer: ionen@gentoo.org
 * USE:  abi_x86_64 amd64 elibc_glibc kernel_linux python_targets_python3_11 
 * FEATURES: network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
 * Repository id: yt-dlp_yt-dlp.git
 * To override fetched repository properties, use: 
 * EGIT_OVERRIDE_REPO_YT_DLP_YT_DLP
 * EGIT_OVERRIDE_BRANCH_YT_DLP_YT_DLP
 * EGIT_OVERRIDE_COMMIT_YT_DLP_YT_DLP
 * EGIT_OVERRIDE_COMMIT_DATE_YT_DLP_YT_DLP 
 * 
 * Fetching https://github.com/yt-dlp/yt-dlp.git ... 
git fetch https://github.com/yt-dlp/yt-dlp.git +HEAD:refs/git-r3/HEAD
fatal: unable to access 'https://github.com/yt-dlp/yt-dlp.git/': Could not resolve host: github.com

Ping is still working:
Code:
nas ~ # ping github.com
PING github.com (140.82.121.4) 56(84) bytes of data. 
64 bytes from lb-140-82-121-4-fra.github.com (140.82.121.4): icmp_seq=1 ttl=46 time=18.4 ms
64 bytes from lb-140-82-121-4-fra.github.com (140.82.121.4): icmp_seq=2 ttl=46 time=17.0 ms
64 bytes from lb-140-82-121-4-fra.github.com (140.82.121.4): icmp_seq=3 ttl=46 time=16.6 ms
64 bytes from lb-140-82-121-4-fra.github.com (140.82.121.4): icmp_seq=4 ttl=46 time=16.4 ms
64 bytes from lb-140-82-121-4-fra.github.com (140.82.121.4): icmp_seq=5 ttl=46 time=16.4 ms


Last edited by lekto on Thu Sep 28, 2023 4:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1663

PostPosted: Thu Sep 28, 2023 2:51 pm    Post subject: Reply with quote

Change to the portage user, su -s /bin/bash - portage, then try to ping. Does ping still work?

Edit: clarified


Last edited by grknight on Thu Sep 28, 2023 2:57 pm; edited 2 times in total
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 171
Location: Ancient Rome

PostPosted: Thu Sep 28, 2023 2:55 pm    Post subject: Reply with quote

Same:
Code:
portage@nas ~ $ emerge --sync
>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
/usr/bin/git fetch origin --depth 1
fatal: unable to access 'https://github.com/gentoo-mirror/gentoo.git/': Could not resolve host: github.com
!!! git fetch error in /var/db/repos/gentoo

Action: sync for repo: gentoo, returned code = 128
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2720

PostPosted: Thu Sep 28, 2023 4:01 pm    Post subject: Reply with quote

Does it happen with git on its own?

e.g. git clone --depth 1 https://github.com/yt-dlp/yt-dlp.git

And if it does, it happen with curl too? (git uses curl), e.g. curl https://github.com/ >/dev/null

(all fine for me including with portage ftr, albeit there could be some factors like curl version or maybe USE on curl given it has different implementations to handle dns -- but feels unlikely).
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 171
Location: Ancient Rome

PostPosted: Thu Sep 28, 2023 4:08 pm    Post subject: Reply with quote

Git doesn't work with https, but works with ssh:
Code:
nas ~ # git clone https://github.com/gentoo-mirror/gentoo.git --depth=1
Cloning into 'gentoo'...
fatal: unable to access 'https://github.com/gentoo-mirror/gentoo.git/': Could not resolve host: github.com

nas ~ # git clone https://gitlab.freedesktop.org/mesa/mesa.git --depth=1
Cloning into 'mesa'...
fatal: unable to access 'https://gitlab.freedesktop.org/mesa/mesa.git/': Could not resolve host: gitlab.freedesktop.org

nas ~ # git clone git@gitlab.freedesktop.org:mesa/mesa.git --depth=1
Cloning into 'mesa'...
git@gitlab.freedesktop.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Curl doesn't work:
Code:
nas ~ # curl https://github.com/ > /dev/null                                                                                                                                                 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                                                                                               
                                 Dload  Upload   Total   Spent    Left  Speed                                                                                                                 
  0     0    0     0    0     0      0      0 --:--:--  0:01:14 --:--:--     0curl: (6) Could not resolve host: github.com

I compared USE flags with my other machine and they look same (except for abi_x86_32):
Code:
lekto@nas ~ $ equery uses curl
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for net-misc/curl-8.1.2:
 U I
 + + adns             : Add support for asynchronous DNS resolution
 - - alt-svc          : Enable alt-svc support
 - - brotli           : Enable brotli compression support
 - - curl_ssl_gnutls  : Use GnuTLS
 - - curl_ssl_mbedtls : Use mbed TLS
 - - curl_ssl_nss     : Use Mozilla's Network Security Services
 + + curl_ssl_openssl : Use OpenSSL
 + + ftp              : Enable FTP support
 - - gnutls           : Enable gnutls ssl backend
 - - gopher           : Enable Gopher protocol support
 - - hsts             : Enable HTTP Strict Transport Security
 + + http2            : Enable HTTP/2.0 support
 - - idn              : Enable support for Internationalized Domain Names
 + + imap             : Enable Internet Message Access Protocol support
 - - kerberos         : Add kerberos support
 - - ldap             : Add LDAP support (Lightweight Directory Access Protocol)
 - - mbedtls          : Enable mbedtls ssl backend
 - - nss              : Enable nss ssl backend
 + + openssl          : Enable openssl ssl backend
 + + pop3             : Enable Post Office Protocol 3 support
 + + progress-meter   : Enable the progress meter
 - - rtmp             : Enable RTMP Streaming Media support
 - - samba            : Add support for SAMBA (Windows File and Printer sharing)
 + + smtp             : Enable Simple Mail Transfer Protocol support
 - - ssh              : Enable SSH urls in curl using libssh2
 + + ssl              : Enable crypto engine support (via openssl if USE='-gnutls -nss')
 - - static-libs      : Build static versions of dynamic libraries as well
 - - telnet           : Enable Telnet protocol support
 - - test             : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
 + + tftp             : Enable TFTP support
 + + verify-sig       : Verify upstream signatures on distfiles
 - - websockets       : Enable websockets support
 - - zstd             : Enable zstd compression
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2720

PostPosted: Thu Sep 28, 2023 4:15 pm    Post subject: Reply with quote

USE look pretty default so nothing of note there I guess. fwiw could try updating curl, curl-8.2.1 was stabilized earlier -- albeit 8.1.2 works for me too (Edit: and I do have adns enabled, not that trying without would hurt to narrow down the issue).

Does this happen with any https:// links? Maybe something up with openssl, albeit failing to resolve hosts doesn't quite add up with that unless error is being misleading...


Last edited by Ionen on Thu Sep 28, 2023 4:24 pm; edited 2 times in total
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1663

PostPosted: Thu Sep 28, 2023 4:19 pm    Post subject: Reply with quote

Try disabling the adns USE on net-misc/curl. I've seen similar errors in the past and this is a quick workaround.
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 171
Location: Ancient Rome

PostPosted: Thu Sep 28, 2023 4:37 pm    Post subject: Reply with quote

grknight wrote:
Try disabling the adns USE on net-misc/curl. I've seen similar errors in the past and this is a quick workaround.

That fixed it, but why?
Back to top
View user's profile Send private message
GravityShark
n00b
n00b


Joined: 18 Nov 2023
Posts: 1

PostPosted: Sat Nov 18, 2023 9:44 am    Post subject: Reply with quote

grknight wrote:
Try disabling the adns USE on net-misc/curl. I've seen similar errors in the past and this is a quick workaround.


Thanks for this, since this has also solved my curl from not working too, but I would also like an explanation on why is this the case.
Back to top
View user's profile Send private message
jkagen
n00b
n00b


Joined: 29 Jul 2008
Posts: 42

PostPosted: Sun Nov 19, 2023 5:07 pm    Post subject: Reply with quote

The same here, it fixed my issue with git too.
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1663

PostPosted: Sun Nov 19, 2023 5:10 pm    Post subject: Reply with quote

Another post points to a suggestion that c-ares can have a hard time with some /etc/hosts file layouts.

Simple ones are usually fine, but more complex and very large ones can confuse it.
Back to top
View user's profile Send private message
jkagen
n00b
n00b


Joined: 29 Jul 2008
Posts: 42

PostPosted: Sun Nov 19, 2023 5:13 pm    Post subject: Reply with quote

My /etc/hosts is simple, just two lines:
127.0.0.1 localhost
::1 localhost
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21642

PostPosted: Sun Nov 19, 2023 6:00 pm    Post subject: Reply with quote

Without more detail about how the affected systems fail, it is difficult to offer more than general speculation about the cause. If you are curious why it failed, I suggest you reproduce it, post a new thread, and provide the versions and full output of the failure. Additionally, be prepared to apply debugging suggestions to try to isolate the cause.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3922
Location: Hamburg

PostPosted: Sun Nov 19, 2023 6:36 pm    Post subject: Reply with quote

jkagen wrote:
My /etc/hosts is simple, just two lines:
127.0.0.1 localhost
::1 localhost
Maybe it is an ipv6 issue ? You can verify it by using the ipv4 address instead the hast name in https://....
Back to top
View user's profile Send private message
jkagen
n00b
n00b


Joined: 29 Jul 2008
Posts: 42

PostPosted: Sun Nov 19, 2023 8:02 pm    Post subject: Reply with quote

I tried:

git pull https://anongit.freedesktop.org/git/drm/drm.git --ipv4

still getting

fatal: unable to access 'https://anongit.freedesktop.org/git/drm/drm.git/': Could not resolve host: anongit.freedesktop.org
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum