CLI balena preload hangs at "Reading image information"

Hi,
I’ve searched across various similar topics but could not find a solution.
I’m trying to preload an app to an image for flashing, but the process is stuck at “Reading image information”.
Command:

DEBUG=1 balena preload ~/Downloads/balena-cloud-manufacturing-raspberrypi0-2w-64-2.87.16+rev1-v12.11.0.img --fleet manufacturing --commit latest

Output:

[debug] original argv0="/usr/local/lib/balena-cli/bin/node" argv=[/usr/local/lib/balena-cli/bin/node,/usr/local/lib/balena-cli/bin/run,preload,/Users/fritz/Downloads/balena-cloud-manufacturing-raspberrypi0-2w-64-2.87.16+rev1-v12.11.0.img,--fleet,manufacturing,--commit,latest] length=8
[debug] new argv=[/usr/local/lib/balena-cli/bin/node,/usr/local/lib/balena-cli/bin/run,preload,/Users/fritz/Downloads/balena-cloud-manufacturing-raspberrypi0-2w-64-2.87.16+rev1-v12.11.0.img,--fleet,manufacturing,--commit,latest] length=8
[debug] Deprecation check: 0.05941 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.
[debug] Event tracking error: Timeout awaiting 'response' for 0ms
Building Docker preloader image. [===                     ] 12%
Step 1/7 : FROM alpine:3.12
Building Docker preloader image. [======                  ] 25%
Step 2/7 : WORKDIR /usr/src/app
 ---> Using cache
Building Docker preloader image. [=========               ] 37%
Step 3/7 : RUN apk add --no-cache curl py3-pip parted btrfs-progs util-linux sfdisk file coreutils sgdisk e2fsprogs-extra docker
 ---> Using cache
Building Docker preloader image. [============            ] 50%
Step 4/7 : COPY requirements.txt ./
 ---> Using cache
Building Docker preloader image. [===============         ] 62%
Step 5/7 : RUN pip3 install --no-cache-dir -r requirements.txt
 ---> Using cache
Building Docker preloader image. [==================      ] 75%
Step 6/7 : COPY src/ ./
 ---> Using cache
Building Docker preloader image. [=====================   ] 87%
Step 7/7 : CMD ["python3", "/usr/src/app/preload.py"]
 ---> Using cache
 ---> 0cafc2659267
Successfully built 0cafc2659267
Building Docker preloader image. [========================] 100%
| Checking that the image is a writable file
| Finding a free tcp port
| Checking if the image is an edison zip archive
- Creating preloader container
/ Starting preloader container
- Fetching application matthias1/manufacturing
- Reading image information

Any ideas?
Thanks

I just tried to do
balena logout
and then balena login.
Now I’m getting the following error:

[debug] original argv0="/usr/local/lib/balena-cli/bin/node" argv=[/usr/local/lib/balena-cli/bin/node,/usr/local/lib/balena-cli/bin/run,preload,/Users/fritz/Downloads/balena-cloud-manufacturing-raspberrypi0-2w-64-2.87.16+rev1-v12.11.0.img,--fleet,manufacturing,--commit,latest] length=8
[debug] new argv=[/usr/local/lib/balena-cli/bin/node,/usr/local/lib/balena-cli/bin/run,preload,/Users/fritz/Downloads/balena-cloud-manufacturing-raspberrypi0-2w-64-2.87.16+rev1-v12.11.0.img,--fleet,manufacturing,--commit,latest] length=8
[debug] Deprecation check: 0.06406 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.
[debug] Event tracking error: Timeout awaiting 'response' for 0ms
Building Docker preloader image. [===                     ] 12%
Step 1/7 : FROM alpine:3.12
Building Docker preloader image. [======                  ] 25%
Step 2/7 : WORKDIR /usr/src/app
 ---> Using cache
Building Docker preloader image. [=========               ] 37%
Step 3/7 : RUN apk add --no-cache curl py3-pip parted btrfs-progs util-linux sfdisk file coreutils sgdisk e2fsprogs-extra docker
 ---> Using cache
Building Docker preloader image. [============            ] 50%
Step 4/7 : COPY requirements.txt ./
 ---> Using cache
Building Docker preloader image. [===============         ] 62%
Step 5/7 : RUN pip3 install --no-cache-dir -r requirements.txt
 ---> Using cache
Building Docker preloader image. [==================      ] 75%
Step 6/7 : COPY src/ ./
 ---> Using cache
Building Docker preloader image. [=====================   ] 87%
Step 7/7 : CMD ["python3", "/usr/src/app/preload.py"]
 ---> Using cache
 ---> 0cafc2659267
Successfully built 0cafc2659267
Building Docker preloader image. [========================] 100%
| Checking that the image is a writable file
| Finding a free tcp port
| Checking if the image is an edison zip archive
| Creating preloader container
| Cleaning up temporary files
(HTTP code 409) unexpected - Conflict. The container name "/balena-image-preloader" is already in use by container "2638bf8a8cf93f05a51607415cb19455aff0c02749e4eae45b83b81047f015ef". You have to remove (or rename) that container to be able to reuse that name. 

Error: (HTTP code 409) unexpected - Conflict. The container name "/balena-image-preloader" is already in use by container "2638bf8a8cf93f05a51607415cb19455aff0c02749e4eae45b83b81047f015ef". You have to remove (or rename) that container to be able to reuse that name. 
    at /usr/local/lib/balena-cli/node_modules/docker-modem/lib/modem.js:315:17
    at getCause (/usr/local/lib/balena-cli/node_modules/docker-modem/lib/modem.js:345:7)
    at Modem.buildPayload (/usr/local/lib/balena-cli/node_modules/docker-modem/lib/modem.js:314:5)
    at IncomingMessage.<anonymous> (/usr/local/lib/balena-cli/node_modules/docker-modem/lib/modem.js:286:14)
    at IncomingMessage.emit (events.js:326:22)
    at IncomingMessage.EventEmitter.emit (domain.js:483:12)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
From previous event:
    at processImmediate (internal/timers.js:461:21)
From previous event:
    at Preloader.prepare (/usr/local/lib/balena-cli/node_modules/balena-preload/build/preload.js:660:48)
    at PreloadCmd.prepareAndPreload (/usr/local/lib/balena-cli/build/commands/preload.js:292:25)
    at /usr/local/lib/balena-cli/build/commands/preload.js:129:30
    at new Promise (<anonymous>)
    at PreloadCmd.run (/usr/local/lib/balena-cli/build/commands/preload.js:127:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async PreloadCmd._run (/usr/local/lib/balena-cli/node_modules/@oclif/command/lib/command.js:43:20)
    at async Config.runCommand (/usr/local/lib/balena-cli/node_modules/@oclif/config/lib/config.js:175:24)
    at async CustomMain.run (/usr/local/lib/balena-cli/node_modules/@oclif/command/lib/main.js:27:9)
    at async CustomMain._run (/usr/local/lib/balena-cli/node_modules/@oclif/command/lib/command.js:43:20)
    at async /usr/local/lib/balena-cli/build/app.js:76:13
    at async Promise.all (index 2)
    at async oclifRun (/usr/local/lib/balena-cli/build/app.js:94:5)
    at async Object.run (/usr/local/lib/balena-cli/build/app.js:107:9)
    at async run (/usr/local/lib/balena-cli/bin/run:20:2)

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting

How can I remove (or rename) this container?
Thanks

So, I could delete the container, now I’m stuck (again) at the previous issue, hanging at “Reading image information”.

Hello,

I’ll continue here as it might be useful for the community.

As the CLI preloader is using your local docker demon to run the preloading process, it starts a balena-image-preloder container. When it crashed on your first time, that container hasn’t been properly disposed of, so your second attempt fails.

To remove it you can use the docker cli : docker stop balena-image-preloder && docker rm balena-image-preloder.

For your other issue, can you try using the fleet id instead of name ?

I double check and using fleet name should work fine.

Which makes your logout/login a good idea, if it wasn’t stuck by the previous attempt.

Which version of docker and cli are you using ?

Hi @aethernet
thanks for your reply. I’m using Docker version 20.10.17, build 100c701
and Balena CLI 14.5.10
(I upgraded yesterday because it did not work before with 14.4, which I had installed previously).

I’ve been using this command exactly that way for years now, so there must be some new issue somewhere, which I don’t see.
Any ideas?
Thanks

Hello,

I’ve just reproduced on my end and will investigate.
In the meantime you can downgrade the CLI (I’ve preloaded with v13.6.0 earlier today successfully).

FYI I just opened a GitHub issue

Sorry, the issue is not with the CLI but with a regression in docker 20.10.17, you can downgrade docker as a workaround. (CLI preloading code didn’t change between 13.6 and 14.5 anyway).

Hi,
thanks, I can confirm downgrading to Docker Desktop 4.9.1 with Docker Engine 20.10.16 resolved the issue.
Cheers

1 Like

Awesome !

We’re working on a fix, should be quick.