apricote / flatcar-packer-hcloud

Packer Template to prepare Flatcar Linux on Hetzner Cloud
MIT License
0 stars 2 forks source link

build not working with ipv6 only builder #4

Open kranurag7 opened 2 weeks ago

kranurag7 commented 2 weeks ago

Thank you for the project, it made hacking on flatcar a lot easier for me. I modified the config in the following way:

$ git diff -U0
diff --git a/flatcar.pkr.hcl b/flatcar.pkr.hcl
index 4d1c0cf..bec2622 100644
--- a/flatcar.pkr.hcl
+++ b/flatcar.pkr.hcl
@@ -5 +5 @@ packer {
-      version = "~> 1.4.0"
+      version = "~> 1.5.2"
@@ -19 +19 @@ variable "hcloud_server_type" {
-    x86 = "cx11"
+    # x86 = "cx11"
@@ -49 +49 @@ locals {
-  architectures = ["x86", "arm"]
+  architectures = ["arm"]
@@ -82,0 +83 @@ build {
+      public_ipv4_disabled = true

After this when I try to build the snapshot then I run into errors because curl and wget to something or some URL is not working out. I tried the same by creating a VM with ipv6 address only as well.

The reason for failure starts from the curl invocation in the script. Upto the point where we install gawk it works good. Similar is happening when I start an instance with only ipv6 address. I'm able to install packages but curl or wget to a GitHub release asset fails.

$ packer build flatcar.pkr.hcl
hcloud.arm: output will be in this color.

==> hcloud.arm: Validating server types: cax11
==> hcloud.arm: Validating snapshot name: flatcar-beta-3975.1.0-arm
==> hcloud.arm: Creating temporary RSA SSH key for instance...
==> hcloud.arm: Uploading temporary SSH key for instance...
==> hcloud.arm: Creating server...
    hcloud.arm: Using image '103908130'
==> hcloud.arm: Enabling Rescue Mode...
==> hcloud.arm: Rebooting server...
==> hcloud.arm: Using SSH communicator to connect: 2a01:4f8:c17:2ac5::1
==> hcloud.arm: Waiting for SSH to become available...
==> hcloud.arm: Connected to SSH!
==> hcloud.arm: Provisioning with shell script: /tmp/packer-shell2948221271
    hcloud.arm: Reading package lists...
    hcloud.arm: Building dependency tree...
    hcloud.arm: Reading state information...
    hcloud.arm: The following additional packages will be installed:
    hcloud.arm:   libsigsegv2
    hcloud.arm: Suggested packages:
    hcloud.arm:   gawk-doc
    hcloud.arm: The following NEW packages will be installed:
    hcloud.arm:   gawk libsigsegv2
    hcloud.arm: 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    hcloud.arm: Need to get 677 kB of archives.
    hcloud.arm: After this operation, 3,778 kB of additional disk space will be used.
    hcloud.arm: Get:1 http://mirror.hetzner.com/debian/packages bookworm/main arm64 libsigsegv2 arm64 2.14-1 [37.0 kB]
    hcloud.arm: Get:2 http://mirror.hetzner.com/debian/packages bookworm/main arm64 gawk arm64 1:5.2.1-2 [640 kB]
==> hcloud.arm: debconf: unable to initialize frontend: Dialog
==> hcloud.arm: debconf: (TERM is not set, so the dialog frontend is not usable.)
==> hcloud.arm: debconf: falling back to frontend: Readline
==> hcloud.arm: debconf: unable to initialize frontend: Readline
==> hcloud.arm: debconf: (This frontend requires a controlling tty.)
==> hcloud.arm: debconf: falling back to frontend: Teletype
==> hcloud.arm: dpkg-preconfigure: unable to re-open stdin:
    hcloud.arm: Fetched 677 kB in 0s (13.5 MB/s)
    hcloud.arm: Selecting previously unselected package libsigsegv2:arm64.
    hcloud.arm: (Reading database ... 64495 files and directories currently installed.)
    hcloud.arm: Preparing to unpack .../libsigsegv2_2.14-1_arm64.deb ...
    hcloud.arm: Unpacking libsigsegv2:arm64 (2.14-1) ...
    hcloud.arm: Setting up libsigsegv2:arm64 (2.14-1) ...
    hcloud.arm: Selecting previously unselected package gawk.
    hcloud.arm: (Reading database ... 64504 files and directories currently installed.)
    hcloud.arm: Preparing to unpack .../gawk_1%3a5.2.1-2_arm64.deb ...
    hcloud.arm: Unpacking gawk (1:5.2.1-2) ...
    hcloud.arm: Setting up gawk (1:5.2.1-2) ...
    hcloud.arm: Processing triggers for man-db (2.11.2-2) ...
    hcloud.arm: Processing triggers for libc-bin (2.36-9+deb12u4) ...
==> hcloud.arm: Error: return code 4 from VERSION_ID=$(wget ${WGET_ARGS} -qO- "${VERSIONTXT_URL}" | sed -n 's/^FLATCAR_VERSION=//p')
==> hcloud.arm: Provisioning step had errors: Running the cleanup provisioner, if present...
==> hcloud.arm: Destroying server...
==> hcloud.arm: Deleting temporary SSH key...
Build 'hcloud.arm' errored after 2 minutes 22 seconds: Script exited with non-zero exit status: 4. Allowed exit codes are: [0]

==> Wait completed after 2 minutes 22 seconds

==> Some builds didn't complete successfully and had errors:
--> hcloud.arm: Script exited with non-zero exit status: 4. Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.
apricote commented 2 weeks ago

It looks like the Flatcar server that we try to reach for version information does not have an associated AAAA (IPv6) record, so an IPv6-only server is unable to contact it. You should raise this with the Flatcar team.

$ dig AAAA alpha.release.flatcar-linux.net

; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> AAAA alpha.release.flatcar-linux.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31545
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;alpha.release.flatcar-linux.net. IN    AAAA

;; ANSWER SECTION:
alpha.release.flatcar-linux.net. 91 IN  CNAME   update.release.flatcar-linux.net.

;; AUTHORITY SECTION:
release.flatcar-linux.net. 91   IN  NS  ns-1588.awsdns-06.co.uk.
release.flatcar-linux.net. 91   IN  NS  ns-121.awsdns-15.com.
release.flatcar-linux.net. 91   IN  NS  ns-1183.awsdns-19.org.
release.flatcar-linux.net. 91   IN  NS  ns-871.awsdns-44.net.
release.flatcar-linux.net. 60   IN  SOA ns-1588.awsdns-06.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400

;; ADDITIONAL SECTION:
update.release.flatcar-linux.net. 91 IN A   147.75.87.17

;; Query time: 11 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Tue Jul 02 07:36:17 UTC 2024
;; MSG SIZE  rcvd: 295

IPv4 (A) record:


$ dig A alpha.release.flatcar-linux.net

; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> A alpha.release.flatcar-linux.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40775
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;alpha.release.flatcar-linux.net. IN    A

;; ANSWER SECTION:
alpha.release.flatcar-linux.net. 77 IN  CNAME   update.release.flatcar-linux.net.
update.release.flatcar-linux.net. 77 IN A   147.75.87.17

;; AUTHORITY SECTION:
release.flatcar-linux.net. 77   IN  NS  ns-1183.awsdns-19.org.
release.flatcar-linux.net. 77   IN  NS  ns-1588.awsdns-06.co.uk.
release.flatcar-linux.net. 77   IN  NS  ns-121.awsdns-15.com.
release.flatcar-linux.net. 77   IN  NS  ns-871.awsdns-44.net.

;; Query time: 3 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Tue Jul 02 07:36:30 UTC 2024
;; MSG SIZE  rcvd: 234