Can the user rollback?
On 18 May 2026, at 6:42 PM, Michael Balzer via OvmsDev <ovmsdev@lists.openvehicles.com> wrote:
Got a first user log covering a typical store corruption, attached. The copy process correctly identified the errors and signaled a failure.
Of course the user has no backup, so needs to reconfigure now.
Regards, Michael
Am 17.05.26 um 08:37 schrieb Michael Balzer via OvmsDev:
More precisely:
One big ‘gotcha’ I found was that we need to set CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORT= and CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=y in our sdkconfig - otherwise the partition table cannot be re-flashed.
Am 17.05.26 um 08:35 schrieb Michael Balzer via OvmsDev:
Michael,
you missed setting…
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=y
…in your build config. That's necessary to allow the application to write the partition table.
Regards, Michael
Am 17.05.26 um 08:19 schrieb Michael Geddes:
Hmm.. Tried doing the upgrade (from my own build of latest master) a few times, each time I get the following:
The tail of the partition log looks like this:
Added new store2 partition to partition table Erasing store2 data (2031616 bytes)... Recalculated MD5 checksum Erasing old partition table (4096 bytes at 0x00008000)... And there's a back-trace in the last-boot status:
support/a2l 0x4008dda6 0x4008e041 0x401e2428 0x40085126 0x4018eae7 0x4018f1e1 0x401945a7 0x4018b7b3 0x4018e08a 0x4018aeb2 0x4013eece 0x4013f309 0x4013f720 0x4013f7a1 Using elf file: /home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/build/ovms3.elf 0x4008dda6 is in invoke_abort (/home/michaelg/esp/esp-idf/components/esp32/panic.c:156). 151 #endif 152 while (1) { 153 if (esp_cpu_in_ocd_debug_mode()) { 154 __asm__ ("break 0,0"); 155 } 156 *((int *) 0) = 0; 157 } 158 } 159 160 void abort() 0x4008e041 is in abort (/home/michaelg/esp/esp-idf/components/esp32/panic.c:171). 166 * don't overwrite that. 167 */ 168 if (esp_reset_reason_get_hint() == ESP_RST_UNKNOWN) { 169 esp_reset_reason_set_hint(ESP_RST_PANIC); 170 } 171 invoke_abort(); 172 } 173 174 175 static const char *edesc[] = { 0x401e2428 is in is_safe_write_address (/home/michaelg/esp/esp-idf/components/spi_flash/flash_ops.c:124). 119 120 static __attribute__((unused)) bool is_safe_write_address(size_t addr, size_t size) 121 { 122 bool result = true; 123 if (addr <= ESP_PARTITION_TABLE_OFFSET + ESP_PARTITION_TABLE_MAX_LEN) { 124 UNSAFE_WRITE_ADDRESS; 125 } 126 127 const esp_partition_t *p = esp_ota_get_running_partition(); 128 if (addr >= p->address && addr < p->address + p->size) { 0x40085126 is in spi_flash_erase_range (/home/michaelg/esp/esp-idf/components/spi_flash/flash_ops.c:220). 215 return spi_flash_erase_range(sec * SPI_FLASH_SEC_SIZE, SPI_FLASH_SEC_SIZE); 216 } 217 218 esp_err_t IRAM_ATTR spi_flash_erase_range(uint32_t start_addr, uint32_t size) 219 { 220 CHECK_WRITE_ADDRESS(start_addr, size); 221 if (start_addr % SPI_FLASH_SEC_SIZE != 0) { 222 return ESP_ERR_INVALID_ARG; 223 } 224 if (size % SPI_FLASH_SEC_SIZE != 0) { 0x4018eae7 is in ovms_partition_table_rewrite(ovms_esp_partition_t*, OvmsWriter*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_ota/src/ovms_partitions.cpp:1239). 1234 if (writer) writer->puts("Error: Failed to find partition table"); 1235 return false; 1236 } 1237 1238 if (writer) writer->printf("Erasing old partition table (%d bytes at 0x%08zx)...\n", (int)PARTITION_TABLE_BLOCK_SIZE, offset); 1239 esp_err_t err = spi_flash_erase_range(offset, PARTITION_TABLE_BLOCK_SIZE); 1240 if (err != ESP_OK) 1241 { 1242 if (writer)writer->printf("Error: Failed to erase old partition table: %s\n", esp_err_to_name(err)); 1243 return false; 0x4018f1e1 is in ovms_partition_table_upgrade_store(OvmsWriter*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_ota/src/ovms_partitions.cpp:407). 402 p->magic_id = PARTITION_MD5_MAGIC; 403 OVMS_MD5_Final(p->data.md5.digest, &md5_ctx); 404 writer->puts("Recalculated MD5 checksum"); 405 406 // Now re-write the partition table to flash 407 if (ovms_partition_table_rewrite(table, writer)) 408 { 409 writer->puts("Partition table upgraded successfully - reboot required"); 410 partition_table_type = OVMS_FlashPartition_34; 411 } 0x401945a7 is in ovms_partition_table_upgrade_autocont(OvmsWriter*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_ota/src/ovms_partitions.cpp:1166). 1161 } 1162 } 1163 else 1164 { 1165 writer->puts("v3-30 The currently running partition is factory, so we can upgrade the partition table, and then reboot"); 1166 if (ovms_partition_table_upgrade_store(writer)) 1167 { 1168 writer->puts("v3-30 Partition table store upgraded successfully, rebooting now..."); 1169 writer->puts("v3-30 !! Do not power off the module while the upgrade is running !!"); 1170 vTaskDelay(2000/portTICK_PERIOD_MS); 0x4018b7b3 is in ota_perform_partition_table_upgrade_autocont(OvmsWriter*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_ota/src/ovms_ota.cpp:893). 888 { 889 writer->puts("Error: Flash operation already in progress - cannot upgrade partition table"); 890 return false; 891 } 892 893 return ovms_partition_table_upgrade_autocont(writer); 894 } 895 896 bool ota_partition_table_upgrade_autocont_yesno(OvmsWriter* writer, void* ctx, char ch) 897 { 0x4018e08a is in OvmsOTA::SystemStart(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_ota/src/ovms_ota.cpp:1229). 1224 ESP_LOGI(TAG, "Checking for partition update..."); 1225 if (!ovms_partition_table_isuptodate()) 1226 { 1227 ESP_LOGI(TAG, "Partition table is not up to date, continuing to upgrade the partition table"); 1228 FileWriter writer("/store/partition-update.log", true); 1229 success = ota_perform_partition_table_upgrade_autocont(&writer); 1230 } 1231 else 1232 { 1233 success = true; 0x4018aeb2 is in std::_Function_handler<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*), std::_Bind<std::_Mem_fn<void (OvmsOTA::*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*)> (OvmsOTA*, std::_Placeholder<1>, std::_Placeholder<2>)> >::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, void*&&) (/home/michaelg/.espressif/tools/xtensa-esp32-elf/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:600). 595 template<typename... _Args, typename _Req 596 = _Require<typename _Traits::__lvalue, 597 _CheckArgs<_Pack<_Args...>>>> 598 result_type 599 operator()(_Class* __object, _Args&&... __args) const 600 { return (__object->*_M_pmf)(std::forward<_Args>(__args)...); } 601 602 // Handle smart pointers, references and pointers to derived 603 template<typename _Tp, typename... _Args, typename _Req 604 = _Require<_NotSame<_Class, _Tp>, _NotSame<_Class*, _Tp>, 0x4013eece is in std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*) const (/home/michaelg/.espressif/tools/xtensa-esp32-elf/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/functional:2271). 2266 function<_Res(_ArgTypes...)>:: 2267 operator()(_ArgTypes... __args) const 2268 { 2269 if (_M_empty()) 2270 __throw_bad_function_call(); 2271 return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...); 2272 } 2273 2274 #if __cpp_rtti 2275 template<typename _Res, typename... _ArgTypes> 0x4013f309 is in OvmsEvents::HandleQueueSignalEvent(event_queue_t*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_events.cpp:345). 340 { 341 m_current_started = monotonictime; 342 m_current_callback = *itc; 343 if (m_current_callback->m_callback) 344 { 345 m_current_callback->m_callback(m_current_event, msg->body.signal.data); 346 } 347 m_current_callback = NULL; 348 } 349 } 0x4013f720 is in OvmsEvents::EventTask() (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_events.cpp:278). 273 esp_task_wdt_reset(); // Reset WATCHDOG timer for this task 274 m_current_event.clear(); 275 break; 276 case EVENT_phasedsignal: 277 m_current_event = msg.body.phasedsignal.event; 278 HandleQueueSignalEvent(&msg); 279 esp_task_wdt_reset(); // Reset WATCHDOG timer for this task 280 m_current_event.clear(); 281 break; 282 default: 0x4013f7a1 is in EventLaunchTask(void*) (/home/michaelg/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_events.cpp:93). 88 89 void EventLaunchTask(void *pvParameters) 90 { 91 OvmsEvents* me = (OvmsEvents*)pvParameters; 92 93 me->EventTask(); 94 } 95 96 void event_trace(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv) 97 { michaelg@Boggart:~/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3$ <mailto:michaelg@Boggart:~/esp/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3$> On Fri, 8 May 2026 at 05:43, Michael Balzer via OvmsDev <ovmsdev@lists.openvehicles.com <mailto:ovmsdev@lists.openvehicles.com>> wrote:
Mark,
Am 28.04.26 um 19:22 schrieb Michael Balzer via OvmsDev:
Am 27.04.26 um 07:38 schrieb Mark Webb-Johnson: > I did implement a FileWriter, which seemed neat as it simply records > to disk and supports the command Writer interface - and even hooked > it in so it correctly and neatly swaps from /store/… to /store2/… > during the store migration. But it just doesn’t seem very elegant at > the moment.
I see what you mean, but don't have a better idea yet. Maybe something like
GetPath()&SetPath()?I had to rework the log copying/handover to make sure we can still get details of the migrate step when it encounters corruption on /store, took that opportunity to also rework the FileWriter API.
Regards, Michael
-- Michael Balzer * Am Rahmen 5 * D-58313 Herdecke Fon 02330 9104094 * Handy 0176 20698926
OvmsDev mailing list -- ovmsdev@lists.openvehicles.com <mailto:ovmsdev@lists.openvehicles.com> To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com <mailto:ovmsdev-leave@lists.openvehicles.com>
-- Michael Balzer * Am Rahmen 5 * D-58313 Herdecke Fon 02330 9104094 * Handy 0176 20698926
OvmsDev mailing list -- ovmsdev@lists.openvehicles.com <mailto:ovmsdev@lists.openvehicles.com> To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com <mailto:ovmsdev-leave@lists.openvehicles.com>
-- Michael Balzer * Am Rahmen 5 * D-58313 Herdecke Fon 02330 9104094 * Handy 0176 20698926
OvmsDev mailing list -- ovmsdev@lists.openvehicles.com <mailto:ovmsdev@lists.openvehicles.com> To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com <mailto:ovmsdev-leave@lists.openvehicles.com>
-- Michael Balzer * Am Rahmen 5 * D-58313 Herdecke Fon 02330 9104094 * Handy 0176 20698926
<Partition-upgrade01.txt>_______________________________________________ OvmsDev mailing list -- ovmsdev@lists.openvehicles.com To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com