From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx0.itk-engineering.de ([212.121.145.30]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kk9fi-0001KQ-NT for rauc@pengutronix.de; Tue, 01 Dec 2020 18:42:39 +0100 From: Martin Hollingsworth Date: Tue, 1 Dec 2020 17:42:36 +0000 Message-ID: <147588af8cdb4eed8b9ef93f6f367080@itk-engineering.de> Content-Language: de-DE MIME-Version: 1.0 Subject: [RAUC] open_slot_device() fails on slot type boot-mbr-switch List-Id: RAUC Project - Discussion List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: rauc-bounces@pengutronix.de Sender: "RAUC" To: "rauc@pengutronix.de" Hello Community, When updating a bootloader slot of type boot-mbr-switch the function g_open() in open_slot_device() from update_handler.c fails: > 90% Copying image to bootloader.0 failed. > [...] > LastError: Installation error: Failed updating slot bootloader.0: Opening output device /dev/mmcblk0 failed: Device or resource busy In my opinion this is due to the O_EXCL flag in g_open(), because for type boot-mbr-switch the code tries to open the full device (/dev/mmcblk0) instead of an inactive partition (/dev/mmcblk0p1). I assume the device is busy because at leat the rootfs partition of the currently running system is mounted. For an associated system.conf see the documentation example 7.6.2. I suggest that the O_EXCL flag should not be used on slot type boot-mbr-switch, because in this case it is legitimate to open a busy device for writing (compared to a "normal" slot update). Some testing confirms the functionality. Is this a bug or am I missing something here? What is your opinion on this? If confirmed a bug I have a simple patch prepared. Thanks and Regards, Martin Hollingsworth _______________________________________________ RAUC mailing list