What happened?
The counterfeit card detection introduced in this commit hardcodes the timeout for BLKDISCARD at 30 seconds which is overly aggressive for some cards.
Using a PNY 64 GB microSD, I've confirmed the card is reporting a legitimate size using https://github.com/AltraMayor/f3 and the card supports BLKDISCARD. However, when running time blkdiscard /dev/my-card it takes ~60 seconds to complete.
Can this timeout period either be configurable or increased to a higher threshold?
Using the debug option to skip end-of-device checks is a workaround via GUI but it doesn't look like this is available as an option via CLI.
Version
2.0.3 AppImage
What host operating system were you using?
Other Linux environment
Host OS Version
Linux Fedora 43 kernel 6.17.12-300.fc43.x86_64
Selected OS
Raspberry pi OS 64-bit Trixie
Which Raspberry Pi Device are you using?
Raspberry Pi 5, 500, and Compute Modules 5
What kind of storage device are you using?
microSD Card in an internal reader
OS Customisation
Relevant log output
Running as root via sudo
Original user: sgerkin
Original UID: 1000
Original home directory: /home/sgerkin
DISPLAY already set to: :0
XAUTHORITY already set to: /run/user/1000/xauth_egwkln
Set HOME to: /home/sgerkin
Set XDG_CACHE_HOME to: /home/sgerkin/.cache
Set XDG_CONFIG_HOME to: /home/sgerkin/.config
Set XDG_DATA_HOME to: /home/sgerkin/.local/share
Set XDG_RUNTIME_DIR to: /run/user/1000
Set DBUS_SESSION_BUS_ADDRESS to: unix:path=/run/user/1000/bus
libcurl initialized globally
CacheManager initialized with background thread
Detected total system memory: 63991 MB on "Linux"
Optimal async queue depth: 512 (memory budget: 12672 MB, block size: 1024 KB, baseline: 512 )
FileOperations log callback installed
Starting background cache operations
Found cached file info, starting background verification: "/home/sgerkin/.cache/Raspberry Pi/Raspberry Pi Imager/lastdownload.cache"
Starting background drive list polling
setSrc: initFormat parameter: "systemd" -> _initFormat set to: "systemd"
Drive added: "/dev/mmcblk0"
Drive added: "/dev/nvme1n1"
Drive added: "/dev/nvme0n1"
Device selection changed to: "/dev/mmcblk0"
Drive added: "/dev/mmcblk0"
Drive added: "/dev/nvme1n1"
Drive added: "/dev/nvme0n1"
Pausing drive scanning during write operation
Drive scan mode changed to: Paused
PerformanceStats: Started cycle for "2025-12-04-raspios-trixie-arm64.img" size: 6450839552 device: "/dev/mmcblk0" total events: 1
Adaptive sync configuration: "High memory (63991MB)" - Sync interval: 256 MB - Time interval: 7000 ms - Platform: "Linux"
Optimal write buffer size: 8192 KB for 63991 MB system
Ring buffer: 3168 slots x 4096 KB = 12672 MB (available: 42243 MB, total: 63991 MB)
PerformanceStats: System info set - RAM: 63991 MB total, 42243 MB available Device: ""
[FileOps] io_uring support not compiled in, async I/O disabled
Adaptive sync configuration: "High memory (63991MB)" - Sync interval: 256 MB - Time interval: 7000 ms - Platform: "Linux"
Optimal write buffer size: 8192 KB for 63991 MB system
Ring buffer: 3168 slots x 4096 KB = 12672 MB (available: 42243 MB, total: 63991 MB)
RingBuffer: Allocated 3168 slots of 4096 KB each ( 12672 MB total)
Optimal async queue depth: 512 (memory budget: 12672 MB, block size: 8192 KB, baseline: 512 )
RingBuffer: Allocated 516 slots of 8192 KB each ( 4128 MB total)
Using buffer size: 8388608 bytes with page size: 4096 bytes
Ring buffer: 0 slots of 4194304 bytes
Write ring buffer: 516 slots of 8388608 bytes (optimal depth: 512 , max configurable: 512 )
Optimal write buffer size: 8192 KB for 63991 MB system
startWrite: Passing to thread - initFormat: "systemd" cloudinit empty: true cloudinitNetwork empty: true
DownloadThread::setImageCustomisation - initFormat: "systemd" cloudinit empty: true cloudinitNetwork empty: true
DownloadThread: Direct I/O enabled
DownloadThread: Periodic sync enabled
DownloadThread: Verbose logging disabled
DownloadThread: Async I/O enabled
DownloadThread: Async queue depth set to 256
DownloadThread: IPv4-only mode disabled
DownloadThread: Skip end-of-device operations disabled
Unmounting: "/dev/mmcblk0"
�[0K Unmounting drive...
�[0K Opening drive...
Device authorization and open took 0 ms
Debug: Enabling direct I/O as per debug options
[FileOps] O_DIRECT enabled
Async I/O requested but not supported on this platform
SD card CID: "2750485344363447606244b6bc019100"
SD card CSD: "400e00325b590001d21f7f800a400000"
Try to perform TRIM/DISCARD on device
�[0K Discarding existing data on drive...
Cache verification: valid "/home/sgerkin/.cache/Raspberry Pi/Raspberry Pi Imager/lastdownload.cache"
Received cacheFileUpdated signal - refreshing UI for hash: "19b108fe07cff2b5cd7df0f76b6d7325e43fb2a1d5418d10f6bd56642e0e8579"
BLKDISCARD timed out - possible counterfeit device with fake capacity
Zeroing out first and last MB of drive
�[0K Zero'ing out first and last MB of drive...
First MB + flush took 400 ms
I/O operation timed out after 30 seconds
Write complete, switching to slow drive scanning
Drive scan mode changed to: Slow
PerformanceStats: Cycle ended, success: false events: 5 samples: dl= 0 dec= 0 wr= 0 vfy= 0
�[0KError: Timeout while writing to the end of the storage device.<br>This often indicates a counterfeit SD card that reports a larger capacity than it actually has (e.g., claims to be 2TB but only has 8GB).<br><br>Please try a different storage device.
Stopping network monitoring
Stopping background drive list polling
Cleaning up CacheManager
CacheManager destructor: cleaning up background thread
CacheManager destructor: cleanup complete
What happened?
The counterfeit card detection introduced in this commit hardcodes the timeout for BLKDISCARD at 30 seconds which is overly aggressive for some cards.
Using a PNY 64 GB microSD, I've confirmed the card is reporting a legitimate size using https://github.com/AltraMayor/f3 and the card supports BLKDISCARD. However, when running
time blkdiscard /dev/my-cardit takes ~60 seconds to complete.Can this timeout period either be configurable or increased to a higher threshold?
Using the debug option to skip end-of-device checks is a workaround via GUI but it doesn't look like this is available as an option via CLI.
Version
2.0.3 AppImage
What host operating system were you using?
Other Linux environment
Host OS Version
Linux Fedora 43 kernel 6.17.12-300.fc43.x86_64
Selected OS
Raspberry pi OS 64-bit Trixie
Which Raspberry Pi Device are you using?
Raspberry Pi 5, 500, and Compute Modules 5
What kind of storage device are you using?
microSD Card in an internal reader
OS Customisation
Relevant log output