nuageinit(7) provides support for cloud-init (https://cloud-init.io/) to allow customisation of FreeBSD disk images on first boot. "BASIC-CLOUDINIT" images are built as part of the FreeBSD release process, with nuageinit configured to run on first boot. On previous FreeBSD releases (I have tested on 14.3 and 15.0), the "user-data" (or "user_data") file could be provided as a YAML file, with the first line reading "#cloud-config" (note there is a typo in the man page, which incorrectly specifies "#!cloud-config") or as an executable script, with a shebang like "#!/bin/sh -e". Historically, YAML support was quite limited and so I needed a shell script to provide my required functionality. Unfortunately, support for executable scripts is broken in CURRENT, 14.4-RELEASE and 15.1-RELEASE (awaiting beta testing at time of writing). The bug is in /usr/libexec/nuageinit (https://cgit.freebsd.org/src/tree/libexec/nuageinit/nuageinit) introduced in this commit: https://cgit.freebsd.org/src/commit/libexec/nuageinit/nuageinit?id=cae280931c9e1f072d8bf300c377ae120300b898 On line 732 (https://cgit.freebsd.org/src/blame/libexec/nuageinit/nuageinit?id=cae280931c9e1f072d8bf300c377ae120300b898#n732) the load_userdata() function attempts to parse the user-data file as YAML, then failing and exiting if that parsing is unsuccessful. Unfortunately, the check for whether the file contains YAML or not doesn't occur until line 760 (https://cgit.freebsd.org/src/blame/libexec/nuageinit/nuageinit?id=cae280931c9e1f072d8bf300c377ae120300b898#n760), which is run after the load_userdata() function has been called. It is therefore never possible to reach line 793, where a non-YAML, executable user-data file is handled. Possible workaround: Switch away from an executable user-data to YAML. I don't believe this will meet all my requirements since my existing script explicitly sets group IDs, which isn't supported in the YAML version.
I confirm the bug, this is an esy fix, I ll do it soon
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c316ec259011e9e22e40eaa72d834f3bfac95c28 commit c316ec259011e9e22e40eaa72d834f3bfac95c28 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:14:17 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-05-06 20:20:45 +0000 nuageinit: only parse user_data as yaml when necessary This fixes a regression introduced in cae280931c9e which prevents user_data as a shell script to be used PR: 295062 Reported by: Ross McKelvie <ross@exitzero.uk> MFC After: 1 day libexec/nuageinit/nuageinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2a86992ab5019b4997ccadf7427011ba44e33c97 commit 2a86992ab5019b4997ccadf7427011ba44e33c97 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:45:50 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-05-06 21:16:37 +0000 nuageninit: modify the test to show the issue fixed inc316ec259011 Ensure the script used is invalid when parsed by libyaml which highlight the issue revealed in PR295062 while at here validate the mode of the file is properly changed PR: 295062 MFC After: 1 day libexec/nuageinit/tests/nuageinit.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=da3414a1a8924327931cd8842a45693eeff7012a commit da3414a1a8924327931cd8842a45693eeff7012a Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:45:50 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-05-07 15:26:10 +0000 nuageninit: modify the test to show the issue fixed inc316ec259011 Ensure the script used is invalid when parsed by libyaml which highlight the issue revealed in PR295062 while at here validate the mode of the file is properly changed PR: 295062 MFC After: 1 day (cherry picked from commit 2a86992ab5019b4997ccadf7427011ba44e33c97) libexec/nuageinit/tests/nuageinit.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=4211f280ba087c75dcd84f9b592238b2eae33af9 commit 4211f280ba087c75dcd84f9b592238b2eae33af9 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:14:17 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-05-07 15:26:10 +0000 nuageinit: only parse user_data as yaml when necessary This fixes a regression introduced in cae280931c9e which prevents user_data as a shell script to be used PR: 295062 Reported by: Ross McKelvie <ross@exitzero.uk> MFC After: 1 day (cherry picked from commit c316ec259011e9e22e40eaa72d834f3bfac95c28) libexec/nuageinit/nuageinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=48862dc1d8fc03fec7523fe26c7b2e98be9d6bc9 commit 48862dc1d8fc03fec7523fe26c7b2e98be9d6bc9 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:45:50 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-05-07 15:28:03 +0000 nuageninit: modify the test to show the issue fixed inc316ec259011 Ensure the script used is invalid when parsed by libyaml which highlight the issue revealed in PR295062 while at here validate the mode of the file is properly changed PR: 295062 MFC After: 1 day (cherry picked from commit 2a86992ab5019b4997ccadf7427011ba44e33c97) libexec/nuageinit/tests/nuageinit.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e7913c8c79ec54d2522ca3311bad58ccecb27991 commit e7913c8c79ec54d2522ca3311bad58ccecb27991 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:14:17 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-05-07 15:28:03 +0000 nuageinit: only parse user_data as yaml when necessary This fixes a regression introduced in cae280931c9e which prevents user_data as a shell script to be used PR: 295062 Reported by: Ross McKelvie <ross@exitzero.uk> MFC After: 1 day (cherry picked from commit c316ec259011e9e22e40eaa72d834f3bfac95c28) libexec/nuageinit/nuageinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch releng/15.1 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=78c1ba506b858a1702720ea7e51b6a05a4691787 commit 78c1ba506b858a1702720ea7e51b6a05a4691787 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2026-05-06 20:14:17 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-05-07 20:18:43 +0000 nuageinit: only parse user_data as yaml when necessary This fixes a regression introduced in cae280931c9e which prevents user_data as a shell script to be used Approved by: re (cperciva) PR: 295062 Reported by: Ross McKelvie <ross@exitzero.uk> MFC After: 1 day (cherry picked from commit c316ec259011e9e22e40eaa72d834f3bfac95c28) (cherry picked from commit 4211f280ba087c75dcd84f9b592238b2eae33af9) libexec/nuageinit/nuageinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)