3.3RC1 update fails on Duet 3 Mini unless fw in /opt/dsf/sd/sys?
-
Tl;dr: Firmware on Duet 3 Mini 5+ with SBC wouldn't update from 3.2.2 -> 3.3RC1 until I copied the IAP .bin file and the .uf2 file from /opt/dsf/sd/firmware/ to /opt/dsf/sd/sys/? (Also, possible bug in reprapfirmware.postinst script - chown dsf:dsf wildcard doesn't match .uf2 files)
Hi there,
I have a Duet 3 Mini 5+ with a Raspberry Pi 4 SBC connected in the usual way (SPI over the included ribbon cable).
I attempted to upgrade from 3.2.2 to 3.3-rc1 using the following command (after changing "stable" to "unstable" in the sources.list.d/... fragment file)...
root@duet3-cr10spro:~# apt-get install duetcontrolserver=3.3-rc1 duetruntime=3.3-rc1 duetsoftwareframework=3.3-rc1 duettools=3.3-rc1 duetwebcontrol=3.3-rc1 duetwebserver=3.3-rc1 reprapfirmware=3.3-rc1-1 Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: apparmor duetpluginservice Suggested packages: apparmor-profiles-extra apparmor-utils The following NEW packages will be installed: apparmor duetpluginservice The following packages will be upgraded: duetcontrolserver duetruntime duetsoftwareframework duettools duetwebcontrol duetwebserver reprapfirmware 7 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 33.6 MB of archives. After this operation, 1,488 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:2 https://pkg.duet3d.com unstable/armv7 armhf duetsoftwareframework armhf 3.3-rc1 [2,046 B] Get:3 https://pkg.duet3d.com unstable/armv7 armhf duettools armhf 3.3-rc1 [54.9 kB] Get:4 https://pkg.duet3d.com unstable/armv7 armhf duetcontrolserver armhf 3.3-rc1 [234 kB] Get:5 https://pkg.duet3d.com unstable/armv7 armhf duetruntime armhf 3.3-rc1 [26.9 MB] Get:1 http://raspbian.mirror.uk.sargasso.net/raspbian buster/main armhf apparmor armhf 2.13.2-10 [438 kB] Get:6 https://pkg.duet3d.com unstable/armv7 armhf duetwebserver armhf 3.3-rc1 [80.2 kB] Get:7 https://pkg.duet3d.com unstable/armv7 armhf duetwebcontrol all 3.3-rc1 [4,813 kB] Get:8 https://pkg.duet3d.com unstable/armv7 armhf reprapfirmware all 3.3-rc1-1 [1,021 kB] Get:9 https://pkg.duet3d.com unstable/armv7 armhf duetpluginservice armhf 3.3-rc1 [60.8 kB] Fetched 33.6 MB in 5s (6,550 kB/s) Reading changelogs... Done Preconfiguring packages ... (Reading database ... 103265 files and directories currently installed.) Preparing to unpack .../0-duetsoftwareframework_3.3-rc1_armhf.deb ... Unpacking duetsoftwareframework (3.3-rc1) over (3.2.2) ... To delete the "dsf" user run as root: userdel --force dsf Preparing to unpack .../1-duettools_3.3-rc1_armhf.deb ... Unpacking duettools (3.3-rc1) over (3.2.2) ... Preparing to unpack .../2-duetcontrolserver_3.3-rc1_armhf.deb ... Unpacking duetcontrolserver (3.3-rc1) over (3.2.2) ... To delete "gpio" group run as root: groupdel gpio Preparing to unpack .../3-duetruntime_3.3-rc1_armhf.deb ... Unpacking duetruntime (3.3-rc1) over (3.2.2) ... Preparing to unpack .../4-duetwebserver_3.3-rc1_armhf.deb ... Unpacking duetwebserver (3.3-rc1) over (3.2.2) ... Preparing to unpack .../5-duetwebcontrol_3.3-rc1_all.deb ... Unpacking duetwebcontrol (3.3-rc1) over (3.2.2) ... Preparing to unpack .../6-reprapfirmware_3.3-rc1-1_all.deb ... Unpacking reprapfirmware (3.3-rc1-1) over (3.2.2-1) ... Selecting previously unselected package duetpluginservice. Preparing to unpack .../7-duetpluginservice_3.3-rc1_armhf.deb ... Unpacking duetpluginservice (3.3-rc1) ... Selecting previously unselected package apparmor. Preparing to unpack .../8-apparmor_2.13.2-10_armhf.deb ... Unpacking apparmor (2.13.2-10) ... Setting up duetruntime (3.3-rc1) ... Setting up apparmor (2.13.2-10) ... Created symlink /etc/systemd/system/sysinit.target.wants/apparmor.service → /lib/systemd/system/apparmor.service. Reloading AppArmor profiles Setting up duettools (3.3-rc1) ... Setting up duetsoftwareframework (3.3-rc1) ... To modify config files consider adding yourself to the dsf groupd: # usermod -a -G dsf <username> Setting up duetwebcontrol (3.3-rc1) ... Setting up duetcontrolserver (3.3-rc1) ... Installing new version of config file /opt/dsf/conf/config.json ... Setting up duetwebserver (3.3-rc1) ... Setting up reprapfirmware (3.3-rc1-1) ... Sending update request to DCS... Done! Setting up duetpluginservice (3.3-rc1) ... Processing triggers for systemd (241-7~deb10u7+rpi1) ... Processing triggers for man-db (2.8.5-2) ... root@duet3-cr10spro:~#
... but found that, despite the message "Sending update request to DCS... Done!", the firmware was still showing up as 3.2.2 in the DWC UI even after doing an M999 to reset the board:
Looking at the postinst script for the reprapfirmware deb package, I notice that it contains a line
chown dsf:dsf /opt/dsf/sd/firmware/*.bin
...root@duet3-cr10spro:~# cat /var/lib/dpkg/info/reprapfirmware.postinst #!/bin/sh # Adjust file permissions chown dsf:dsf /opt/dsf/sd/firmware/*.bin # Instruct DuetControlServer to update the firmware /opt/dsf/bin/DuetControlServer -u exit 0 root@duet3-cr10spro:~#
...but looking in
/opt/dsf/sd/firmware/
there is one file that has a filename not ending in.bin
:Duet3Firmware_Mini5plus.uf2
, which oddly enough has owning user/group root:root:root@duet3-cr10spro:~# ls -l /opt/dsf/sd/firmware/ total 2940 -rwxrwxr-- 1 dsf dsf 426412 May 1 15:11 Duet2Firmware_SBC.bin -rwxrwxr-x 1 dsf dsf 28840 May 1 15:11 Duet2_SBCiap_2SBC.bin -rwxrwxr-x 1 dsf dsf 9612 May 1 15:11 Duet2_SBCiap32_SBC.bin -rwxrwxr-x 1 dsf dsf 10308 May 1 15:11 Duet3Bootloader_EXP.bin -rwxrwxr-x 1 dsf dsf 9192 May 1 15:11 Duet3Bootloader_TOOL.bin -rwxrwxr-- 1 dsf dsf 114516 May 1 15:11 Duet3Firmware_EXP1XD.bin -rwxrwxr-- 1 dsf dsf 128996 May 1 15:11 Duet3Firmware_EXP3HC.bin -rwxrwxr-- 1 dsf dsf 655036 May 1 15:11 Duet3Firmware_MB6HC.bin -rwxrwxr-- 1 root root 1413120 May 1 15:11 Duet3Firmware_Mini5plus.uf2 -rwxrwxr-- 1 dsf dsf 129252 May 1 15:11 Duet3Firmware_TOOL1LC.bin -rwxrwxr-x 1 dsf dsf 9472 May 1 15:11 Duet3_SBCiap32_MB6HC.bin -rwxrwxr-x 1 dsf dsf 12752 May 1 15:11 Duet3_SBCiap32_Mini5plus.bin -rwxrwxr-- 1 dsf dsf 19908 May 1 15:11 Duet3_SBCiap_MB6HC.bin -rwxrwxr-x 1 dsf dsf 14176 May 1 15:11 Duet3_SBCiap_Mini5plus.bin root@duet3-cr10spro:~#
However, even if I manually issue the following commands...
root@duet3-cr10spro:~# chown dsf:dsf /opt/dsf/sd/firmware/Duet3Firmware_Mini5plus.uf2 root@duet3-cr10spro:~# /opt/dsf/bin/DuetControlServer -u Sending update request to DCS... Done! root@duet3-cr10spro:~#
...this still doesn't seem to help, though?
I modified
/usr/lib/systemd/system/duetcontrolserver.service
to have "-l debug" on the command line...root@duet3-cr10spro:~# cat /usr/lib/systemd/system/duetcontrolserver.service [Unit] Description=Duet Control Server StartLimitIntervalSec=0 [Service] #ExecStart=/opt/dsf/bin/DuetControlServer ExecStart=/opt/dsf/bin/DuetControlServer -l debug TimeoutStopSec=15 Restart=always Type=notify User=dsf Group=dsf UMask=0002 CapabilityBoundingSet=CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_SYS_TIME AmbientCapabilities=CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_SYS_TIME [Install] WantedBy=sysinit.target root@duet3-cr10spro:~#
...and then ran
systemctl daemon-reload
followed bysystemctl stop duetcontrolserver.service
andsystemctl start duetcontrolserver.service
.Looking in the output of
journalctl -u duetcontrolserver.service
I see that it is complaining about being unable to findDuet3_SBCiap32_Mini5plus.bin
...May 02 21:32:01 duet3-cr10spro DuetControlServer[9139]: [debug] Waiting for execution of M997 (prioritized) May 02 21:32:01 duet3-cr10spro DuetControlServer[9139]: [debug] Processing M997 May 02 21:32:01 duet3-cr10spro DuetControlServer[9139]: [debug] Waiting for finish of M997 => Error: Failed to find IAP file Duet3_SBCiap32_Mini5plus.bin May 02 21:32:01 duet3-cr10spro DuetControlServer[9139]: [debug] Completed M997 => Error: M997: Failed to find IAP file Duet3_SBCiap32_Mini5plus.bin May 02 21:32:01 duet3-cr10spro DuetControlServer[9139]: [debug] IPC#12: Connection closed
...despite that file existing just fine (and not being the file with the wrong(?) user/group owner)?
root@duet3-cr10spro:~# ls -l /opt/dsf/sd/firmware/ total 2940 -rwxrwxr-- 1 dsf dsf 426412 May 1 15:11 Duet2Firmware_SBC.bin -rwxrwxr-x 1 dsf dsf 28840 May 1 15:11 Duet2_SBCiap_2SBC.bin -rwxrwxr-x 1 dsf dsf 9612 May 1 15:11 Duet2_SBCiap32_SBC.bin -rwxrwxr-x 1 dsf dsf 10308 May 1 15:11 Duet3Bootloader_EXP.bin -rwxrwxr-x 1 dsf dsf 9192 May 1 15:11 Duet3Bootloader_TOOL.bin -rwxrwxr-- 1 dsf dsf 114516 May 1 15:11 Duet3Firmware_EXP1XD.bin -rwxrwxr-- 1 dsf dsf 128996 May 1 15:11 Duet3Firmware_EXP3HC.bin -rwxrwxr-- 1 dsf dsf 655036 May 1 15:11 Duet3Firmware_MB6HC.bin -rwxrwxr-- 1 dsf dsf 1413120 May 1 15:11 Duet3Firmware_Mini5plus.uf2 -rwxrwxr-- 1 dsf dsf 129252 May 1 15:11 Duet3Firmware_TOOL1LC.bin -rwxrwxr-x 1 dsf dsf 9472 May 1 15:11 Duet3_SBCiap32_MB6HC.bin -rwxrwxr-x 1 dsf dsf 12752 May 1 15:11 Duet3_SBCiap32_Mini5plus.bin -rwxrwxr-- 1 dsf dsf 19908 May 1 15:11 Duet3_SBCiap_MB6HC.bin -rwxrwxr-x 1 dsf dsf 14176 May 1 15:11 Duet3_SBCiap_Mini5plus.bin root@duet3-cr10spro:~#
I tried various ways of invoking the update, including running
M997 S0
from the DWC UI, or/opt/dsf/bin/DuetControlServer -l debug -u
with or without duetcontrolserver.service running.Whichever I do, I get:
Error: M997: Failed to find IAP file Duet3_SBCiap32_Mini5plus.bin
As a test, I changed back the ownership of
Duet3Firmware_Mini5plus.uf2
toroot:root
, then made a copy ofDuet3_SBCiap32_Mini5plus.bin
in/opt/dsf/sd/sys/
.After starting DCS up again with
systemctl start duetcontrolserver.service
, I did:root@duet3-cr10spro:~# /opt/dsf/bin/DuetControlServer -l debug -u [info] Settings loaded Sending update request to DCS... Done! root@duet3-cr10spro:~#
and then looking at the output of
journalctl -u duetcontrolserver.service
, now this time I get a complaint aboutDuet3Firmware_Mini5plus.uf2
being missing:May 02 21:53:28 duet3-cr10spro DuetControlServer[9822]: [debug] Waiting for execution of M997 (prioritized) May 02 21:53:28 duet3-cr10spro DuetControlServer[9822]: [debug] Processing M997 May 02 21:53:28 duet3-cr10spro DuetControlServer[9822]: [debug] Waiting for finish of M997 => Error: Failed to find firmware file Duet3Firmware_Mini5plus.uf2 May 02 21:53:28 duet3-cr10spro DuetControlServer[9822]: [debug] Completed M997 => Error: M997: Failed to find firmware file Duet3Firmware_Mini5plus.uf2 May 02 21:53:28 duet3-cr10spro DuetControlServer[9822]: [debug] IPC#11: Connection closed
Ditto if I try through the DWC UI:
M997 S0 Error: M997: Failed to find firmware file Duet3Firmware_Mini5plus.uf2
Now let's try changing the owner back to dsf:dsf again (as I think it should be, rather than "root:root" as it was when I found it):
root@duet3-cr10spro:~# chown dsf:dsf /opt/dsf/sd/firmware/Duet3Firmware_Mini5plus.uf2 root@duet3-cr10spro:~#
... and triggering an update again...
root@duet3-cr10spro:~# /opt/dsf/bin/DuetControlServer -l debug -u [info] Settings loaded Sending update request to DCS... Done! root@duet3-cr10spro:~#
... and looking at the journalctl output...
May 02 22:01:39 duet3-cr10spro DuetControlServer[9822]: [debug] Waiting for execution of M997 (prioritized) May 02 22:01:39 duet3-cr10spro DuetControlServer[9822]: [debug] Processing M997 May 02 22:01:39 duet3-cr10spro DuetControlServer[9822]: [debug] Waiting for finish of M997 => Error: Failed to find firmware file Duet3Firmware_Mini5plus.uf2 May 02 22:01:39 duet3-cr10spro DuetControlServer[9822]: [debug] Completed M997 => Error: M997: Failed to find firmware file Duet3Firmware_Mini5plus.uf2 May 02 22:01:39 duet3-cr10spro DuetControlServer[9822]: [debug] IPC#13: Connection closed
...it still complains?
Okay, let's try the same thing we did for the IAP image - copying it into the
sys
directory:root@duet3-cr10spro:~# cd /opt/dsf/sd/ root@duet3-cr10spro:/opt/dsf/sd# cp firmware/Duet Duet2Firmware_SBC.bin Duet2_SBCiap32_SBC.bin Duet3Bootloader_TOOL.bin Duet3Firmware_EXP3HC.bin Duet3Firmware_Mini5plus.uf2 Duet3_SBCiap32_MB6HC.bin Duet3_SBCiap_MB6HC.bin Duet2_SBCiap_2SBC.bin Duet3Bootloader_EXP.bin Duet3Firmware_EXP1XD.bin Duet3Firmware_MB6HC.bin Duet3Firmware_TOOL1LC.bin Duet3_SBCiap32_Mini5plus.bin Duet3_SBCiap_Mini5plus.bin root@duet3-cr10spro:/opt/dsf/sd# cp firmware/Duet3Firmware_Mini5plus.uf2 sys/ bed.g config.g.bak deployprobe.g dwc-settings.json homeall.g homey.g retractprobe.g config.g config-override.g Duet3_SBCiap32_Mini5plus.bin heightmap.csv homex.g homez.g root@duet3-cr10spro:/opt/dsf/sd# cp firmware/Duet3Firmware_Mini5plus.uf2 sys/ root@duet3-cr10spro:/opt/dsf/sd# ls sys/ bed.g config.g config.g.bak config-override.g deployprobe.g Duet3Firmware_Mini5plus.uf2 Duet3_SBCiap32_Mini5plus.bin dwc-settings.json heightmap.csv homeall.g homex.g homey.g homez.g retractprobe.g root@duet3-cr10spro:/opt/dsf/sd# ls -l sys/ total 1452 -rw-rw-r-- 1 dsf dsf 251 May 2 16:25 bed.g -rw-rw-r-- 1 dsf dsf 6285 May 2 18:34 config.g -rw-rw-r-- 1 dsf dsf 6174 May 2 16:04 config.g.bak -rw-rw-r-- 1 dsf dsf 66 Apr 24 21:47 config-override.g -rw-rw-r-- 1 dsf dsf 199 May 1 01:02 deployprobe.g -rwxr-xr-- 1 root root 1413120 May 2 22:03 Duet3Firmware_Mini5plus.uf2 -rwxr-xr-x 1 root root 12752 May 2 21:53 Duet3_SBCiap32_Mini5plus.bin -rw-rw-r-- 1 dsf dsf 1744 May 2 20:16 dwc-settings.json -rw-rw-r-- 1 dsf dsf 1969 May 1 20:46 heightmap.csv -rw-rw-r-- 1 dsf dsf 693 May 1 17:11 homeall.g -rw-rw-r-- 1 dsf dsf 518 May 1 16:37 homex.g -rw-rw-r-- 1 dsf dsf 518 May 1 16:38 homey.g -rw-rw-r-- 1 dsf dsf 471 May 1 17:12 homez.g -rw-rw-r-- 1 dsf dsf 202 May 1 01:02 retractprobe.g root@duet3-cr10spro:/opt/dsf/sd#
And triggering the update again...
root@duet3-cr10spro:/opt/dsf/sd# /opt/dsf/bin/DuetControlServer -l debug -u [info] Settings loaded Sending update request to DCS... Done! root@duet3-cr10spro:/opt/dsf/sd#
... which seemed a bit more promising, as it took maybe 20 seconds rather than coming back instantly, so let's check the journalctl logging...
May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [debug] IPC#14: Got new UNIX connection, checking permissions... May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [debug] IPC#14: Granting full DSF permissions to external plugin May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [debug] IPC#14: Command processor added May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [debug] IPC#14: Received command Code May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [debug] Waiting for execution of M997 (prioritized) May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [debug] Processing M997 May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [info] Flashing IAP binary May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: .......... May 02 22:04:31 duet3-cr10spro DuetControlServer[9822]: [info] Flashing RepRapFirmware May 02 22:04:39 duet3-cr10spro DuetControlServer[9822]: ..................................................................................................................................................................................... May 02 22:04:39 duet3-cr10spro DuetControlServer[9822]: [info] Verifying checksum May 02 22:04:42 duet3-cr10spro DuetControlServer[9822]: [info] Firmware update successful
...and this time it succeeded!
M122 output seems to confirm it:
M122 === Diagnostics === RepRapFirmware for Duet 3 Mini 5+ version 3.3RC1 (2021-05-01 09:59:28) running on Duet 3 Mini5plus Ethernet (SBC mode) Board ID: TDXXL-7296U-D65J0-40KMQ-NR03Z-HPBHZ Used output buffers: 1 of 40 (10 max) === RTOS === Static ram: 102476 Dynamic ram: 92832 of which 0 recycled Never used RAM 48396, free system stack 184 words Tasks: SBC(ready,4.6%,302) HEAT(delaying,0.0%,338) Move(notifyWait,0.1%,362) CanReceiv(notifyWait,0.0%,943) CanSender(notifyWait,0.0%,371) CanClock(delaying,0.0%,341) TMC(notifyWait,0.7%,115) MAIN(running,93.7%,599) IDLE(ready,0.1%,29) AIN(delaying,0.8%,273), total 100.0% Owned mutexes: HTTP(MAIN) === Platform === Last reset 00:02:52 ago, cause: software Last software reset at 2021-05-02 21:19, reason: User, Move spinning, available RAM 51920, slot 0 [... snipped rest of output as it was irrelevant ...]
I'm not actually sure what the take-away is here... was it expected that I had to manually copy the files from
/opt/dsf/sd/firmware/...
to/opt/dsf/sd/sys/...
?Should the DuetControlServer have "known" to look in
/opt/dsf/sd/firmware
?Anyway, I just thought I would report this, having gone to the trouble to investigate.
Thanks,
Hazel
-
@owend Thanks for reporting this, I noticed the same problem shortly after the RC1 release. The next version will attempt to fall back to 0:/firmware, then to 0:/ sys, if the requested IAP/firmware file could not be found in
directories.firmware
. -
@chrishamm No worries, glad I could help!
Unsure who @owend is, are they one of the developers?
-
@hazelesque My bad, I mentioned the wrong person.