[LG G5 Guides, News, & Discussion] autoprime:
yes, that command you listed wipes the misc partition. It should be avoided when possible.. instead.. only wiping the things to stop getting stuck in TWRP etc. Many suggest the quick and easy "wipe the entire thing" method... but you can now see some of the results from doing that. Since the G2 and G3 days I've been suggesting otherwise - https://xdaforums.com/lg-g3/development/fix-stuck-custom-recovery-trying-ota-t2907508

Command to safely get out of stuck TWRP would need to be updated for the G5:

dd if=/dev/zero of=/dev/block/bootdevice/by-name/misc bs=256 count=1 conv=notrunc

that would help some people stuck in TWRP (wont help those stuck in download mode.. they should just successfully flash a TOT/KDZ to stop phone from booting into download mode). And it may not work in every instance but should work in many.

As for "why is it wiping misc again?"...

it's not. you placed a file in /data/ to fix the issue.. then you are wiping /data/. why would the fix stay? ;)

if you want a perm fix, fix misc and don't bother with your temp fix in /data/. Or perhaps update you're OP and include both (if my fix works.. but I believe it should) just so people have options.

Here's a 10-step MAC Fix (assuming you aren't using the "temp" fix in /data/)

1. backup/dump your misc partition:

dd if=/dev/block/bootdevice/by-name/misc of=/sdcard/misc-dump.img

or if in TWRP with encrypted /data use: dd if=/dev/block/bootdevice/by-name/misc of=/tmp/misc-dump.img to dump to the /tmp/ directory.

2. pull misc-dump.img from phone onto computer.

adb pull /sdcard/misc-dump.img

or adb pull /tmp/misc-dump.img

etc...

3. On computer, open up misc-dump.img in a hex editor. HxD is a decent free hex editor for Windows. Or use whatever.. hex editor is hex editor ( I use 010 Editor).

4. After opening the misc-dump.img in the hex editor you'll see the file in raw hex. Scroll down to offset 6000 for the Wifi MAC.

As seen in the picture below, the Wifi MAC is @ 6000h and is currently DE:AD:BE:EF:FE:ED, you will edit that section with your original MAC address instead (or current mac address you want to stick).

5. Now scroll down to offset 8000 for the Wifi MAC.

As seen in the picture below, the BT MAC is @ 8000h and is currently DE:AD:BE:EF:CA:FE, you will edit that section with your original MAC address instead (or current mac address you want to stick).

6. Save the edits made to the misc-dump.img. To be proper, select "Safe As.." instead of save and name the new file: misc-fixed.img

7. Push the fixed misc partition to your phone:

adb push /sdcard/misc-fixed.img

or... adb push /tmp/misc-fixed.img

8. Flash the misc-fixed.img on your phone to your misc partition:

dd if=/sdcard/misc-fixed.img of=/dev/block/bootdevice/by-name/misc

or.. dd if=/tmp/misc-fixed.img of=/dev/block/bootdevice/by-name/misc

9. Reboot phone, or boot into Android if in TWRP. Wifi/BT MAC should now be fixed.

10. Save misc partitions just in case. Ideally you want an untouched misc partition before messing with anything on your phone.. sort of like backing up your EFS first. But worst case.. you can use the steps above to fix Wifi/BT MAC address issues.