Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

IPv6 only instance - apt update only attempts IPv4

I have an Ubuntu 24.10 instance on GCE with a public IPv6 address but no public IPv4 address. When I attempt sudo apt update,  apt only resolves IPv4 addresses for the sources and so the update fails.

The apt sources appear to have IPv6 addresses associated with them, see below.

How could I fix this?

 

ubuntu@instance-1:~$ sudo apt update
Ign:1 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular InRelease
Ign:2 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-updates InRelease
Ign:3 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu oracular-security InRelease
Ign:1 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular InRelease
Ign:2 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-updates InRelease
Ign:3 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu oracular-security InRelease
Ign:1 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular InRelease
Ign:2 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-updates InRelease
Ign:3 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-backports InRelease
Ign:4 http://security.ubuntu.com/ubuntu oracular-security InRelease
Err:1 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular InRelease
  Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.184.34.241), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.184.213.5), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.193.225.125), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.202.116.96), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.224.11.34), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.184.25.42), connection timed out
Err:2 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-updates InRelease
  Unable to connect to us-central1.gce.archive.ubuntu.com:http:
Err:3 http://us-central1.gce.archive.ubuntu.com/ubuntu oracular-backports InRelease
  Unable to connect to us-central1.gce.archive.ubuntu.com:http:
Err:4 http://security.ubuntu.com/ubuntu oracular-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.91.82), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.83), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.83), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.81), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.82), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.81), connection timed out
All packages are up to date.
Warning: Failed to fetch http://us-central1.gce.archive.ubuntu.com/ubuntu/dists/oracular/InRelease  Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.184.34.241), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.184.213.5), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.193.225.125), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.202.116.96), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.224.11.34), connection timed out Could not connect to us-central1.gce.archive.ubuntu.com:80 (35.184.25.42), connection timed out
Warning: Failed to fetch http://us-central1.gce.archive.ubuntu.com/ubuntu/dists/oracular-updates/InRelease  Unable to connect to us-central1.gce.archive.ubuntu.com:http:
Warning: Failed to fetch http://us-central1.gce.archive.ubuntu.com/ubuntu/dists/oracular-backports/InRelease  Unable to connect to us-central1.gce.archive.ubuntu.com:http:
Warning: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oracular-security/InRelease  Could not connect to security.ubuntu.com:80 (91.189.91.82), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.83), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.83), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.81), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.82), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.81), connection timed out
Warning: Some index files failed to download. They have been ignored, or old ones used instead.

 

ubuntu@instance-1:~$ dig us-central1.gce.archive.ubuntu.com aaaa

; <<>> DiG 9.20.0-2ubuntu3-Ubuntu <<>> us-central1.gce.archive.ubuntu.com aaaa
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1879
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;us-central1.gce.archive.ubuntu.com. IN AAAA

;; ANSWER SECTION:
us-central1.gce.archive.ubuntu.com. 60 IN AAAA  2600:1901:0:568a::

;; Query time: 36 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Tue Oct 15 20:37:49 UTC 2024
;; MSG SIZE  rcvd: 91

 

ubuntu@instance-1:~$ dig security.ubuntu.com aaaa

; <<>> DiG 9.20.0-2ubuntu3-Ubuntu <<>> security.ubuntu.com aaaa
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41295
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;security.ubuntu.com.           IN      AAAA

;; ANSWER SECTION:
security.ubuntu.com.    60      IN      AAAA    2620:2d:4000:1::101
security.ubuntu.com.    60      IN      AAAA    2620:2d:4000:1::102
security.ubuntu.com.    60      IN      AAAA    2620:2d:4002:1::103
security.ubuntu.com.    60      IN      AAAA    2620:2d:4000:1::103
security.ubuntu.com.    60      IN      AAAA    2620:2d:4002:1::102
security.ubuntu.com.    60      IN      AAAA    2620:2d:4002:1::101

;; Query time: 3 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Tue Oct 15 20:37:58 UTC 2024
;; MSG SIZE  rcvd: 216

 

0 0 182