How to unbrick HackRF. How to restore HackRF after failed device flashing
When trying to flash the device
hackrf_spiflash -w /usr/share/hackrf/hackrf_one_usb.bin
I got an error:
Writing 42500 bytes at 0x000000. hackrf_spiflash_write() failed: Input/Output Error (-1000)
After that, when HackRF was connected, only the 3V3 indicator began to light up on the device. And when I try to view device information
hackrf_info
I was getting the following message:
hackrf_info version: 2023.01.1 libhackrf version: 2023.01.1 (0.8) No HackRF boards found.
That is, the HackRF device is no longer found.
When trying to flash HackRF:
hackrf_spiflash -w /usr/share/hackrf/hackrf_one_usb.bin
a message began to appear that the HackRF device was not found:
File size 42500 bytes. hackrf_open() failed: HackRF not found (-5)
If you flashed the device so that it no longer works, then you need to boot using the DFU bootloader – it is written in ROM, so it cannot be damaged. To switch to DFU mode, you need to hold this button, while still holding this button, disconnect the USB cable and, while continuing to hold this button, reconnect the USB cable. If only the 3V3 indicator lights up, but no others light up, it means that you have successfully entered DFU mode.
Another way to switch to DFU mode is to hold down the DFU button and, while holding down the button, press and release the RESET button.
In this mode, you can use the appropriate program on your computer to flash HackRF.
First, make sure you have the dfu-util package installed, or install it.
- To install dfu-util on Kali Linux, Debian, Ubuntu, Linux Mint and derivatives of these distributions, run the commands:
sudo apt update sudo apt install dfu-util
- To install dfu-util on Arch Linux, BlackArch, Manjaro and derivatives of these distributions, run the command:
sudo pacman -S dfu-util
Now you need to run a command like
dfu-util --device 1fc9:000c --alt 0 --download /PATH/TO/hackrf/hackrf_one_usb.dfu
To find out the path to the hackrf_one_usb.dfu file, run:
locate hackrf_one_usb.dfu
My output:
/usr/share/hackrf/hackrf_one_usb.dfu
So in my case the command is:
dfu-util --device 1fc9:000c --alt 0 --download /usr/share/hackrf/hackrf_one_usb.dfu
I received the following messages:
dfu-util 0.11 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2021 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ dfu-util: Warning: DFU suffix CRC does not match dfu-util: A valid DFU suffix will be required in a future dfu-util release Opening DFU capable USB device... Device ID 1fc9:000c Device DFU version 0100 Claiming USB DFU Interface... Setting Alternate Interface #0 ... Determining device status... DFU state(2) = dfuIDLE, status(0) = No error condition is present DFU mode device DFU version 0100 Device returned transfer size 2048 Copying data from PC to DFU device Download [=========================] 100% 42564 bytes Download done. dfu-util: unable to read DFU status after completion (LIBUSB_ERROR_IO)
The download was successful, but the last message says an error: Failed to read DFU status. Since the following commands completed successfully, we can assume that this is not a fatal error.
Flashing HackRF again:
hackrf_spiflash -w /usr/share/hackrf/hackrf_one_usb.bin
This time the firmware update process went without errors:
File size 42500 bytes. Checking target device compatibility Erasing SPI flash. Writing 42500 bytes at 0x000000.
Check device status:
hackrf_info
A HackRF device has been detected and has the latest firmware.
hackrf_info version: 2023.01.1 libhackrf version: 2023.01.1 (0.8) Found HackRF Index: 0 Serial number: 0000000000000000a32868dc29183ccf Board ID Number: 2 (HackRF One) Firmware Version: 2023.01.1 (API:1.07) Part ID Number: 0xa000cb3c 0x00614764 Hardware Revision: older than r6 Hardware supported by installed firmware: HackRF One
“command dfu-util not found” error
If you get an error that the dfu-util command was not found, then install the dfu-util package as shown above.
Error “dfu-util: Could not open file hackrf_one_usb.dfu for reading: No such file or directory”
If when executing the command
dfu-util --device 1fc9:000c --alt 0 --download hackrf_one_usb.dfu
You received the following message
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2021 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ dfu-util: Could not open file hackrf_one_usb.dfu for reading: No such file or directory
It means that you incorrectly specified the path to the hackrf_one_usb.dfu file.
To find out the path to the hackrf_one_usb.dfu file, run:
locate hackrf_one_usb.dfu
Related articles:
- How to start with HackRF and gqrx (55.6%)
- How in Windows view the contents of a Linux disk and copy files from it (50%)
- How to use Android phone as GPS sensor in Linux (50%)
- How to install NVIDIA drivers, CUDA and Bumblebee on Arch Linux / BlackArch (50%)
- How to brute-force passwords using GPU and CPU in Linux (50%)
- How to install Greenbone Vulnerability Management (GVM) (formerly OpenVAS) on Kali Linux (RANDOM - 5.6%)