Hi,
we created a new image for our ubuntu core enabled board.
We noticed that the prepare device hook script that worked fine until core revision 3750, is now unable to perform the serial vault registration (core revision 4409).
We noticed a bug apparmor-denied-in-prepare-device-hooks and modified the snap.yaml accordingly
But we optain anyhow an error during the “Initialize device” step:
domotz@localhost:~$ snap changes
ID Status Spawn Ready Summary
1 Done 2018-04-18T10:04:18Z 2018-04-18T10:07:19Z Initialize system state
2 Error 2018-04-18T10:05:06Z 2018-04-18T10:06:04Z Initialize device
and
domotz@localhost:~$ snap change 2
Status Spawn Ready Summary
Done 2018-04-18T10:05:06Z 2018-04-18T10:06:04Z Run prepare-device hook
Done 2018-04-18T10:05:06Z 2018-04-18T10:06:02Z Generate device key
Error 2018-04-18T10:05:06Z 2018-04-18T10:06:01Z Request device serial
......................................................................
Request device serial
2018-04-18T10:06:01Z ERROR cannot deliver device serial request: unexpected status 400
The script is:
#!/bin/sh
set -x
exec >> "$SNAP_COMMON"/prepare-device-hook.log 2>&1
product_serial=$(grep Serial /proc/cpuinfo | awk '{print $3}')
snapctl set device-service.url="https://serial-vault-partners.canonical.com/v1/"
snapctl set device-service.headers='{"api-key": "secret_api_key", "X-Use-Proposed": "yes"}'
snapctl set registration.proposed-serial="\"${product_serial}\""
Something is changed in the procedure or in snapd? Or we are doing something wrong?
Thanks,
Francesco