Cannot set hostname on Arch Linux
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned |
Bug Description
cloud-init fails to set the hostname on Arch Linux with the following error:
[CLOUDINIT] util.py[DEBUG]: Failed to set the hostname to dev1.localdomain (dev1)
Traceback (most recent call last):
File "/usr/lib/
cloud.
File "/usr/lib/
self.
File "/usr/lib/
util.
File "/usr/lib/
content = encode_
File "/usr/lib/
return text.encode(
AttributeError: 'HostnameConf' object has no attribute 'encode'
The bug is that _write_hostname passes conf instead of str(conf) to util.write_file (compare distros/
Related branches
- Scott Moser: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 13 lines (+1/-1)1 file modifiedcloudinit/distros/arch.py (+1/-1)
description: | updated |
Changed in cloud-init: | |
importance: | Undecided → Medium |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
Hi Jon! Thanks for taking the time to file this bug.
I tried to reproduce this using a lxc of arch and was unable to. Can you give me 1) the version of cloud-init you are using, 2) your cloud-config, 3) as well as your cloud-init log? Below is what I tried:
$ lxc launch images:archlinux arch /bugs.archlinux .org/task/ 53036
$ lxc exec arch bash
$ pacman -S cloud-init
# updated 05_logging.cfg per https:/
# - [ *log_base, *log_file ]
with
- [ *log_base ]
# And my user-data:
#cloud-config
hostname: foobar
$ cloud-init --file user-data single --name=set_hostname --frequency=always
$ hostname
foobar