fwupd / fwupd

A system daemon to allow session software to update firmware
GNU Lesser General Public License v2.1
2.98k stars 439 forks source link

Tools compiled with the latest code will fail to write-firmware #8146

Open MankWang opened 1 week ago

MankWang commented 1 week ago

Describe the question After compiling with the latest code, using the command fwupdmgr to upgrade the firmware will prompt

'failed to write-firmware: failed after 30 retries: failed to open /dev/wwan0qcdm0: Operation not permitted'.

Whether entering the sudo password or switching to the root user, this error will always occur. And when I downgraded to 1.9.26, there was no such error message. What could be the reason for this?

fwupd version information

fwupdmgr --version
compile   info.libusb                   1.0.27
compile   org.freedesktop.fwupd         2.0.2
compile   com.hughsie.libxmlb           0.3.21
compile   org.freedesktop.Passim        0.1.8
compile   com.hughsie.libjcat           0.2.2
runtime   org.freedesktop.fwupd-efi     1.9.24
runtime   org.freedesktop.Passim        0.1.8
runtime   com.hughsie.libxmlb           0.3.21
compile   org.freedesktop.fwupd.source  2.0.1-354-g88e009e76
runtime   com.hughsie.libjcat           0.2.2
runtime   org.kernel                    6.12.0-rc2
runtime   org.freedesktop.fwupd         2.0.2
hughsie commented 1 week ago

failed to open /dev/wwan0qcdm0: Operation not permitted

A permissions error perhaps? If you can get us the daemon -vv output that would help a lot.

lvoegl commented 1 week ago

In version 1.9.26, we expected a FWUPD_ERROR_INVALID_FILE when switching to EDL mode, since the modem device changed and those ports are not available anymore. Starting from version 2.0.0 this was removed, so instead of continuing with the update, you're seeing the error being returned here.

MankWang commented 1 week ago

In version 1.9.26, we expected a FWUPD_ERROR_INVALID_FILE when switching to EDL mode, since the modem device changed and those ports are not available anymore. Starting from version 2.0.0 this was removed, so instead of continuing with the update, you're seeing the error being returned here.

@lvoegl So what should I modify or set up now to perform a normal upgrade. This error is preventing us from using the latest version for firmware upgrades.

hughsie commented 5 days ago

This error is preventing us from using the latest version for firmware upgrades.

I don't have any hardware capable of being updated with the ModemManager plugin, and the modem-manger plugin currently has a 3.49% self test coverage score. I think someone with hardware is going to have to look at the code I'm afraid.

MankWang commented 5 days ago

@hughsie @lvoegl I have discovered a serious bug, as shown in the screenshot below. The modification below will cause switching to EDL always fail and prevent firmware upgrade. Please help confirm this issue, as it will prevent us from proceeding with next month's testing plan. Thank you. image

hughsie commented 4 days ago

Please help confirm this issue

I don't have any updatable modem hardware.

lvoegl commented 4 days ago

I don't think this is an unknown bug, rather something that still has to be properly implemented as stated in fwupd#7741. I unfortunately also don't have any MHI PCI modems to test this with.

Although I haven't gotten very far yet, I've started looking into updating non-MBIM USB modems via Firehose/Sahara (which currently does not seem possible) and EDL mode switching works similarly there.

MankWang commented 4 days ago

I see, so now it is necessary to add a notification to let fwupd know that wwan0firehose has been loaded, and then call attach() to get the edl_port information? I'm not very familiar with the code flow in fwupd. If you have any modification suggestions, I can help test them.

lvoegl commented 3 days ago

Basically yes. Correct me if I'm wrong, but I'd say the Sahara/Firehose update process should also follow what most other update protocols do - ->detach() into the 'update' (EDL) mode/bootloader, load the Firehose program via Sahara if necessary, and then perform the actual Firehose update regularly in the ->write_firmware() step.