mail archive of the rauc mailing list
 help / color / mirror / Atom feed
From: Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de>
To: "rauc@pengutronix.de" <rauc@pengutronix.de>
Subject: [RAUC] open_slot_device() fails on slot type boot-mbr-switch
Date: Tue, 1 Dec 2020 17:42:36 +0000	[thread overview]
Message-ID: <147588af8cdb4eed8b9ef93f6f367080@itk-engineering.de> (raw)

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

                 reply	other threads:[~2020-12-01 17:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=147588af8cdb4eed8b9ef93f6f367080@itk-engineering.de \
    --to=martin.hollingsworth@itk-engineering.de \
    --cc=rauc@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox