fix(first-boot): add nss-lookup.target ordering and DNS readiness gate
- commit
- 84702fe7d3c5f168f99ff2c6fd888c3ead65e529
- author
- brice · · 2026-03-02 05:44 UTC
- committer
- brice · · 2026-03-02 05:46 UTC
- parent
- 99430f3
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +21 -2
M install/mandatory/post-boot/all.sh +19 -0
| @@ -3,6 +3,25 @@ | |||
| 3 | 3 | ||
| 4 | 4 | LOG_FILE="/var/log/archup-first-boot.log" | |
| 5 | 5 | ||
| 6 | + | # --- DNS readiness gate --- | |
| 7 | + | wait_for_dns() { | |
| 8 | + | local host="archlinux.org" | |
| 9 | + | local timeout=120 | |
| 10 | + | local elapsed=0 | |
| 11 | + | while [ "$elapsed" -le "$timeout" ]; do | |
| 12 | + | if getent ahosts "$host" >/dev/null 2>&1; then | |
| 13 | + | echo "[first-boot] DNS ready after ${elapsed}s" | tee -a "$LOG_FILE" | |
| 14 | + | return 0 | |
| 15 | + | fi | |
| 16 | + | sleep 2 | |
| 17 | + | elapsed=$((elapsed + 2)) | |
| 18 | + | done | |
| 19 | + | echo "[first-boot] FATAL: DNS not ready after ${timeout}s — aborting" | tee -a "$LOG_FILE" | |
| 20 | + | return 1 | |
| 21 | + | } | |
| 22 | + | ||
| 23 | + | wait_for_dns || exit 1 | |
| 24 | + | ||
| 6 | 25 | # Display ArchUp logo | |
| 7 | 26 | if [ -f /usr/local/share/archup/logo.txt ]; then | |
| 8 | 27 | cat /usr/local/share/archup/logo.txt | |
| @@ -3,6 +3,25 @@ | |||||
| 3 | 3 | ||||
| 4 | LOG_FILE="/var/log/archup-first-boot.log" | 4 | LOG_FILE="/var/log/archup-first-boot.log" | ||
| 5 | 5 | ||||
| 6 | + | # --- DNS readiness gate --- | |||
| 7 | + | wait_for_dns() { | |||
| 8 | + | local host="archlinux.org" | |||
| 9 | + | local timeout=120 | |||
| 10 | + | local elapsed=0 | |||
| 11 | + | while [ "$elapsed" -le "$timeout" ]; do | |||
| 12 | + | if getent ahosts "$host" >/dev/null 2>&1; then | |||
| 13 | + | echo "[first-boot] DNS ready after ${elapsed}s" | tee -a "$LOG_FILE" | |||
| 14 | + | return 0 | |||
| 15 | + | fi | |||
| 16 | + | sleep 2 | |||
| 17 | + | elapsed=$((elapsed + 2)) | |||
| 18 | + | done | |||
| 19 | + | echo "[first-boot] FATAL: DNS not ready after ${timeout}s — aborting" | tee -a "$LOG_FILE" | |||
| 20 | + | return 1 | |||
| 21 | + | } | |||
| 22 | + | ||||
| 23 | + | wait_for_dns || exit 1 | |||
| 24 | + | ||||
| 6 | # Display ArchUp logo | 25 | # Display ArchUp logo | ||
| 7 | if [ -f /usr/local/share/archup/logo.txt ]; then | 26 | if [ -f /usr/local/share/archup/logo.txt ]; then | ||
| 8 | cat /usr/local/share/archup/logo.txt | 27 | cat /usr/local/share/archup/logo.txt | ||
M install/mandatory/post-boot/archup-first-boot.service +2 -2
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | [Unit] | |
| 2 | 2 | Description=ArchUp First Boot Setup | |
| 3 | - | After=local-fs.target systemd-logind.service dbus.service network-online.target | |
| 4 | - | Wants=network-online.target | |
| 3 | + | After=local-fs.target systemd-logind.service dbus.service network-online.target nss-lookup.target | |
| 4 | + | Wants=network-online.target nss-lookup.target | |
| 5 | 5 | ConditionPathExists=!/var/lib/archup-first-boot-complete | |
| 6 | 6 | ||
| 7 | 7 | [Service] | |
| @@ -1,7 +1,7 @@ | |||||
| 1 | [Unit] | 1 | [Unit] | ||
| 2 | Description=ArchUp First Boot Setup | 2 | Description=ArchUp First Boot Setup | ||
| 3 | - | After=local-fs.target systemd-logind.service dbus.service network-online.target | 3 | + | After=local-fs.target systemd-logind.service dbus.service network-online.target nss-lookup.target |
| 4 | - | Wants=network-online.target | 4 | + | Wants=network-online.target nss-lookup.target |
| 5 | ConditionPathExists=!/var/lib/archup-first-boot-complete | 5 | ConditionPathExists=!/var/lib/archup-first-boot-complete | ||
| 6 | 6 | ||||
| 7 | [Service] | 7 | [Service] | ||