-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: error writing to storage (while fsync) #902
Comments
Here are some things I already tried to resolve this:
None of these steps had any effect. Upon examining the SD card after the error I see this:
This shows that the first megabyte of the disk has been zeroed, exactly as the log said it would be. Subsequently, no data from the OS image has been written at all, otherwise the beginning of the disk would not contain zeros. This means that the software is capable of writing to the disk. There is no permission or configuration error preventing it. |
Examining the code shows that this is an error inside downloadthread.cpp, and happens because fsync fails. The fsync code is disabled on Windows, because it fails there (see https://forums.raspberrypi.com/viewtopic.php?t=267364) however the problems with this code are much, much deeper. Firstly, this is what the code is supposed to do:
Now there are a few problems with this: Firstly during step 1., this happens:
This step did not fail. Why? Because it succeeds if Later on during step 2. we have this:
This time the fsync return value is correctly interpreted as non-zero == error, so if fsync fails, we get an error. All of this code is disabled on windows by |
Digging deeper, the reason why step 1. does not fail is because of yet another bug: |
I commented out the fsyncs and the imaging completed successfully. However, the resulting SD card was extremely corrupted. No subdirectories of the root filesystem can be read due to filesystem errors. I tried again with a different SD card and this time the rootfs doesn't show up as a mountable filesystem at all, even though the partition table shows two partitions. Writing the image using |
So I asked on Qt IRC channel to confirm the behavior of I also noticed that |
I determined that this is something to do with the USB writers. What happens is that at some point a block is dropped. This doesn't cause a write error and from this point on all writes apparently succeed instantly. It then fails during |
Thanks for the report, @ali1234 You've gone above and beyond in terms of reporting, for which I am extremely thankful. I'm going to review your findings later today, but if you can't wait for me to address it I'm happy to review a PR. |
I'll send a PR for the reversed The original errors I encountered are not really actionable. I suspect it could be heat related as the failing writers are very small and get really hot. I found a writer that works and it is a much larger USB3 one (tested on a USB3 port). |
After some more playing around I was able to reproduce the corruption with |
What happened?
When attempting to write an image to any SD card, this error happens near the end of writing. The SD card is left without a valid filesystem.
Writing the same image with
dd
works correctly (verified matching checksum on read-back).Version
1.8.5 (Default)
What host operating system were you using?
Debian and derivatives (eg Ubuntu)
Host OS Version
Ubuntu 24.04
Selected OS
Raspberry Pi OS Lite 64 bit
Which Raspberry Pi Device are you using?
Raspberry Pi 5
What kind of storage device are you using?
microSD Card in a USB reader
OS Customisation
Relevant log output
The text was updated successfully, but these errors were encountered: