← Back to issue list

"Invalid hostname" error when packing charm that runs on multiple bases

View original Github issue

Metadata

Project
charmcraft
Number
#2158
Type
issue
State
closed
Author
jneo8
Labels
—
Created
Updated
Closed

Current evaluation

The invalid-hostname failure was fixed by canonical/craft-providers#722 (commit cabdba5), removing underscores from generated hostnames. The fix shipped through Charmcraft; Microceph's network error was Docker-related.

Resolution: closed resolved

Reason: Maintainer @lengau identified craft-providers#722 as the fix and confirmed an updated provider had been released through Charmcraft. The reporter also confirmed that removing Docker and restarting resolved the separate Microceph network failure.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description Failed to pack charm with latest release (version 3.4.2) ### To Reproduce Case 1 charm-microceph: ``` $ git clone https://github.com/canonical/charm-microceph $ cd charm-microceph $ charmcraft pack -v Starting charmcraft, version 3.4.2 Logging execution to '/home/jneo8/.local/state/charmcraft/log/charmcraft-20250211-161237.225112.log' Launching managed ubuntu 24.04 instance... Creating new instance from remote Creating new base instance from remote A network related operation failed in a context of no network access. Recommended resolution: Verify that the environment has internet connectivity; see https://canonical-craft-providers.readthedocs-hosted.com/en/latest/explanation/ for further reference. ``` Case 2 charm-openstack-service-checks: ``` $ git clone git@github.com:canonical/charm-openstack-service-checks.git $ cd charm-openstack-service-checks # This also run charmcraft pack $ make build Cleaning /home/jneo8/CanonicalProjects/charm-openstack-service-checks//openstack-service-checks*.charm files Cleaning charmcraft Building charm to base directory /home/jneo8/CanonicalProjects/charm-openstack-service-checks//openstack-service-checks.charm Starting charmcraft, version 3.4.2 Logging execution to '/home/jneo8/.local/state/charmcraft/log/charmcraft-20250211-160837.711984.log' Launching managed ubuntu 22.04 instance... Creating new instance from remote Creating new base instance from remote Failed to set hostname. * Command that failed: 'lxc --project charmcraft exec local:base-instance-charmcraft-buildd-base-v7--910533fdd664bd2cdbe9 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBC ONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical hostname -F /etc/hostname' * Command exit code: 1 * Command standard error output: b'hostname: the specified hostname is invalid\n' Full execution log: '/home/jneo8/.local/state/charmcraft/log/charmcraft-20250211-160837.711984.log' make: *** [Makefile:48: build] Error 1 ``` ### Environment Ubuntu 24.04 ### charmcraft.yaml ```yaml case1: https://github.com/canonical/charm-microceph/blob/main/charmcraft.yaml case2: https://github.com/canonical/charm-openstack-service-checks/blob/main/charmcraft.yaml ``` ### Relevant log output ```shell See above reproduce steps. ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved The invalid-hostname failure was fixed by canonical/craft-providers#722 (commit cabdba5), removing underscores from generated hostnames. The fix shipped through Charmcraft; Microceph's network error was Docker-related.
stealth/space-bunny-alpha — closed resolved Fixed by craft-providers#722 (commit cabdba5), removing underscores from generated hostnames; the updated provider was released through Charmcraft. Microceph’s separate network error was environmental (Docker).
stealth/space-bunny-alpha — closed resolved Resolved by canonical/craft-providers#722, which removed underscores from generated hostnames and was released in an updated Charmcraft snap. The microceph failure was environmental, caused by Docker.
qwen3.6-35b-a3b-mtp-q6 — — Resolved via craft-providers PR #722 and released in an updated snap. The hostname error during charm packing was fixed upstream. The first case was environmental and resolved locally. Issue closed after release.
qwen/qwen3.6-35b-a3b — — Resolved via craft-providers PR #722. The invalid hostname error during multi-base charm packing was fixed, and the updated snap was published to the candidate channel. The reporter verified the fix and requested closure.
qwen/qwen3.6-35b-a3b — — The invalid hostname error was fixed by merging craft-providers PR #722. The initial network failure was environment-specific. The updated package was released to the candidate channel, and the issue was closed.
qwen3.6-35b-a3b-mtp-q6 — — The invalid hostname error during charm packing was fixed in craft-providers PR #722 and released to the candidate channel. The initial network error was environment-specific and resolved by removing Docker. Issue closed.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-providers#722 (confidence 100%)

    Commit cabdba5 removed underscores from generated provider hostnames, preventing the invalid-hostname failure.

Related issues

Issue Project State Summary Similarity
#2133 Build fails when multiple run-on are specified charmcraft closed Fixed in Charmcraft 3.4.3 via craft-providers PR #722, which removes underscores from hostnames generated for multiple run-on targets.
71%
#2686 `charmcraft pack` Internal error on a 26.04 host charmcraft closed Fixed in the latest edge build; commit eeca3f79 (PR #2764) updated craft-providers to >=3.7.1 for newer Ubuntu base support.
71%