Skip to content

ioctl_set_msg failed:-1 from rpi-eeprom-config after reboot #647

@srcshelton

Description

@srcshelton

Describe the bug

I used EDITOR=vim rpi-eeprom-config -e to create a ~2248-byte firmware configuration file on a series of CM4 devices with the latest firmware (1733575168/Sat 7th Dec) - this change was accepted and an update written to apply on reboot.

After rebooting, however, I can't recall the current configuration:

$ sudo rpi-eeprom-config
ioctl_set_msg failed:-1
bootloader_config

So there appear to be two issues here:

  • rpi-eeprom-config has allowed a configuration to be deployed which it can't later read-back;

  • If there is an error, then rpi-eeprom-config -e will open an editor with the error message, rather than erroring-out - potentially allowing a valid configuration to be overwritten with the error message if the user isn't careful to erase the content and save before exiting their editor (which is likely non-obvious to most users, even those making low-level changes such as firmware configuration edits).

Steps to reproduce the behaviour

Upload the following firmware configuration file with EDITOR=vim rpi-eeprom-config -e:

[all]
#BOOT_UART=0
BOOT_UART=1

# N.B. Not relevant on [pi5], [rpi500], [cm5].
# Set to 2 to use an external GPIO power button.
#
#WAKE_ON_GPIO=1
WAKE_ON_GPIO=0

# N.B. Defaults to 1 on [pi400], [pi500], [cm5].
#
#POWER_OFF_ON_HALT=0
POWER_OFF_ON_HALT=1

# Boot Order Codes, from [1].
#
# Try SD first (1), followed by NVMe PCIe ([cm4] & [pi5] only), USB
# mass-storage, then loop.
#
#  0x0 - Deprecated
#  0x1 - SD card (or eMMC)
#  0x2 - Network
#  0x3 - RPiBOOT ([cm4])
#  0x4 - USB-MSD
#  0x5 - BCM-USB-MSD (USB2.0 boot from USB-C socket or CM4IO USB-A), not [pi5]
#  0x6 - NVME ([cm4], [pi5])
#  0x7 - HTTP
#  0xe - STOP (display error pattern, reboot needed to continue)
#  0xf - RESTART
#
# [1]: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#BOOT_ORDER
#
#BOOT_ORDER=0xf41

# Set to -1 for infinite retries.
#
#MAX_RESTARTS=-1
#SD_BOOT_MAX_RETRIES=0
#NET_BOOT_MAX_RETRIES=0
#DHCP_TIMEOUT=45000
#DHCP_REQ_TIMEOUT=4000
#TFTP_FILE_TIMEOUT=30000
#TFTP_IP=192.168.1.99
#TFTP_PREFIX=0
#TFTP_PREFIX_STR=
#PXE_OPTION43=Raspberry Pi Boot
#DHCP_OPTION97=0x34695052
#MAC_ADDRESS=
#MAC_ADDRESS_OTP=

# Static IP address
#
#CLIENT_IP=
#SUBNET=
#GATEWAY=

#DISABLE_HDMI=0
#HDMI_DELAY=0

# Set to 0 to prevent bootloader updates from USB/Network boot
# For remote units EEPROM hardware write protection should be used.
#
#ENABLE_SELF_UPDATE=1

#FREEZE_VERSION=0

#HTTP_HOST=fw-download-alias1.raspberrypi.com
#HTTP_PORT=443
#HTTP_PATH=net_install
#IMAGER_REPO_URL=http://downloads.raspberrypi.org/os_list_imagingutility_v3.json
#NET_INSTALL_ENABLED=0
#NET_INSTALL_AT_POWER_ON=0
#NET_INSTALL_KEYBOARD_WAIT=900

# Up to 32 characters, e.g. '[email protected]/,6666@/'
# Recommended to activate only by GPIO filter, e.g. '[gpio7=0]'
#
#NETCONSOLE=

# Could be used to boot a recovery partition if the user presses a button via
# GPIO filter, e.g. '[gpio7=0]'
#
#PARTITION=0

#USB_MSD_EXCLUDE_VID_PID=
#USB_MSD_DISCOVER_TIMEOUT=20000
#USB_MSD_LUN_TIMEOUT=2000
#USB_MSD_STARTUP_DELAY=0

#XHCI_DEBUG=0x0

[pi4]
#NET_INSTALL_ENABLED=1
#USB_MSD_PWR_OFF_TIME=1000
SDRAM_BANKLOW=3
[cm4]
#NET_INSTALL_ENABLED=0
#VL805=0
[cm4s]
#NET_INSTALL_ENABLED=0
[pi5]
#UART_BAUD=115200
#NET_INSTALL_ENABLED=1
#PSU_MAX_CURRENT=
SDRAM_BANKLOW=1
[cm5]
#NET_INSTALL_ENABLED=0
[none]

# vi: set syntax=cfg:

Device (s)

Raspberry Pi CM4

Bootloader configuration.

Previous configuration (from backup directory) read:

[all]
BOOT_UART=1
POWER_OFF_ON_HALT=0
BOOT_ORDER=0xf461

System

Gentoo userland

$ sudo vcgencmd bootloader_version
2024/12/07 12:39:28
version 3858f977ab6d689a226ad24d26749266762b7160 (release)
timestamp 1733575168
update-time 1736077005
capabilities 0x0000007f

$ sudo vcgencmd version
Nov 26 2024 12:52:41 
Copyright (c) 2012 Broadcom
version 2ae30f53898ae2f1ba77ff570a92991bedfb0398 (clean) (release) (start_cd)
$ uname -a
Linux rpi-cm4-4-32-xx.tld 6.6.62-v8+ #1817 SMP PREEMPT Wed Nov 20 13:34:18 GMT 2024 aarch64 GNU/Linux

Bootloader logs

[2660406.104633] reboot: Restarting system

  0.10 RPi: BOOTSYS release VERSION:951e1cc9 DATE: 2024/10/21 TIME: 15:24:54
  0.15 BOOTMODE: 0x06 partition 0 build-ts BUILDTIMESTAMP=1729520694 serial xxxx boardrev d03140 stc 515044
  0.32 PM_RSTS: 0x00000020
  0.32 part 00000000 reset_info 00000000
  0.35 uSD voltage 3.3V
  0.61 Initialising SDRAM rank 2 total-size: 64 Gbit 3200 (0x14 0x00)
  0.64 DDR 3200 1 0 64 152 BL:-1
  2.06 OTP boardrev d03140 bootrom 48b0 48b0
  2.08 Customer key hash 000000000000000000000000000000000000000000000000000000000000000
  2.15 VC-JTAG unlocked


  2.93 RPi: BOOTLOADER release VERSION:951e1cc9 DATE: 2024/10/21 TIME: 15:24:54
  2.98 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1729520694 serial xxxx boardrev d03140 stc 2498061
  2.33 Boot mode: SD (01) order f2564
  2.48 SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
  2.59SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
  2.68 EMMC
  2.68 SD retry 1 oc 0
  2.92 SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
  2.04 OCR c0ff8080 [0]
CID: 00150100414a544434520600f4c05138
  2.23 SD HOST: 200000000 CTL0: 0x00800f04 BUS: 25000000 Hz actual: 25000000 HZ div: 8 (4) status: 0x1fff0000 delay: 4
  2.33 S HOST: 200000000 CTL0: 0x00800f04 BUS: 50000000 Hz actual: 50000000 HZ div: 4 (2) status: 0x1fff0000 delay: 2
  2.42 MBR: 0x00000001, 2103295 type: 0xee
  2.45 MBR: 0x00201800,  131072 type: 0xef
  2.49 MBR: 0x00000000,       0 type: 0x00
  2.52 MBR: 000221800,28301312 type: 0xee
  2.56 Trying partition: 0
  2.59 GPT 12a538013c707946ac3185bbd1549129 000000001 001d1efff num-partitions 128 entry-size 128 pentry 2 first 0
  2.69 GPT partition: 0 426f6f74-0000-11aa-aa11-00306543ecac 000000800..0000017ff
  2.77 GPT partition: 10 b921b045-1df0-41c3-af44-4c6f280d3fae 000001800..0002017ff
  2.83 GPT partition: 11 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 000201800..0002217ff
  2.91 Matched GUID bootable-part-idx 0 want partition 0
  2.96 type: 32 lba: 2103296 'BSD  4.4' ' BOOT_0     ' clusters 129024 (1)
  2.02 rsc 32 fat-sectors 1008 root dir cluster 2 sectors 0 entries 0
  2.09 FAT32 clusters 129024
  2.17 [sdcard] autoboot.txt not found
  2.18 Select partition rsts 0 C(boot_partition) 0 EEPROM config 0 result 0
  2.24 Trying partition: 0
  2.27 GPT 12a538013c707946ac3185bbd1549129 000000001 001d1efff num-partitions 128 entry-size 128 pentry 2 firs 0
  2.37 GPT partition: 0 426f6f74-0000-11aa-aa11-00306543ecac 000000800..0000017ff
  2.45 GPT partition: 10 b921b045-1df0-413-af44-4c6f280d3fae 000001800..0002017ff
  2.51 GPT partition: 11 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 000201800..0002217ff
  2.59 Matched GUID bootable-part-idx 0 want partition 0
  2.64 type: 32 lba: 2103296 'BSD  4.4' ' BOOT_0     ' clusters 129024 (1)
  2.70 rsc 32 fat-sectors 1008 root dir cluster 2 sectors 0 entries 0
  2.77 FAT32 clusters 129024
  2.83 Read config.txt bytes     7373 hnd 0x1ea53
  2.88 Read overclock.txt bytes     2296 hnd 0x1664f
  2.93 Read legacy.txt bytes     3563 hnd 0x16648
  2.96 pieeprom.sig
  2.96 hash: 0cef128231dd69ae90ae97f3fddd1215b94333bf17bf1ff0dcaae2e03351c901
  3.03 ts: 1735278939
  3.91 SELF-UPDATE timestamp current 1729691315 new 1735278939
  3.94 Updating bootloader EEPROM
  3.97 Reading EEPROM: 524288 bytes 0x00b60000
  3.59 358ms
  3.94 Writing EEPROM
+++++++++++++..++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...................................................++  6.71
  6.71 2877ms

  6.71 Verify BOOT EEPROM
  6.73 Reading EEPROM: 524288 bytes 0x00b60000
  6.35 358ms
  6.70 BOOT-EEPROM: UPDATED
  6.70 EEPROMs updated. Rebooting
  6.72 RESET

  0.19 RPi: BOOTSYS release VERSION:3858f977 DATE: 2024/12/07 TIME: 12:39:28
  0.23 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1733575168 serial xxxx boardrev d03140 stc 523156
  0.48 PM_RSTS: 0x00000020
  0.48 part 00000000 reset_info 00000000
  0.51 uSD voltage 3.3V
  0.77 Initialising SDRAM rank 2 total-size: 64 Gbit 3200 (0x14 0x00)
  0.80 DDR 3200 1 0 64 152 BL:3
  2.22 OTP boardrev d03140 bootrom 48b0 48b0
  2.24 Customer key hash 0000000000000000000000000000000000000000000000000000000000000000
  2.31 VC-JTAG unlocked


  2.09 RPi: BOOTLOADER release VERSION:3858f977 DATE: 2024/12/07 TIME: 12:39:28
  2.13 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1733575168 serial xxxx boardrev d03140 stc 2513868
  2.49 Boot mode: SD (01) order f64
  2.63 SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
  2.74 SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
  2.83 EMMC
  2.83 SD retry 1 oc 0 
  2.08 SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
  2.19 OCR c0ff8080 [0]
CID: 00150100414a544434520600f4c05138
  2.38 SD HOST: 200000000 CTL0: 0x00800f04 BUS: 25000000 Hz actual: 25000000 HZ div: 8 (4) status: 0x1fff0000 delay: 4
  2.49 SD HOST: 200000000 CTL0: 0x00800f04 BUS: 50000000 Hz actual: 50000000 HZ div: 4 (2) status: 0x1fff0000 delay: 2
  2.58 MBR: 0x00000001, 2103295 type: 0xee
  2.60 MBR: 0x00201800,  131072 type: 0xef
  2.64 MBR: 0x00000000,       0 type: 0x00
  2.68 MBR: 0x00221800,28301312 type: 0xee
  2.72 Trying partition: 0
  2.75 GPT 12a538013c707946ac3185bbd1549129 000000001 001d1efff num-paritions 128 entry-size 128 pentry 2 first 0
  2.85 GPT partition: 0 426f6f74-0000-11aa-aa11-00306543ecac 000000800..0000017ff
 2.92 GPT partition: 10 b921b045-1df0-41c3-af44-4c6f280d3fae 000001800..0002017ff
  2.99 GPT partition: 11 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 000201800..0002217ff
  2.06 Matched GUID bootable-part-idx 0 want partition 0
  2.12 type: 32 lba: 2103296 'BSlusters 129024
  2.32 [sdcard] autoboot.txt not found
  2.33 Select partition rsts 0 C(boot_partition) 0 EEPROM config 0 result 0
  2.40 Tryig partition: 0
  2.42 GPT 12a538013c707946ac3185bbd1549129 000000001 001d1efff num-partitions 128 entry-size 128 pentry 2 first 0
  2.52 GPT partition: 0 426f6f74-0000-11aa-aa11-00306543ecac 000000800..0000017ff
  2.60 GPT partition: 10 b921b045-1df0-41c3-af44-4c6f280d3fae 000001800..0002017ff
  2.67 GPT partition: 11 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 000201800..0002217ff
  2.74 Matched GUID bootable-part-idx 0 want partition 0
  2.79 type: 32 lba: 2103296 'BSD  4.4' ' BOOT_0     ' clusters 129024 1)
  2.86 rsc 32 fat-sectors 1008 root dir cluster 2 sectors 0 entries 0
  2.92 FAT32 clusters 129024
  2.98 Read config.txt bytes     7373 hnd 0x1ea53
  3.03 Read overclock.txt bytes     2296 hnd 0x1664f
  3.08 Read legacy.txt bytes     3563 hnd 0x16648
  3.11 pieeprom.sig
  3.12 hash: 0cef128231dd69ae90ae97f3fddd1215b94333bf17bf1ff0dcaae2e03351c901
  3.18 ts: 1735278939  
  3.06 SELF-UPDATE timestamp current 1735278939 new 1735278939 skip
  3.12 [sdcard] recover4.elf not found
  3.15 [sdcard] recvery.elf not found
  3.64 Read start4cd.elf bytes   812636 hnd 0x16014
  3.67 Read fixup4cd.dat bytes     3230 hnd 0x1f5b7
  3.70 0x00d03140 0x0000000 0x00001fff
  3.74 MEM GPU: 16 ARM: 998 TOTAL: 1014
  3.00 Firmware: 2ae30f53898ae2f1ba77ff570a92991bedfb0398 Nov 26 2024 12:52:41
  3.17 Starting start4cd.elf @ 0xff000200 partition 0
  3.19 PCI0 reset
  3.30 +

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]

USB boot

No response

NVMe boot

No response

Network (TFTP boot)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions