[From nobody Thu Jun 25 05:55:36 2020
Received: from mr85p00im-ztdg06021101.me.com ([17.58.23.180])
 by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux))
 id 1imI0R-0008RA-Ow
 for openwrt-devel@lists.openwrt.org; Tue, 31 Dec 2019 13:56:21 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai;
 t=1577800577; bh=LEfbjleIftH4c9kkEUCEgH+DztYbygOuSjiS43UiQ6s=;
 h=Content-Type:Subject:From:Date:Message-Id:To;
 b=zxS+mFxFm6HTe0Juld6kLlAn72jHo1zWiPc2WM89dB1QZfibMWSL6qQe755dk+Tf5
 0Ld5cl6A6/chqsaKG5YUHx2txi8smAa1yVbpxDUDjAY3ma/rxCDQHPEvJDyaqsYFCJ
 Hz3L+Q5vl38jq8bWdBxXExgigRYva+i9ugx/SvDZBvfhNe3zt50wv5uxA08XUU04Ks
 4RzCSqpfq5Gj+cWJY43aPkkjQqvk4BWL6wGR7SE8ZRZVIMb6KtHIZ5zbatnK1Z9Ddk
 RlozY+uMLPnPiM/sVTOvJBgXavGWhWeRHYKzF0MPOHGQ4qmKSVGuA7IKdsfZvQX8EO
 xIEM0a1BwIbsQ==
Received: from [192.168.176.105] (78-80-17-93.nat.epc.tmcz.cz [78.80.17.93])
 by mr85p00im-ztdg06021101.me.com (Postfix) with ESMTPSA id 9517D340D2D;
 Tue, 31 Dec 2019 13:56:16 +0000 (UTC)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\))
Subject: Re: [OpenWrt-Devel] Sysupgrade possibly broken in recent development
 snapshots: &quot;message&quot;: &quot;Firmware image couldn't be validated&quot;
From: =?utf-8?Q?Petr_Nov=C3=A1k?= &lt;petrn@me.com&gt;
In-Reply-To: &lt;20191231134925.GL70184@meh.true.cz&gt;
Date: Tue, 31 Dec 2019 14:56:13 +0100
Cc: Hannu Nyman &lt;hannu.nyman@welho.com&gt;,
 openwrt-devel@lists.openwrt.org
Content-Transfer-Encoding: quoted-printable
Message-Id: &lt;C9B93DB4-A2CA-455B-8B4F-E7A23E34D141@me.com&gt;
References: &lt;mailman.21094.1577616584.2486.openwrt-devel@lists.openwrt.org&gt;
 &lt;20191229222123.GH70184@meh.true.cz&gt; &lt;20191230190746.GI70184@meh.true.cz&gt;
 &lt;357266D6-1E26-4066-AFE5-746C2407B0DF@me.com&gt;
 &lt;20191230225631.GJ70184@meh.true.cz&gt;
 &lt;D18390C9-BACD-441C-BC1F-41CD9B01634E@me.com&gt;
 &lt;20191231095801.GK70184@meh.true.cz&gt;
 &lt;46C7C775-CDBB-4E84-8C7F-A0F949F1F981@me.com&gt;
 &lt;20191231134925.GL70184@meh.true.cz&gt;
To: =?utf-8?Q?Petr_=C5=A0tetiar?= &lt;ynezz@true.cz&gt;
X-Mailer: Apple Mail (2.3608.40.2.2.4)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, ,
 definitions=2019-12-31_04:, , signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0
 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx
 scancount=1 engine=8.0.1-1908290000 definitions=main-1912310122
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20191231_055619_834136_AEE6A767 
X-CRM114-Status: UNSURE (   9.42  )
X-CRM114-Notice: Please train this message.
X-Spam-Score: -0.9 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.9 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at https://www.dnswl.org/,
 low trust [17.58.23.180 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (petrn[at]me.com)
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid

there you go:

root@OpenWrt:/tmp# sysupgrade -v =
openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img.gz
Reading partition table from bootdisk...
Reading partition table from image...
Saving config files...
boot/config.txt
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/network
etc/config/system
etc/config/wireless
etc/dropbear/dropbear_rsa_host_key
etc/group
etc/hosts
etc/inittab
etc/opkg/keys/0b26f36ae0f4106d
etc/opkg/keys/1035ac73cc4e59e3
etc/opkg/keys/5151f69420c3f508
etc/opkg/keys/72a57f2191b211e0
etc/opkg/keys/792d9d9b39f180dc
etc/opkg/keys/9ef4694208102c43
etc/opkg/keys/b2d571e0880ff617
etc/opkg/keys/b5043e70f9a75cde
etc/opkg/keys/c10b9afab19ee428
etc/opkg/keys/dace9d4df16896bf
etc/opkg/keys/dd6de0d06bbd3d85
etc/opkg/keys/f94b9dd6febac963
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
Commencing upgrade. Closing all shell sessions.
{
	&quot;error&quot;: {
		&quot;message&quot;: &quot;Firmware image couldn't be validated&quot;
	}
}
Command failed: Unknown error
root@OpenWrt:/tmp# ubus monitor &amp;
root@OpenWrt:/tmp# -&gt; d3e9aa79 #00000003         status: {&quot;status&quot;:0}

root@OpenWrt:/tmp# sysupgrade -v =
openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img.gz
Reading partition table from bootdisk...
Reading partition table from image...
Saving config files...
boot/config.txt
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/network
etc/config/system
etc/config/wireless
etc/dropbear/dropbear_rsa_host_key
etc/group
etc/hosts
etc/inittab
etc/opkg/keys/0b26f36ae0f4106d
etc/opkg/keys/1035ac73cc4e59e3
etc/opkg/keys/5151f69420c3f508
etc/opkg/keys/72a57f2191b211e0
etc/opkg/keys/792d9d9b39f180dc
etc/opkg/keys/9ef4694208102c43
etc/opkg/keys/b2d571e0880ff617
etc/opkg/keys/b5043e70f9a75cde
etc/opkg/keys/c10b9afab19ee428
etc/opkg/keys/dace9d4df16896bf
etc/opkg/keys/dd6de0d06bbd3d85
etc/opkg/keys/f94b9dd6febac963
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
Commencing upgrade. Closing all shell sessions.
-&gt; 827c4bd9 #827c4bd9          hello: {}
&lt;- 827c4bd9 #00000000         lookup: {&quot;objpath&quot;:&quot;system&quot;}
-&gt; 827c4bd9 #00000000           data: =
{&quot;objpath&quot;:&quot;system&quot;,&quot;objid&quot;:177377387,&quot;objtype&quot;:1024582224,&quot;signature&quot;:{&quot;b=
oard&quot;:{},&quot;info&quot;:{},&quot;reboot&quot;:{},&quot;watchdog&quot;:{&quot;frequency&quot;:5,&quot;timeout&quot;:5,&quot;magi=
cclose&quot;:7,&quot;stop&quot;:7},&quot;signal&quot;:{&quot;pid&quot;:5,&quot;signum&quot;:5},&quot;validate_firmware_image=
&quot;:{&quot;path&quot;:3},&quot;sysupgrade&quot;:{&quot;path&quot;:3,&quot;force&quot;:7,&quot;backup&quot;:3,&quot;prefix&quot;:3,&quot;comma=
nd&quot;:3,&quot;options&quot;:2}}}
-&gt; 827c4bd9 #00000000         status: {&quot;status&quot;:0}
&lt;- 827c4bd9 #0a92906b         invoke: =
{&quot;objid&quot;:177377387,&quot;method&quot;:&quot;sysupgrade&quot;,&quot;data&quot;:{&quot;prefix&quot;:&quot;/tmp/root&quot;,&quot;pat=
h&quot;:&quot;/tmp/openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img.gz&quot;,&quot;backup&quot;:&quot;=
/tmp/sysupgrade.tgz&quot;,&quot;command&quot;:&quot;/lib/upgrade/do_stage2&quot;,&quot;options&quot;:{&quot;save_p=
artitions&quot;:1}}}
-&gt; 06657534 #827c4bd9         invoke: =
{&quot;objid&quot;:177377387,&quot;method&quot;:&quot;sysupgrade&quot;,&quot;data&quot;:{&quot;prefix&quot;:&quot;/tmp/root&quot;,&quot;pat=
h&quot;:&quot;/tmp/openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img.gz&quot;,&quot;backup&quot;:&quot;=
/tmp/sysupgrade.tgz&quot;,&quot;command&quot;:&quot;/lib/upgrade/do_stage2&quot;,&quot;options&quot;:{&quot;save_p=
artitions&quot;:1}},&quot;user&quot;:&quot;root&quot;,&quot;group&quot;:&quot;root&quot;}
{
	&quot;error&quot;: {
		&quot;message&quot;: &quot;Firmware image couldn't be validated&quot;
	}
}
Command failed: Unknown error
&lt;- 06657534 #827c4bd9           data: =
{&quot;objid&quot;:177377387,&quot;data&quot;:{&quot;error&quot;:{&quot;message&quot;:&quot;Firmware image couldn't =
be validated&quot;}}}
-&gt; 827c4bd9 #0a92906b           data: =
{&quot;objid&quot;:177377387,&quot;data&quot;:{&quot;error&quot;:{&quot;message&quot;:&quot;Firmware image couldn't =
be validated&quot;}}}
&lt;- 06657534 #827c4bd9         status: {&quot;status&quot;:9,&quot;objid&quot;:177377387}
-&gt; 827c4bd9 #0a92906b         status: {&quot;status&quot;:9,&quot;objid&quot;:177377387}

cat /tmp/vfi-json.log

{
	&quot;tests&quot;: {
		&quot;fwtool_signature&quot;: true,
		&quot;fwtool_device_match&quot;: true
	},
	&quot;valid&quot;: true,
	&quot;forceable&quot;: true,
	&quot;allow_backup&quot;: true
}
{
	&quot;tests&quot;: {
		&quot;fwtool_signature&quot;: true,
		&quot;fwtool_device_match&quot;: true
	},
	&quot;valid&quot;: true,
	&quot;forceable&quot;: true,
	&quot;allow_backup&quot;: true
}
{
	&quot;tests&quot;: {
		&quot;fwtool_signature&quot;: true,
		&quot;fwtool_device_match&quot;: true
	},
	&quot;valid&quot;: true,
	&quot;forceable&quot;: true,
	&quot;allow_backup&quot;: true
}
{
	&quot;tests&quot;: {
		&quot;fwtool_signature&quot;: true,
		&quot;fwtool_device_match&quot;: true
	},
	&quot;valid&quot;: true,
	&quot;forceable&quot;: true,
	&quot;allow_backup&quot;: true
}

&gt; On 31 Dec 2019, at 14:49, Petr =C5=A0tetiar &lt;ynezz@true.cz&gt; wrote:
&gt;=20
&gt; Petr Nov=C3=A1k &lt;petrn@me.com&gt; [2019-12-31 11:03:23]:
&gt;=20
&gt;&gt; root@OpenWrt:/tmp# sysupgrade -v =
openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img.gz
&gt;&gt; Reading partition table from bootdisk...
&gt;&gt; Reading partition table from image...
&gt;=20
&gt; This output is from /sbin/sysupgrade calling =
/usr/libexec/validate_firmware_image:
&gt;=20
&gt;&gt; {
&gt;&gt; 	&quot;tests&quot;: {
&gt;&gt; 		&quot;fwtool_signature&quot;: true,
&gt;&gt; 		&quot;fwtool_device_match&quot;: true
&gt;&gt; 	},
&gt;&gt; 	&quot;valid&quot;: true,
&gt;&gt; 	&quot;forceable&quot;: true,
&gt;&gt; 	&quot;allow_backup&quot;: true
&gt;&gt; }
&gt;&gt; Saving config files...
&gt;=20
&gt; ...snip...
&gt;=20
&gt;&gt; Commencing upgrade. Closing all shell sessions.
&gt;=20
&gt; and here should be same output from procd calling
&gt; /usr/libexec/validate_firmware_image, but it is missing as probably =
procd
&gt; consumes the stderr output, so probably something like this is needed:
&gt;=20
&gt; diff --git =
a/package/base-files/files/usr/libexec/validate_firmware_image
&gt; b/package/base-files/files/usr/libexec/validate_firmware_image
&gt; index f85fb9e4b435..754d53b2edfe 100755
&gt; --- a/package/base-files/files/usr/libexec/validate_firmware_image
&gt; +++ b/package/base-files/files/usr/libexec/validate_firmware_image
&gt; @@ -62,5 +62,6 @@ json_init
&gt; 	json_add_boolean valid &quot;$VALID&quot;
&gt; 	json_add_boolean forceable &quot;$FORCEABLE&quot;
&gt; 	json_add_boolean allow_backup &quot;$ALLOW_BACKUP&quot;
&gt; +json_dump -i &gt;&gt; /tmp/vfi-json.log
&gt;  json_dump -i
&gt;  json_set_namespace $old_ns
&gt;=20
&gt; and then run:
&gt;=20
&gt; $ ubus monitor &amp;
&gt; $ sysupgrade -v openwrt-brcm2708-bcm2711-rpi-4-ext4-sysupgrade.img.gz
&gt; $ cat /tmp/vfi-json.log
&gt;=20
&gt; -- ynezz


]