Getting an error on CLI resin preload, bug?

Ran this same command yesterday, ran fine. Now I’m getting an error on preload :frowning:

I have tried this with 2 diferrent apps and get the same error.

$ resin version
7.1.0
$ npm -v
5.7.1
$ docker -v
Docker version 17.12.0-ce, build c97c6d6 

$  resin preload resin-perfmonzerow-2.12.3+rev1-v7.1.14.img.zip


##### previous steps ok
Step 7/7 : CMD /usr/src/app/preload.py
 ---> Running in 4b2ad6330a8a
Removing intermediate container 4b2ad6330a8a
 ---> c0272782c14c
Successfully built c0272782c14c
Successfully tagged resin/resin-preload:latest
Traceback (most recent call last):
  File "/usr/src/app/preload.py", line 774, 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/resin.img

  STDOUT:


  STDERR:
sfdisk: failed to dump partition table: No error information
    at container.wait.then (/usr/local/lib/node_modules/resin-cli/node_modules/resin-preload/lib/preload.js:319:19)
    at tryCatcher (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/resin-cli/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
    at process.topLevelDomainCallback (domain.js:101:23) code: 1 }

Hello rcullen

What is the device type of this image?
What OS are you using?
Did something changed since yesterday when it ran fine (image, cli or anything else) ?

hey @zvin, thanks for jumping on this.

I’ve tried it with both raspberrypi3 and raspberry-pi device type apps
macos High Sierra 10.13.3

To be honest I don’t remember 100% what has changed about my environment since yesterday. I remember updating the resin-cli yesterday and again today.

I am about to try it on another mac to see if I can reproduce the error. Will report back.

I just checked one thing: this is the error you would get if you tried to preload a zip file.
Have you unzipped the image first?

@zvin oh man I was hoping that would solve it but I’m still getting the error.

I can also confirm it’s happening on two different machines. I setup a brand new app and used the simple node server example and I’m still getting the error.

Thanks for the quick responses, I really appreciate it.

Could you please run hdiutil imageinfo /path/to/image on the image you’re trying to preload?

$ hdiutil imageinfo resin-preloadtest-2.12.3+rev1-v7.1.14.img
Backing Store Information:
	URL: file:///Users/rodcul/dev/securedge/perfmon/img/simple-server-node/resin-preloadtest-2.12.3+rev1-v7.1.14.img
	Name: resin-preloadtest-2.12.3+rev1-v7.1.14.img
	Class Name: CBSDBackingStore
Class Name: CRawDiskImage
Checksum Type: none
Size Information:
	Total Bytes: 1807745024
	Compressed Ratio: 1
	Sector Count: 3530752
	Total Non-Empty Bytes: 1807745024
	Compressed Bytes: 1807745024
	Total Empty Bytes: 0
Format: RAW*
Format Description: raw read/write
Checksum Value:
Properties:
	Encrypted: false
	Kernel Compatible: true
	Checksummed: false
	Software License Agreement: false
	Partitioned: false
	Compressed: no
Segments:
	0: /Users/rodcul/dev/securedge/perfmon/img/simple-server-node/resin-preloadtest-2.12.3+rev1-v7.1.14.img
partitions:
	partition-scheme: fdisk
	block-size: 512
	partitions:
		0:
			partition-name: Master Boot Record
			partition-start: 0
			partition-synthesized: true
			partition-length: 1
			partition-hint: MBR
			boot-code: 0xFAB800108ED0BC00B0B800008ED88EC0FBBE007CBF0006B90002F3A4EA21060000BEBE073804750B83C61081FEFE0775F3EB16B402B001BB007CB2808A74018B4C02CD13EA007C0000EBFE00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002998809D0000
		1:
			partition-name:
			partition-start: 1
			partition-synthesized: true
			partition-length: 8191
			partition-hint: Apple_Free
		2:
			partition-start: 8192
			partition-number: 1
			partition-length: 81920
			partition-hint: Windows_FAT_16
			partition-filesystems:
				FAT16: resin-boot
		3:
			partition-start: 90112
			partition-number: 2
			partition-length: 638976
			partition-hint: Linux_Ext2FS
		4:
			partition-start: 729088
			partition-number: 3
			partition-length: 638976
			partition-hint: Linux_Ext2FS
		5:
			partition-name: Extended Partition Record
			partition-start: 1368064
			partition-synthesized: true
			partition-length: 1
			partition-hint: XPR
		6:
			partition-name:
			partition-start: 1368065
			partition-synthesized: true
			partition-length: 8191
			partition-hint: Apple_Free
		7:
			partition-start: 1376256
			partition-number: 5
			partition-length: 40960
			partition-hint: Linux_Ext2FS
		8:
			partition-name:
			partition-start: 1417216
			partition-synthesized: true
			partition-length: 8064
			partition-hint: Apple_Free
		9:
			partition-name: Extended Partition Record
			partition-start: 1425280
			partition-synthesized: true
			partition-length: 1
			partition-hint: XPR
		10:
			partition-name:
			partition-start: 1425281
			partition-synthesized: true
			partition-length: 127
			partition-hint: Apple_Free
		11:
			partition-start: 1425408
			partition-number: 6
			partition-length: 2105344
			partition-hint: Linux_Ext2FS
	burnable: false
Resize limits (per hdiutil resize -limits):
 min 	 cur 	 max
3530752	3530752	75807208

And here is the exact command:

$ resin preload resin-preloadtest-2.12.3+rev1-v7.1.14.img --app preloadtest

Heads up @zvin I have tried it with 2 other images and I get the same error.

This looks strange, could you please share your image ?
Upload it to a google drive for example and share it with me (alexis@resin.io). Please upload the zipped file.

Also could you please run a md5sum on the unzipped image ?

MD5 (resin-preloadtest-2.12.3+rev1-v7.1.14.img) = dd58f737bc9c563308cbd915d8141ea8

Uploading now, will share directly with email provided. Thanks!

I just checked the image and it there is nothing wrong with it.
I can preload it with resin-cli 7.1.1 on Ubuntu 17.10.

I’m using docker 17.03.2-ce so maybe the error comes from the more recent version you use. I’ll try updating docker and see if it works.

Just tried with docker-ce 18.03.0-ce, it worked.
For info the app you try to preload does not matter, the error you’re getting happens before any info about the app is fetched.
Could you please run DEBUG=1 resin preload /path/to/image.

Hey @zvin I just spent 2 hours getting ubuntu setup in a VM and I got the EXACT same error :frowning:

I am going to try running this on a remote server to remove the possiblity of it being something with my local connection. Any other suggestions?

$ DEBUG=1 resin preload resin-perfmon-2.12.3+rev1-v7.1.14.img --app perfmon
Building Docker preloader image. [===                     ] 12%
Step 1/7 : FROM docker:17.10.0-ce-dind
Building Docker preloader image. [======                  ] 25%
Step 2/7 : RUN apk update && apk add --no-cache python3 parted btrfs-progs docker util-linux sfdisk file coreutils sgdisk
 ---> Using cache
Building Docker preloader image. [=========               ] 37%
Step 3/7 : COPY ./requirements.txt /tmp/
 ---> Using cache
Building Docker preloader image. [============            ] 50%
Step 4/7 : RUN pip3 install -r /tmp/requirements.txt
 ---> Using cache
Building Docker preloader image. [===============         ] 62%
Step 5/7 : COPY ./src /usr/src/app
 ---> Using cache
Building Docker preloader image. [==================      ] 75%
Step 6/7 : WORKDIR /usr/src/app
 ---> Using cache
Building Docker preloader image. [=====================   ] 87%
Step 7/7 : CMD /usr/src/app/preload.py
 ---> Using cache
 ---> a587b7410681
Successfully built a587b7410681
Building Docker preloader image. [========================] 100%



/ Creating preloader container
/ Starting preloader container

| Cleaning up temporary files
Error: Unknown pine option: expand
    at exports.mergePineOptions (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-sdk/build/util/index.js:217:15)
    at /home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-sdk/build/models/application.js:176:20
    at tryCatcher (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/method.js:39:29)
    at Object.exports.get (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-sdk/build/models/application.js:159:26)
    at _runWithSpinner (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-preload/lib/preload.js:480:44)
    at Preloader._runWithSpinner (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-preload/lib/preload.js:303:12)
    at Preloader._fetchApplication (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-preload/lib/preload.js:479:17)
    at _build.then.then.spread.then.then.then.then.then.then (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/resin-preload/lib/preload.js:562:19)
    at tryCatcher (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/rodcul/.nvm/versions/node/v9.9.0/lib/node_modules/resin-cli/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
    at process.topLevelDomainCallback (domain.js:101:23)

Also happenning on a digital ocean Ubuntu 1604 LTS droplet :frowning:

@zvin can you post the exact command you are running please?

Ok it’s working, the problem was I was adding the “–app” flag without the “–commit” flag.

If I just ran resin preload file.img. and used the wizard to select app/commit it worked. There go 6h! Just glad it’s fixed. Thanks for the help.

Maybe you could update the docs:

–app, -a
id of the application to preload (requires --commit flag also)

https://docs.resin.io/reference/cli/#preload-image-

Examples: resin preload resin.img --app 1234 --commit e1f2592fc6ee949e68756d4f4a48e49bff8d72a0 --splash-image some-image.png resin preload resin.img

Hello Rodney,

I just spent 2 hours getting ubuntu setup in a VM and I got the EXACT same error

This is a different error. The first error you reported was fdisk not being able to read the partition table. This error is a problem with the resin-sdk being too recent for resin-preload (which resin-cli uses). It was introduced yesterday by an unrelated change. It has been fixed in resin-cli 7.1.3 that was just released.

the problem was I was adding the “–app” flag without the “–commit” flag

This should not be a problem: if you specify an app but no commit you should see a commit selection menu.