balena-io-modules / balena-preload

Script for preloading containers onto balena device images
https://www.balena.io/
Apache License 2.0
35 stars 8 forks source link

Failed with error "sfdisk: failed to dump partition table: No error information" #197

Closed dirkmoors closed 5 years ago

dirkmoors commented 5 years ago

When i run docker info:

$ docker info                                                                                             

Containers: 184
 Running: 2
 Paused: 0
 Stopped: 182
Images: 2475
Server Version: 18.09.1
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 96ec2177ae841256168fcf76954f7177af9446eb
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-45-generic
Operating System: Ubuntu 18.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.29GiB
Name: dirkworkstation
ID: 7IO3:GNLJ:4MPU:24RF:VG6W:WEUJ:E6L3:XEBP:PL4E:IVGE:KPGU:Z25K
Docker Root Dir: /data/docker
Debug Mode (client): false
Debug Mode (server): false
Username: dirkmoors
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support

When I run the "balena-preload" command: (By the way, the same behavior occurs when using the arguments instead of the environment variables)

APP_ID=XXXXXX IMAGE=~/Downloads/balena-cloud-playerrpi3-raspberrypi3-2.29.2+rev2-v9.0.1.img.zip API_TOKEN=$BALENA_API_TOKEN COMMIT=YYYYYYYYYYYYYYYYYYYYYYYYYYY SPLASH_IMAGE=~/Downloads/resin-logo.png balena-preload
Building Docker preloader image. [========================] 100%

- Checking if the image is an edison zip archive
| Creating preloader container
- Starting preloader container

{ Error: Step 1/7 : FROM docker:17.10.0-ce-dind
 ---> 9769e0f3f9cb
Step 2/7 : RUN apk update && apk add --no-cache python3 parted btrfs-progs docker util-linux sfdisk file coreutils sgdisk
 ---> Using cache
 ---> 4f9d717d0a0b
Step 3/7 : COPY ./requirements.txt /tmp/
 ---> Using cache
 ---> 526dfe347122
Step 4/7 : RUN pip3 install -r /tmp/requirements.txt
 ---> Using cache
 ---> 30406c78dc55
Step 5/7 : COPY ./src /usr/src/app
 ---> Using cache
 ---> 7c19ce66416a
Step 6/7 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 6e7bcb6fc4ec
Step 7/7 : CMD ["python3", "/usr/src/app/preload.py"]
 ---> Using cache
 ---> 1e1ca3549497
Successfully built 1e1ca3549497
Successfully tagged balena/balena-preload:latest
Traceback (most recent call last):
  File "/usr/src/app/preload.py", line 794, in <module>
    PARTITIONS_CACHE[None] = prepare_global_partitions()
  File "/usr/src/app/preload.py", line 76, in prepare_global_partitions
    return get_partitions(IMAGE)
  File "/usr/src/app/preload.py", line 65, in get_partitions
    return {p.label: p for p in PartitionTable(image).partitions if p.label}
  File "/usr/src/app/preload.py", line 368, in __init__
    sfdisk("--dump", "--json", image).stdout.decode("utf8")
  File "/usr/lib/python3.6/site-packages/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/usr/lib/python3.6/site-packages/sh.py", line 774, in __init__
    self.wait()
  File "/usr/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /sbin/sfdisk --dump --json /img/balena.img

  STDOUT:

  STDERR:
sfdisk: failed to dump partition table: No error information
    at container.wait.then (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/lib/preload.js:336:19)
    at tryCatcher (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/dirk/.nvm/versions/node/v11.10.0/lib/node_modules/balena-preload/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate (timers.js:637:19) code: 1 }

Looks like this might be an issue with balena-preload. Please report it at https://github.com/balena-io/balena-preload/issues
dirkmoors commented 5 years ago
$ node --version
v11.10.0
$ npm --version
6.7.0
dirkmoors commented 5 years ago

This issue went away when I unzipped the image, and referenced the image like this:

APP_ID=XXXXXX IMAGE=~/Downloads/balena-cloud-playerrpi3-raspberrypi3-2.29.2+rev2-v9.0.1.img API_TOKEN=$BALENA_API_TOKEN COMMIT=YYYYYYYYYYYYYYYYYYYYYYYYYYY SPLASH_IMAGE=~/Downloads/resin-logo.png balena-preload