Unable to create preload image

Hello,

We use Balena in an enterprise environment.
After successful deployment of our new release I have been tasked to create a preload Balena image with our latest release.
But I have attempted multiple times on fresh Ubuntu virtual machines and always get same error. This is with then latest Balena CLI, Ubuntu 24.04 and Docker

Successfully logged in as: kobr

Find out about the available commands by running:

$ balena help

For further help or support, visit:

root@mate:/home/user/balena-cli# ./balena preload /home/user/Desktop/img/balena-cloud-PROD-Edge-generic-amd64-5.3.21+rev2-v16.3.15.img --fleet PROD-Edge --commit [REDACTED]
Building Docker preloader image. [========================] 100%
| Checking that the image is a writable file
| Finding a free tcp port
/ Creating preloader container

  • Starting preloader container
    | Reading image information
    / Reading image information
  • Cleaning up temporary files
    An error has occurred executing internal preload command ‘get_image_info’:
    {“command”:“get_image_info”,“parameters”:{}}

Status code: 1
Error: Traceback (most recent call last):
File “/usr/src/app/preload.py”, line 978, in
result = method(**data.get(“parameters”, {}))
File “/usr/src/app/preload.py”, line 935, in get_image_info
“config”: get_config(),
File “/usr/src/app/preload.py”, line 705, in get_config
data = get_json(partition_name, “config.json”, image=image)
File “/usr/src/app/preload.py”, line 691, in get_json
return json.load(f)
File “/usr/lib/python3.8/json/init.py”, line 293, in load
return loads(fp.read(),
File “/usr/lib/python3.8/json/init.py”, line 357, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.8/json/decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.8/json/decoder.py”, line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 15 column 5 (char 553)

Additional information may be available with the --debug flag.

For further help or support, visit:

root@mate:/home/user/balena-cli#

While using the --debug options I get more information, but it is not very informative.
Maybe someone can get me on track what is wrong here ?

An error has occurred executing internal preload command ‘get_image_info’:
{“command”:“get_image_info”,“parameters”:{}}

Status code: 1
Error: Traceback (most recent call last):
File “/usr/src/app/preload.py”, line 978, in
result = method(**data.get(“parameters”, {}))
File “/usr/src/app/preload.py”, line 935, in get_image_info
“config”: get_config(),
File “/usr/src/app/preload.py”, line 705, in get_config
data = get_json(partition_name, “config.json”, image=image)
File “/usr/src/app/preload.py”, line 691, in get_json
return json.load(f)
File “/usr/lib/python3.8/json/init.py”, line 293, in load
return loads(fp.read(),
File “/usr/lib/python3.8/json/init.py”, line 357, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.8/json/decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.8/json/decoder.py”, line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 15 column 5 (char 553)

Error: An error has occurred executing internal preload command ‘get_image_info’:
{“command”:“get_image_info”,“parameters”:{}}

Status code: 1
Error: Traceback (most recent call last):
File “/usr/src/app/preload.py”, line 978, in
result = method(**data.get(“parameters”, {}))
File “/usr/src/app/preload.py”, line 935, in get_image_info
“config”: get_config(),
File “/usr/src/app/preload.py”, line 705, in get_config
data = get_json(partition_name, “config.json”, image=image)
File “/usr/src/app/preload.py”, line 691, in get_json
return json.load(f)
File “/usr/lib/python3.8/json/init.py”, line 293, in load
return loads(fp.read(),
File “/usr/lib/python3.8/json/init.py”, line 357, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.8/json/decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.8/json/decoder.py”, line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 15 column 5 (char 553)

at PassThrough.<anonymous> (/snapshot/balena-cli/node_modules/balena-preload/build/preload.js:262:28)
at Object.onceWrapper (node:events:633:26)
at PassThrough.emit (node:events:518:28)
at PassThrough.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at node:internal/streams/transform:178:12
at PassThrough._transform (node:internal/streams/passthrough:46:3)
at Transform._write (node:internal/streams/transform:171:8)
at writeOrBuffer (node:internal/streams/writable:564:12)
at _write (node:internal/streams/writable:493:10)
at Writable.write (node:internal/streams/writable:502:10)
at processData (/snapshot/balena-cli/node_modules/docker-modem/lib/modem.js:454:18)
at Socket.processData (/snapshot/balena-cli/node_modules/docker-modem/lib/modem.js:448:9)
at Socket.emit (node:events:518:28)

From previous event:
at Preloader._runCommand (/snapshot/balena-cli/node_modules/balena-preload/build/preload.js:229:16)
at /snapshot/balena-cli/node_modules/balena-preload/build/preload.js:337:38
at Preloader._runWithSpinner (/snapshot/balena-cli/node_modules/balena-preload/build/preload.js:204:26)
at Preloader._getImageInfo (/snapshot/balena-cli/node_modules/balena-preload/build/preload.js:336:20)
at /snapshot/balena-cli/node_modules/balena-preload/build/preload.js:645:22
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

For further help or support, visit:

root@mate:/home/user/balena-cli#

Thank you
kobr

Resolved on my own.
The error means that the balena-cli cannot read config.json
Apparently Balena cannot read config.json after formatting.
Need to be very meticulous when editing config.json.