[Bug 2137175] [NEW] curtin crashes if os-release contains hashmarks
Alan Baghumian
2137175 at bugs.launchpad.net
Sat Dec 27 23:44:01 UTC 2025
Public bug reported:
While working on updating support for SLES16 in packer-maas I came
across this trace during deployments:
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stdout: start: cmd-install/stage-curthooks/builtin/cmd-curthooks: curtin command curthooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: running /tmp/tmpxsvc5qnw/target/curtin/curtin-hooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Running command ['/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks'] with allowed return codes [0] (capture=False)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Traceback (most recent call last):
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks", line 94, in <module>
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: main()
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks", line 89, in main
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: curthook(config, target, state)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks", line 45, in curthook
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: distro_info = distro.get_distroinfo(target=target)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/distro.py", line 119, in get_distroinfo
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: variant_os_release = os_release(target=target)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/distro.py", line 80, in os_release
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: data = load_shell_content(load_file(os_release),
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 1310, in load_shell_content
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: key, value = line.split("=", 1)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: ValueError: not enough values to unpack (expected 2, got 1)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Traceback (most recent call last):
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/commands/main.py", line 202, in main
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: ret = args.func(args)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/commands/curthooks.py", line 1915, in curthooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: if util.run_hook_if_exists(target, 'curtin-hooks'):
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 984, in run_hook_if_exists
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: subp([target_hook])
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 280, in subp
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: return _subp(*args, **kwargs)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 144, in _subp
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: raise ProcessExecutionError(stdout=out, stderr=err,
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: curtin.util.ProcessExecutionError: Unexpected error while running command.
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Command: ['/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks']
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Exit code: 1
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Reason: -
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stdout: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stderr: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Unexpected error while running command.
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Command: ['/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks']
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Exit code: 1
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Reason: -
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stdout: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stderr: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]:
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stderr: ''
Looking deeper this was caused by the presence of some comment lines in
SLES16's /etc/os-release file. I worked around the issue by applying a
custom curtin hook to address this during the custom image build,
however this needs to get addressed both in curtin and MAAS which uses a
custom curtin branch.
Steps to reproduce: Try to deploy an image that has an /etc/os-release file containing lines starting with # sign.
Expected behavior (what should have happened?): curtin should have ignored the comment lines and not crashed.
Actual behavior (what actually happened?): curtin crashes leading to a
failed deployment with the above trace.
MAAS version and installation type (deb, snap): This was reproduced in a
MAAS 3.4.7 lab, however it is not directly MAAS related. The latest
curtin code branch still has this issue.
** Affects: curtin
Importance: Undecided
Status: New
** Affects: maas
Importance: Undecided
Status: New
** Also affects: curtin
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to curtin.
https://bugs.launchpad.net/bugs/2137175
Title:
curtin crashes if os-release contains hashmarks
Status in curtin:
New
Status in MAAS:
New
Bug description:
While working on updating support for SLES16 in packer-maas I came
across this trace during deployments:
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stdout: start: cmd-install/stage-curthooks/builtin/cmd-curthooks: curtin command curthooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: running /tmp/tmpxsvc5qnw/target/curtin/curtin-hooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Running command ['/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks'] with allowed return codes [0] (capture=False)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Traceback (most recent call last):
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks", line 94, in <module>
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: main()
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks", line 89, in main
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: curthook(config, target, state)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks", line 45, in curthook
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: distro_info = distro.get_distroinfo(target=target)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/distro.py", line 119, in get_distroinfo
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: variant_os_release = os_release(target=target)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/distro.py", line 80, in os_release
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: data = load_shell_content(load_file(os_release),
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 1310, in load_shell_content
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: key, value = line.split("=", 1)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: ValueError: not enough values to unpack (expected 2, got 1)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Traceback (most recent call last):
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/commands/main.py", line 202, in main
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: ret = args.func(args)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/commands/curthooks.py", line 1915, in curthooks
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: if util.run_hook_if_exists(target, 'curtin-hooks'):
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 984, in run_hook_if_exists
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: subp([target_hook])
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 280, in subp
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: return _subp(*args, **kwargs)
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: File "/curtin/curtin/util.py", line 144, in _subp
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: raise ProcessExecutionError(stdout=out, stderr=err,
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: curtin.util.ProcessExecutionError: Unexpected error while running command.
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Command: ['/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks']
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Exit code: 1
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Reason: -
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stdout: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stderr: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Unexpected error while running command.
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Command: ['/tmp/tmpxsvc5qnw/target/curtin/curtin-hooks']
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Exit code: 1
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Reason: -
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stdout: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stderr: ''
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]:
2025-12-12T18:14:47-08:00 small-4 cloud-init[1782]: Stderr: ''
Looking deeper this was caused by the presence of some comment lines
in SLES16's /etc/os-release file. I worked around the issue by
applying a custom curtin hook to address this during the custom image
build, however this needs to get addressed both in curtin and MAAS
which uses a custom curtin branch.
Steps to reproduce: Try to deploy an image that has an /etc/os-release file containing lines starting with # sign.
Expected behavior (what should have happened?): curtin should have ignored the comment lines and not crashed.
Actual behavior (what actually happened?): curtin crashes leading to a
failed deployment with the above trace.
MAAS version and installation type (deb, snap): This was reproduced in
a MAAS 3.4.7 lab, however it is not directly MAAS related. The latest
curtin code branch still has this issue.
To manage notifications about this bug go to:
https://bugs.launchpad.net/curtin/+bug/2137175/+subscriptions
More information about the foundations-bugs
mailing list