aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-28 00:15:52 +0700
committerShulhan <ms@kilabit.info>2026-01-28 00:16:44 +0700
commit5aafb2bf78ba7e421d75cdef028850a6dc8c286f (patch)
treef245567c89165a8dc44431eb4e8c7c4088bbe434
parent701ad0f9188f0cba9e220c97aa78546a0da98344 (diff)
downloadcompute-archlinux-image-builder-5aafb2bf78ba7e421d75cdef028850a6dc8c286f.tar.xz
all: set the resolv.conf symlinked to systemd stub-resolv.conf
The default resolv.conf is empty. This cause program that depends on resolv.conf for name resolution will fail. As a test, we create small Go program "cmd/golookup" that can lookup IP address of host name using pure Go resolver (using/etc/resolv.conf).
-rw-r--r--.gitignore1
-rw-r--r--Makefile9
-rw-r--r--awwan.env2
-rwxr-xr-xbuild-arch-gce5
-rw-r--r--cmd/golookup/main.go21
-rw-r--r--current-images.txt86
-rw-r--r--gcloud-image-test.aww31
-rw-r--r--go.mod6
8 files changed, 141 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index d91d6d5..bdee8e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
*.log
*.raw
*.tar.gz
+golookup
diff --git a/Makefile b/Makefile
index aac02ab..8a6af9a 100644
--- a/Makefile
+++ b/Makefile
@@ -17,8 +17,8 @@ image.publish:
awwan local gcloud-image-cleanup.aww 5-
.PHONY: image.test
-image.test:
- awwan local gcloud-image-test.aww 4-18
+image.test: golookup
+ awwan local gcloud-image-test.aww 4-25
## Preview the .md files in local using [ciigo].
## Open http://127.0.0.1:8080/README.html to preview the README.
@@ -27,3 +27,8 @@ image.test:
.PHONY: serve.doc
serve.doc:
ciigo -address 127.0.0.1:8080 serve .
+
+golookup: CGO_ENABLED=0
+golookup: cmd/golookup/main.go
+ go build ./cmd/golookup
+ go version -m golookup
diff --git a/awwan.env b/awwan.env
index baae6df..2f55953 100644
--- a/awwan.env
+++ b/awwan.env
@@ -12,5 +12,5 @@ zone = asia-southeast1-b
storage = kilabit-staging
[host]
-image = arch-v20251226
+image = arch-v20260127
name = arch-test
diff --git a/build-arch-gce b/build-arch-gce
index 7a9559f..5046796 100755
--- a/build-arch-gce
+++ b/build-arch-gce
@@ -72,6 +72,7 @@ rsync -r /var/lib/pacman/sync/ $mount_dir/var/lib/pacman/sync/
echo '- Installing Arch Linux.'
pacstrap -c -C "./sys/etc/pacman.conf.org" -M -- "$mount_dir" \
base linux dosfstools e2fsprogs openssh polkit sudo \
+ systemd-resolvconf \
vim-minimal tmux mosh rsync unzip
cp -f ./sys/etc/pacman.conf "$mount_dir/etc/pacman.conf"
@@ -180,6 +181,10 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
echo '-- Running boot loader.'
bootctl install --no-variables --quiet
+ echo '-- Configuring stub for resolv.conf.'
+ umount /etc/resolv.conf
+ ln -fs /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
+
if [[ -n "${IMAGE_QEMU:-}" ]]; then
echo '-- IMAGE_QEMU: Creating user arch.'
useradd --create-home --groups wheel arch
diff --git a/cmd/golookup/main.go b/cmd/golookup/main.go
new file mode 100644
index 0000000..5649705
--- /dev/null
+++ b/cmd/golookup/main.go
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: 2026 M. Shulhan <ms@kilabit.info>
+
+// golookup program to test lookup for IP addresses using pure Go resolver
+// (using name server from /etc/resolv.conf, instead of nss APIs).
+package main
+
+import (
+ "fmt"
+ "log"
+ "net"
+ "os"
+)
+
+func main() {
+ addr, err := net.LookupHost(os.Args[1])
+ if err != nil {
+ log.Fatal(err)
+ }
+ fmt.Println(addr)
+}
diff --git a/current-images.txt b/current-images.txt
index 4bac44a..166c9f7 100644
--- a/current-images.txt
+++ b/current-images.txt
@@ -1,7 +1,7 @@
[
{
- "archiveSizeBytes": "1661890432",
- "creationTimestamp": "2025-12-25T05:29:49.707-08:00",
+ "archiveSizeBytes": "896192512",
+ "creationTimestamp": "2026-01-09T18:04:20.710-08:00",
"description": "Arch linux image with ops-agent. See https://github.com/shuLhan/compute-archlinux-image-builder",
"diskSizeGb": "10",
"enableConfidentialCompute": false,
@@ -17,15 +17,15 @@
"type": "VIRTIO_SCSI_MULTIQUEUE"
}
],
- "id": "7892614657072988835",
+ "id": "3216448522262678860",
"kind": "compute#image",
"labelFingerprint": "42WmSpB8rSM=",
- "name": "arch-v20251225",
+ "name": "arch-v20260110",
"rawDisk": {
"containerType": "TAR",
"source": ""
},
- "selfLink": "https://www.googleapis.com/compute/v1/projects/kilabit/global/images/arch-v20251225",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/kilabit/global/images/arch-v20260110",
"sourceType": "RAW",
"status": "READY",
"storageLocations": [
@@ -33,8 +33,8 @@
]
},
{
- "archiveSizeBytes": "961868992",
- "creationTimestamp": "2025-12-25T23:14:59.097-08:00",
+ "archiveSizeBytes": "908809536",
+ "creationTimestamp": "2026-01-17T00:20:09.507-08:00",
"description": "Arch linux image with ops-agent. See https://github.com/shuLhan/compute-archlinux-image-builder",
"diskSizeGb": "10",
"enableConfidentialCompute": false,
@@ -50,15 +50,81 @@
"type": "VIRTIO_SCSI_MULTIQUEUE"
}
],
- "id": "7907743400200473373",
+ "id": "2301751673695434967",
"kind": "compute#image",
"labelFingerprint": "42WmSpB8rSM=",
- "name": "arch-v20251226",
+ "name": "arch-v20260117",
"rawDisk": {
"containerType": "TAR",
"source": ""
},
- "selfLink": "https://www.googleapis.com/compute/v1/projects/kilabit/global/images/arch-v20251226",
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/kilabit/global/images/arch-v20260117",
+ "sourceType": "RAW",
+ "status": "READY",
+ "storageLocations": [
+ "asia"
+ ]
+ },
+ {
+ "archiveSizeBytes": "899870528",
+ "creationTimestamp": "2026-01-23T18:03:23.772-08:00",
+ "description": "Arch linux image with ops-agent. See https://github.com/shuLhan/compute-archlinux-image-builder",
+ "diskSizeGb": "10",
+ "enableConfidentialCompute": false,
+ "family": "arch",
+ "guestOsFeatures": [
+ {
+ "type": "GVNIC"
+ },
+ {
+ "type": "UEFI_COMPATIBLE"
+ },
+ {
+ "type": "VIRTIO_SCSI_MULTIQUEUE"
+ }
+ ],
+ "id": "827436971761178245",
+ "kind": "compute#image",
+ "labelFingerprint": "42WmSpB8rSM=",
+ "name": "arch-v20260124",
+ "rawDisk": {
+ "containerType": "TAR",
+ "source": ""
+ },
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/kilabit/global/images/arch-v20260124",
+ "sourceType": "RAW",
+ "status": "READY",
+ "storageLocations": [
+ "asia"
+ ]
+ },
+ {
+ "archiveSizeBytes": "954956544",
+ "creationTimestamp": "2026-01-27T08:52:34.148-08:00",
+ "description": "Arch linux image with ops-agent. See https://github.com/shuLhan/compute-archlinux-image-builder",
+ "diskSizeGb": "10",
+ "enableConfidentialCompute": false,
+ "family": "arch",
+ "guestOsFeatures": [
+ {
+ "type": "GVNIC"
+ },
+ {
+ "type": "UEFI_COMPATIBLE"
+ },
+ {
+ "type": "VIRTIO_SCSI_MULTIQUEUE"
+ }
+ ],
+ "id": "1063694025973126078",
+ "kind": "compute#image",
+ "labelFingerprint": "42WmSpB8rSM=",
+ "name": "arch-v20260127",
+ "rawDisk": {
+ "containerType": "TAR",
+ "source": ""
+ },
+ "selfLink": "https://www.googleapis.com/compute/v1/projects/kilabit/global/images/arch-v20260127",
"sourceType": "RAW",
"status": "READY",
"storageLocations": [
diff --git a/gcloud-image-test.aww b/gcloud-image-test.aww
index 6f8bf41..1ad1346 100644
--- a/gcloud-image-test.aww
+++ b/gcloud-image-test.aww
@@ -12,19 +12,36 @@ gcloud compute instances create arch-test \
gcloud compute instances describe arch-test \
--zone={{.Val "gcloud::zone"}}
-gcloud compute instances tail-serial-port-output {{.Val "host::name"}} \
+timeout 20s gcloud compute instances tail-serial-port-output \
--zone={{.Val "gcloud::zone"}} \
+ {{.Val "host::name"}} \
+ || exit 0
-gcloud compute ssh \
+gcloud compute scp \
--zone={{.Val "gcloud::zone"}} \
- --command="lsblk -o NAME,UUID,MOUNTPOINTS; cat /etc/fstab; \
- cat /etc/resolv.conf; timedatectl show-timesync; localectl; \
- sudo pacman -Sy" \
- --quiet \
- arch-test
+ golookup \
+ arch-test:~/
gcloud compute ssh \
--zone={{.Val "gcloud::zone"}} \
+ --command="\
+ echo '--- lsblk'; \
+ lsblk -o NAME,UUID,MOUNTPOINTS; \
+ echo '--- /etc/fstab'; \
+ cat /etc/fstab; \
+ echo '--- /etc/resolv.conf'; \
+ cat /etc/resolv.conf; \
+ echo '--- networkctl'; \
+ networkctl; \
+ echo '--- timedatectl'; \
+ timedatectl show-timesync; \
+ echo '--- localectl'; \
+ localectl; \
+ echo '--- pacman -Sy'; \
+ sudo pacman -Sy; \
+ echo '--- golookup'; \
+ ./golookup kilabit.info; \
+ " \
arch-test
## Test OS Login.
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..0b6423c
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: 2026 M. Shulhan <ms@kilabit.info>
+
+module github.com/shuLhan/compute-archlinux-image-builder
+
+go 1.25.0