[GH-ISSUE #319] bug(tools-image): guest hostname instance does not resolve locally #82

Open
opened 2026-10-29 14:19:21 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @LSX-s-Software on GitHub (Sep 25, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/319

Affected component

Firecracker runtime / guest bootstrap (tools-image/pivot-init)

AgentENV version

  • Version or commit: 725810de2d925d7908d44f18521ff3496e9360a1 (the relevant code is also present on current main)
  • Local modifications: none
  • Tools drive configured by that commit: 0.1.1

Host environment

  • Linux x86_64 with Firecracker/KVM.
  • The failure concerns name resolution inside the guest and does not depend on the host's hostname or DNS records. The exact host kernel and filesystem are not needed for the reproduction below.
  • Guest image: docker.io/library/eclipse-temurin:17-jdk-jammy (any image without an instance entry in /etc/hosts can expose the same problem).

Operation and configuration

Cold-start a sandbox from the public OCI image, using the default guest network and tools drive. No custom hostname or DNS settings are required.

Steps to reproduce

  1. Cold-start a sandbox from docker.io/library/eclipse-temurin:17-jdk-jammy.

  2. In the guest, run:

    hostname
    cat /etc/hosts
    getent -s files hosts "$(hostname)"
    
  3. In the same guest, run a Java self-lookup:

    printf '%s\n' 'class ResolveSelf { public static void main(String[] args) throws Exception { System.out.println(java.net.InetAddress.getLocalHost()); } }' > /tmp/ResolveSelf.java
    java /tmp/ResolveSelf.java
    

Expected behavior

The hostname assigned to the guest should resolve to a valid local address without relying on an external DNS server. Java's InetAddress.getLocalHost() should succeed.

Actual behavior

The guest hostname is instance, but instance is absent from the guest's local hosts mappings. A files-only lookup fails, and Java self-lookup can fail with:

java.net.UnknownHostException: instance: instance: Temporary failure in name resolution

The kernel boot argument sets the hostname to instance. The guest bootstrap writes only localhost entries when /etc/hosts is missing or empty, and leaves a non-empty file untouched. Neither path ensures that instance resolves.

Logs and diagnostics

The observed exception is shown above. The files-only getent probe distinguishes local hosts configuration from a DNS answer for the same name. No host networking failure is required.

Reproduction frequency

Always when the guest image does not already map instance locally and DNS does not provide that mapping. Whether ordinary lookups happen to succeed can otherwise depend on external DNS behavior.

Regression information

  • Last known good: never.
  • First known bad: always.

Additional context

#268 addressed missing or empty /etc/hosts for localhost, and the earlier #55 proposed a related localhost repair. Neither adds a mapping for the guest's own hostname. A fix should preserve image-provided entries and remain correct across cold starts and snapshot restores, where a slot IP may change.

Pre-submission checklist

  • I searched existing open and closed issues and did not find a duplicate for guest self-hostname resolution.
  • I provided a minimal reproduction.
  • I removed credentials, tokens, private image references, and other sensitive information.
  • This is not a security vulnerability.
Originally created by @LSX-s-Software on GitHub (Sep 25, 2026). Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/319 ### Affected component Firecracker runtime / guest bootstrap (`tools-image/pivot-init`) ### AgentENV version - Version or commit: `725810de2d925d7908d44f18521ff3496e9360a1` (the relevant code is also present on current `main`) - Local modifications: none - Tools drive configured by that commit: `0.1.1` ### Host environment - Linux x86_64 with Firecracker/KVM. - The failure concerns name resolution inside the guest and does not depend on the host's hostname or DNS records. The exact host kernel and filesystem are not needed for the reproduction below. - Guest image: `docker.io/library/eclipse-temurin:17-jdk-jammy` (any image without an `instance` entry in `/etc/hosts` can expose the same problem). ### Operation and configuration Cold-start a sandbox from the public OCI image, using the default guest network and tools drive. No custom hostname or DNS settings are required. ### Steps to reproduce 1. Cold-start a sandbox from `docker.io/library/eclipse-temurin:17-jdk-jammy`. 2. In the guest, run: ```sh hostname cat /etc/hosts getent -s files hosts "$(hostname)" ``` 3. In the same guest, run a Java self-lookup: ```sh printf '%s\n' 'class ResolveSelf { public static void main(String[] args) throws Exception { System.out.println(java.net.InetAddress.getLocalHost()); } }' > /tmp/ResolveSelf.java java /tmp/ResolveSelf.java ``` ### Expected behavior The hostname assigned to the guest should resolve to a valid local address without relying on an external DNS server. Java's `InetAddress.getLocalHost()` should succeed. ### Actual behavior The guest hostname is `instance`, but `instance` is absent from the guest's local hosts mappings. A files-only lookup fails, and Java self-lookup can fail with: ```text java.net.UnknownHostException: instance: instance: Temporary failure in name resolution ``` The kernel boot argument [sets the hostname to `instance`](https://github.com/kvcache-ai/AgentENV/blob/725810de2d925d7908d44f18521ff3496e9360a1/src/sandbox/network/slot.rs#L437-L448). The guest bootstrap [writes only `localhost` entries](https://github.com/kvcache-ai/AgentENV/blob/725810de2d925d7908d44f18521ff3496e9360a1/tools-image/pivot-init#L84-L91) when `/etc/hosts` is missing or empty, and leaves a non-empty file untouched. Neither path ensures that `instance` resolves. ### Logs and diagnostics The observed exception is shown above. The files-only `getent` probe distinguishes local hosts configuration from a DNS answer for the same name. No host networking failure is required. ### Reproduction frequency Always when the guest image does not already map `instance` locally and DNS does not provide that mapping. Whether ordinary lookups happen to succeed can otherwise depend on external DNS behavior. ### Regression information - Last known good: never. - First known bad: always. ### Additional context #268 addressed missing or empty `/etc/hosts` for `localhost`, and the earlier #55 proposed a related `localhost` repair. Neither adds a mapping for the guest's own hostname. A fix should preserve image-provided entries and remain correct across cold starts and snapshot restores, where a slot IP may change. ### Pre-submission checklist - [x] I searched existing open and closed issues and did not find a duplicate for guest self-hostname resolution. - [x] I provided a minimal reproduction. - [x] I removed credentials, tokens, private image references, and other sensitive information. - [x] This is not a security vulnerability.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#82
No description provided.