Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

[SOLVED] Portage/git can't resolve github.com

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
29 posts
  • 1
  • 2
  • Next
Author
Message
lekto
Apprentice
Apprentice
Posts: 231
Joined: Sat Sep 20, 2014 6:48 pm
Location: Ancient Rome

[SOLVED] Portage/git can't resolve github.com

  • Quote

Post by lekto » Thu Sep 28, 2023 2:44 pm

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: Select all

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: Select all

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: Select all

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.
Top
grknight
Retired Dev
Retired Dev
Posts: 2560
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Sep 28, 2023 2:51 pm

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.
Top
lekto
Apprentice
Apprentice
Posts: 231
Joined: Sat Sep 20, 2014 6:48 pm
Location: Ancient Rome

  • Quote

Post by lekto » Thu Sep 28, 2023 2:55 pm

Same:

Code: Select all

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
Top
Ionen
Developer
Developer
User avatar
Posts: 3013
Joined: Thu Dec 06, 2018 2:23 pm

  • Quote

Post by Ionen » Thu Sep 28, 2023 4:01 pm

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).
Top
lekto
Apprentice
Apprentice
Posts: 231
Joined: Sat Sep 20, 2014 6:48 pm
Location: Ancient Rome

  • Quote

Post by lekto » Thu Sep 28, 2023 4:08 pm

Git doesn't work with https, but works with ssh:

Code: Select all

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: Select all

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: Select all

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
Top
Ionen
Developer
Developer
User avatar
Posts: 3013
Joined: Thu Dec 06, 2018 2:23 pm

  • Quote

Post by Ionen » Thu Sep 28, 2023 4:15 pm

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.
Top
grknight
Retired Dev
Retired Dev
Posts: 2560
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Sep 28, 2023 4:19 pm

Try disabling the adns USE on net-misc/curl. I've seen similar errors in the past and this is a quick workaround.
Top
lekto
Apprentice
Apprentice
Posts: 231
Joined: Sat Sep 20, 2014 6:48 pm
Location: Ancient Rome

  • Quote

Post by lekto » Thu Sep 28, 2023 4:37 pm

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?
Top
GravityShark
n00b
n00b
Posts: 1
Joined: Sat Nov 18, 2023 9:38 am

  • Quote

Post by GravityShark » Sat Nov 18, 2023 9:44 am

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.
Top
jkagen
n00b
n00b
Posts: 42
Joined: Tue Jul 29, 2008 2:01 am

  • Quote

Post by jkagen » Sun Nov 19, 2023 5:07 pm

The same here, it fixed my issue with git too.
Top
grknight
Retired Dev
Retired Dev
Posts: 2560
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Sun Nov 19, 2023 5:10 pm

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.
Top
jkagen
n00b
n00b
Posts: 42
Joined: Tue Jul 29, 2008 2:01 am

  • Quote

Post by jkagen » Sun Nov 19, 2023 5:13 pm

My /etc/hosts is simple, just two lines:
127.0.0.1 localhost
::1 localhost
Top
Hu
Administrator
Administrator
Posts: 24389
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun Nov 19, 2023 6:00 pm

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.
Top
toralf
Developer
Developer
User avatar
Posts: 3944
Joined: Sun Feb 01, 2004 2:58 pm
Location: Hamburg
Contact:
Contact toralf
Website

  • Quote

Post by toralf » Sun Nov 19, 2023 6:36 pm

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://....
Top
jkagen
n00b
n00b
Posts: 42
Joined: Tue Jul 29, 2008 2:01 am

  • Quote

Post by jkagen » Sun Nov 19, 2023 8:02 pm

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
Top
ecko
Tux's lil' helper
Tux's lil' helper
Posts: 120
Joined: Sun Jul 04, 2010 7:34 pm

  • Quote

Post by ecko » Sat Jul 27, 2024 3:48 pm

The "cannot resolve github.com" when cloning a repository (a simple user) is a separate issue, it can be solved by:

Code: Select all

git config --global --unset http.proxy
git config --global --unset https.proxy
Even if you are not using a proxy. Source: https://stackoverflow.com/questions/203 ... ository-in

I also can confirm on my side that the "cannot revolve github.com" by the gentoo tools (in root account) is solved by:

Code: Select all

USE="-adns" emerge net-misc/curl
Before that, I was getting these errors:

Code: Select all

emaint sync -A
>>> Syncing repository 'stuff' into '/var/lib/layman/stuff'...
/usr/bin/git fetch origin
fatal: unable to access 'https://github.com/istitov/stuff.git/': Could not resolve host: github.com
Top
padde
n00b
n00b
Posts: 58
Joined: Wed Jan 19, 2005 10:56 pm
Location: Germany

  • Quote

Post by padde » Tue Jan 14, 2025 8:47 am

Disabling the 'adns' USE flag for curl also healed my system from this issue.

Does anyone have more info on this? Why is the USE flag on by default?
Top
Banana
Administrator
Administrator
User avatar
Posts: 2386
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Tue Jan 14, 2025 10:10 am

It is a global useflag https://packages.gentoo.org/packages/net-misc/curl and does require c-ares https://packages.gentoo.org/packages/net-dns/c-ares

https://gitweb.gentoo.org/repo/gentoo.g ... -r2.ebuild

Code: Select all

adns? ( >=net-dns/c-ares-1.16.0:=[${MULTILIB_USEDEP}] )
Could it help if you re-emerge c-ares?
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
sam_
Developer
Developer
User avatar
Posts: 2816
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Tue Jan 14, 2025 2:26 pm

Part of the context is in:
commit bd4d42f83c774c36bf879a5b7ec89d373546743e
Author: Sam James <sam@gentoo.org>
Date: Thu Sep 1 22:42:26 2022 +0100

net-misc/curl: drop USE=threads
[...]
But really, adns is something we want, and it works for almost everyone except the folks here. If it's not working for you, please file a bug upstream with the c-ares people and hopefully they can figure out what's wrong with it on your system.
Top
Kobboi
l33t
l33t
User avatar
Posts: 673
Joined: Fri Jul 29, 2005 6:05 pm
Location: Belgium

  • Quote

Post by Kobboi » Wed Jan 29, 2025 5:34 pm

I was hitting the same problem. It disappeared when I moved away from my gateway's DNS (a FritzBox) to Google's DNS servers (which I didn't really want to do). Still unclear to me what/where the exact problem is though. I'll have a look at c-ares. It might have to do with the actual DNS responses
Top
fafhrd
Retired Dev
Retired Dev
User avatar
Posts: 434
Joined: Tue May 14, 2002 9:36 pm
Location: Williamstown, MA

  • Quote

Post by fafhrd » Mon Aug 18, 2025 5:06 am

FWIW, I just encountered this issue myself when trying to use eselect repository on a freshly installed system. (And bashing my head against my desk thinking I was using that tool incorrectly.)

Because of cascading USE flag requirements, I disabled -adns and -quic globally, and disabled -http3 and -httpsrr in curl.

Built stable curl-8.14.0 with these changes, and things work again.

I checked bugs.gentoo.org but didn't find this issue referenced.

Notes about my system that I thought might be germane:
* I'm building a stripped down install on a Chuwi Minibook X, with an Intel N150. Something about the chip?
* Since the chip only has 4 threads, I did use binpkg during install a bit. But recompiling should have fixed things then at first (w/o USE flag changes) but it did not.
* I'm running systemd. On a hunch, I checked to see if DNSoverTLS is on by default in systemd-resolved, and it's not ... but then I realized that curl for http3 uses QUIC, and systemd doesn't support DNSoverQUIC at all. See https://github.com/systemd/systemd/issues/23770 and https://github.com/systemd/systemd/issues/8639 .

So, my hunch is that this is related to systemd systems ... but ... you'd figure this would have come up already? What are the chances every systemd system has http3 off?

I don't know how I'd go about testing QUIC on my system. If someone wants to direct me as to how, I'm happy to be a guinea pig.

I hope these notes help someone.
jñanam bandha
Top
fafhrd
Retired Dev
Retired Dev
User avatar
Posts: 434
Joined: Tue May 14, 2002 9:36 pm
Location: Williamstown, MA

  • Quote

Post by fafhrd » Mon Aug 18, 2025 3:24 pm

Not wanting to give up on adns, I make some network and DNS changes and then reverted all my portage changes - and things work again.

I recently had to replace my Unifi gateway. The backup of the previous device was imported so there were no changes AFAICT. However, I went through and asserted that my DNS servers were set to Google's and that the DHCP server on the unit would be serving those DNS servers and clients would not use the gateway itself as a DNS server. I also turned off ipv6 pretty much everywhere because I just don't use it.

Then I make some systemd resolved changes and networkd changes to make sure the DNS servers were being set from DHCP.

Checking resolvectl and /etc/resolve.conf and checking a resolvectl query showed the changes in effect. I tried to clone a git repo over https from github, and everything worked.

I don't have it in me to triple check if it was the network gateway or my resolved and networkd changes that solved it by themselves, but considering the last post before mine above, it's likely the network gateway was at fault.
jñanam bandha
Top
hex07
n00b
n00b
Posts: 1
Joined: Sat Oct 04, 2025 2:53 pm

  • Quote

Post by hex07 » Sat Oct 04, 2025 3:03 pm

Type this by root:

Code: Select all

ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
and

Code: Select all

emerge --sync
Enjoy!
Top
Hu
Administrator
Administrator
Posts: 24389
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sat Oct 04, 2025 3:51 pm

hex07 wrote:Type this by root:

Code: Select all

ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
and

Code: Select all

emerge --sync
Enjoy!
Please provide context for why you think this is appropriate. Looking just at the prior posts, your advice seems wrong in at least two respects:
  • You assume that the systemd resolver is maintaining a file in /run. Not everyone runs systemd, and even those that do run it may not be using that feature.
  • Per the prior posts, there are multiple causes of the problem, at least one of which is definitely not solved by your proposal.
Top
devsk
Advocate
Advocate
User avatar
Posts: 3039
Joined: Fri Oct 24, 2003 1:16 am
Location: Bay Area, CA

  • Quote

Post by devsk » Sun Nov 30, 2025 11:43 am

Surprisingly, I ran into this just now, while emerging media-libs/openexr-3.4.4:

Code: Select all

-- OpenJPH was not found, fetching from https://github.com/aous72/OpenJPH.git @ 0.24.5
[1/9] Creating directories for 'openjph-populate'
[1/9] Performing download step (git clone) for 'openjph-populate'
Cloning into 'openjph-src'...
fatal: unable to access 'https://github.com/aous72/OpenJPH.git/': Could not resolve host: github.com
Cloning into 'openjph-src'...
fatal: unable to access 'https://github.com/aous72/OpenJPH.git/': Could not resolve host: github.com
Cloning into 'openjph-src'...
fatal: unable to access 'https://github.com/aous72/OpenJPH.git/': Could not resolve host: github.com
Had to git clone more than once: 3 times.
CMake Error at openjph-subbuild/openjph-populate-prefix/tmp/openjph-populate-gitclone.cmake:50 (message):
  Failed to clone repository: 'https://github.com/aous72/OpenJPH.git'


FAILED: [code=1] openjph-populate-prefix/src/openjph-populate-stamp/openjph-populate-download /var/tmp/portage/me
dia-libs/openexr-3.4.4/work/openexr-3.4.4_build/_deps/openjph-subbuild/openjph-populate-prefix/src/openjph-popula
te-stamp/openjph-populate-download 
cd /var/tmp/portage/media-libs/openexr-3.4.4/work/openexr-3.4.4_build/_deps && /usr/bin/cmake -DCMAKE_MESSAGE_LOG
_LEVEL=VERBOSE -P /var/tmp/portage/media-libs/openexr-3.4.4/work/openexr-3.4.4_build/_deps/openjph-subbuild/openj
ph-populate-prefix/tmp/openjph-populate-gitclone.cmake && /usr/bin/cmake -E touch /var/tmp/portage/media-libs/ope
nexr-3.4.4/work/openexr-3.4.4_build/_deps/openjph-subbuild/openjph-populate-prefix/src/openjph-populate-stamp/ope
njph-populate-download
ninja: build stopped: subcommand failed.
Doing curl without adns is not an option for me because some packages depend on curl[adns] without giving me the option to use curl without adns.

Is there a bug tracking this issue?
Top
Post Reply

29 posts
  • 1
  • 2
  • Next

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic