yashsingh1/xdaforums huggingface dataset:
[LG G5 Guides, News, & Discussion] autoprime:
hmm interesting. On previous LG devices this fix worked... I had just assumed it still would on G5.

Yes those offsets were blank due to wiping misc partition after using TOT to install TWRP/root (using recowvery to install twrp is now the superior method).

I might test out wiping my misc and trying to restore the MACs when I get some time to do that. Not sure why it isnt working.. unless there is more in the misc now besides those 2 addresses. And yes, those addresses should be correct.. I had checked a previously backed up H830 misc partition before posting to be sure. But I'll have to pull my current misc just to double check.

This is interesting... MAC issues without wiping the misc partition is new to me. Could you dump your misc partition and check the offsets to see if your Wifi and BT MAC are in your misc still?

Perhaps there is something tied to formatting /data as well.. like you both have mentioned doing.

I'll try looking into that as well.
[LG G5 Guides, News, & Discussion] Nimueh:
Ermmmm ... that went so far over my head I'd need a space shuttle to get to it :laugh:

I don't even know how to get to my Misc partition, much less how to "dump" it or check any offsets :confused:
[LG G5 Guides, News, & Discussion] jeffsga88:
Look at the 10 step guide autoprime posted on previous page. All you need to do is step 1 and 2 and upload and autoprime could take a look at it. Just use adb, it's easier than doing it from TWRP.
[LG G5 Guides, News, & Discussion] Nimueh:
That takes me right back to the space shuttle :laugh:

I've used ADB exactly 1 time - when unlocking this phone. Those were the longest 10 minutes of my life and I was sweating blood the whole time :angel:

I'll look at those commands again, but it's hard to use something when you have no idea wtf it is you're typing ;)

Couple of hours later:

I finally managed to get that dump file and it looks like 32 MB of ... absolutely nothing?

I downloaded a hex editor and couldn't find anything at the 2 spots you mentioned, it's all just 00's :confused:

So either I suck at this or my MACs aren't in there :laugh:
[LG G5 Guides, News, & Discussion] jeffsga88:
Yeah I understand, but you did it :p At both locations mine were all 0's too, so you might be looking at it right. If you want you could always post it and let autoprime take a look at it. I even edited mine to have my Mac address and wrote it back to my misc partition but it didn't work, so not sure.
[LG G5 Guides, News, & Discussion] Nimueh:
If [MENTION=6304619]MZO[/MENTION] hadn't helped me with those adb commands I'd still be pulling my hair out ... the post on the previous page is great for people that know how to get to the point of entering commands like that. I was absolutely clueless though and have now made a .txt file with the steps I took to get there :cool:

But yea - if we both have 0's it must've gotten wiped, in my case by formatting data after flashing TWRP. I'm not about to attempt to edit that misc dump and/or write anything back ... I'll just stick with your fix, it survives a dirty flash and I'll just have to remember to redo it if I do a clean flash :)
[LG G5 Guides, News, & Discussion] MZO:
Ha ha ha good thing we got it :)
[LG G5 Guides, News, & Discussion] Icetea:
i was affected from this problem too, because it seems, that this problem starts at the moment as i have formatted the wrong part of my system after a TWRP boot loop.

for me, it has fix the problem to insert line: "cur_etheraddr=5c:00:00:00:00:00" at the end of the "config" file in folder: "/data/misc/wifi". (don’t forget to set the file attributes to "664" after saving the file! The added mac address could be the one you want. I have used the "totalcommander" app for it.

Thanks to all users in this tread for the suggestion!!!:good:
[LG G5 Guides, News, & Discussion] CM-Tester:
SOLVED

Hello [MENTION=535343]all[/MENTION]...

i have a LG V20 us996 unlocked with the latest lineageos nightly...

So i did exactly what the OP said in his post, but when i push the terminal emulator to execute the command, it always shows "sush: cat: /sdcard/config: Permission denied" but it already asked for root rights in supersu...

i deledet the terminal emulator in supersu to test it again, but it is still the same...

I have supersu installed and now "root browser" with root rights ("mk-file-explorer root" seems to have not enough root rights, becaus in the new "root browser" (from playstore) i can see that data/misc/wifi/config was a file and i can delete it too)...

i downloaded the terminal emulator from playstore (jack palevich)...

What can i do to make it successfully ?

Anyone an idea ?

Thanks in advance !!!

EDIT:

Folks.... finally it works... i did change the properties/permissions of the wifi-folder for owner, group and others to R,R,R,W,W,W... after that i can just copy the edited file with my mac-address to that folder...

Reboot, and WOOOOOOOW... i have the mac-address i want (my original hardware mac-address... found it in my router-protocoll and set it into the file here)...

I do not need the terminal emulator :)

Hope this will help someone too ;)
[LG G5 Guides, News, & Discussion] Icetea:
[MENTION=7808749]CM-Tester[/MENTION]

but after next factory reset all this fixes are gone!

BTW: this will do the same

~ copy /data/misc/wifi config file to internal SD with totalcommander app

~ edit this config file with totalcommander build in editor and add line cur_etheraddr=xx:xx:xx:xx:xx:xx

(xxxx.. the MAC adress you want to set)

~ save file and set it to 644 with totalcommander "propperties"

~ copy config file back to /data/misc/wifi folder and reboot

but this help only to fix problem until the next factory reset!
[LG G5 Guides, News, & Discussion] Nimueh:
Yes of course it's only until you wipe the device.

As long as you dirty flash rom updates it sticks, but if you wipe all/factory reset and flash a (different) rom then you just do it again. Only takes a minute, so no big deal :)
[LG G5 Guides, News, & Discussion] CM-Tester:
Yes, thank you guys, as i got worried about that, i did made a backup-copy of the file and a little txt-file with a self-made-guide to remember me in the future (my little private ".txt-wiki" is rising everytime LOL) ;)

Well, i hope that it would be fixed in lineageos nightlies in the future... we will see
[LG G5 Guides, News, & Discussion] Nimueh:
They can't fix it, it's our device. Doesn't matter which rom you use, IF it happens to you it'll be on ALL of them - when I first noticed it I was still on (rooted) stock. Something to do with the first wipe ... even though the explanation given earlier in the thread doesn't apply to me.

It just happens ... same like it (my device at least) refuses to use the local IP that my router assigned to it, I HAVE to set it to static and give it the IP in the local settings if I want it to stick. Never had that issue with my old phones or tablet, but oh well ... once you know all that you can apply the fixes and all's good :good: :angel: :cool:
[LG G5 Guides, News, & Discussion] CM-Tester:
It can't be fixed by rom? Well ok... Then we have to fix it manually every time we need it... That stuff remembered me to the Windows 95/98 times (self configuration of autoexec.bat and system.ini) :D
[LG G5 Guides, News, & Discussion] Icetea:
this is really bad if you plan to sell the phone because the new owner doesn’t know that!
[LG G5 Guides, News, & Discussion] Nimueh:
Well honestly ... what does the MAC addy really matter? I used the phone for months before I even noticed + found this thread and had no issues at all. The IP changing and not using the one the router assigned to it was actually more annoying. :eek:

Only reason I use the MAC fix now is for my OCD, but normal daily use isn't affected by it at all imho. :)
[LG G5 Guides, News, & Discussion] tymestopm:
Static IPs with MAC filtering on your internal network for heightened security.
[LG G5 Guides, News, & Discussion] Nimueh:
MACs can easily be spoofed which is why I've never used filtering. Well that and the fact that people in this small town barely know how to set up wifi, much less connect to that of other people :laugh:

But sure, there are some cases where you'd want it ... but for normal Joe Shmoe it's not really THAT important :) :cool:
[LG G5 Guides, News, & Discussion] Mikeyy233:
can someone make a zip to fix it? cause i dont have data on h830. and i use it as wifi only kinda phone.
[LG G5 Guides, News, & Discussion] sjcali566:
I use the app Wifi Mac Changer from the Play Store and you can save a mac address in the app to use after every reboot. This has been my only solution, nothing else has worked.
[LG G5 Guides, News, & Discussion] Fild5x:
I have installed hades rom on my galaxy a500h and the rom changes my mac to 00:0A:F5:03:81:54. This makes it impossible for me to connect to my free wifi. I have tried this method but it seems this rom gets the wifi mac number from a diferent file and not config. I have also tried to change numbers in the. efs/wifi/.mac.info and the other one to no avail. I would like to get back to my mac in this rom.

I have tried to use wifi mac changer but I cant select the correct mac vendor since it is missing.

I am looking for help. Anyone?
[LG G5 Guides, News, & Discussion] wolfu11:
I took the time to do this on my rs988 and I can confirm this did work, but upon reboot it locked my bootloader and boot looped.

I wound up going back to 11c and am upgrading my phone back to 21c at each update I check my mac address and it no longer changes and stays on the one I put in the misc with hex.

Thank you [MENTION=2684188]autoprime[/MENTION]
[LG G5 Guides, News, & Discussion] redhonker:
autoprime's method worked for me. I do need to get root though. So I did the following

Downgrade to 20a

Install dirtycow, and use its run-as su to get root, edit misc partition, push it back

Install TWRP and flash 20m
[LG G5 Guides, News, & Discussion] Rehan Ul Hsaan:
It Worked For Me Thanks :o:o
[LG G5 Guides, News, & Discussion] Quardah:
Please delete this comment thanks.
[LG G5 Guides, News, & Discussion] ericcl:
This worked for me after taking a LineageOS OTA for the first time. I don't want to have to go through this every time I take an OTA, but at least I have the file stored on my external SD card and the command in a .sh file.
[LG G5 Guides, News, & Discussion] usmanatron:
misc update worked

Just want to add my experience...

I did end up wiping my misc partition and, once Id used LGUP etc. had a MAC address of 0 (which stopped me connecting to my wifi network).
[MENTION=2684188]autoprime[/MENTION] s fix worked for me first time and Ive finally reverted the mess I made :D. Thanks [MENTION=2684188]autoprime[/MENTION] :highfive:
[LG G5 Guides, News, & Discussion] SuperQvas:
Didn't work for me!!!

I try this guide but I wasn't lucky enough to get it working or better yet, the guide didn't solve my problem.

my phone's details:

custom ROM Resurrection Remix

custom ROM's version (v.5.8.5 final)

Android version 7.1.2 (flashed over android 7.0)

phone model (LG G5 h850)

Any help my people?
[LG G5 Guides, News, & Discussion] waylo:
Fix it using [MENTION=2684188]autoprime[/MENTION]'s method. Worked for me great. Your ROM shouldn't matter as long as you reconstruct the /misc partition.

https://xdaforums.com/lg-g5/how-to/...s-changing-t3533841/post70474540#post70474540
[LG G5 Guides, News, & Discussion] SuperQvas:
You're a beast, autoprime!!!

tried a lot of methods but yours was the only one that worked!!!

---------- Post added at 12:43 AM ---------- Previous post was at 12:41 AM ----------

yeah, I was trying that while you were suggesting it to me, thanks, It worked.
[LG G5 Guides, News, & Discussion] waylo:
One 'feature' we lose by fixing this is now that the wifi MAC address no longer randomly generates every time we reboot, we won't be able to get endless time on those 'free but timed' public wifi stations =P
[LG G5 Guides, News, & Discussion] Phong phamj:
after the adb pull /sdcard/misc-dump.img command, where can i find the misc-dump.img file to edit?
[LG G5 Guides, News, & Discussion] waylo:
It should be in the main folder on the internal memory. /sdcard to be specific, exactly from the command you posted.

EDIT: Oops, looks like I misread the question. [MENTION=4628223]totalnoob34[/MENTION] has it right.
[LG G5 Guides, News, & Discussion] totalnoob34:
You'll find it in the folder you're using the PC terminal from. It's C:\Users\totalnoob34\, in my case. Don't be afraid to google the command to get the complete syntax.

I just had to go though this whole procedure, here's some tips for all those inexperienced reading this:

0) Always do some research on the commands you're running, and the partitions you're touching when doing so.

1) Never EVER use LineageOS updater, you're going to end in a TWRP loop. Use the command posted here to get out of it.

2) If you've wiped /misc, and you're following this guide, preferably do so with the phone booted, and not from TWRP. I repeated the whole process a dozen times without success before trying booting the phone.

Lastly, many thanks to [MENTION=2684188]autoprime[/MENTION] for putting his awesome guide together. Kudos, man.
[LG G5 Guides, News, & Discussion] Phong phamj:
i can't find the totalnoob34 folder
[LG G5 Guides, News, & Discussion] totalnoob34:
It's my username, you should be looking for your own name there.
[LG G5 Guides, News, & Discussion] Nimueh:
:laugh: :laugh: :laugh: :laugh: :laugh:

Sorry, but I couldn't help myself :angel: :angel: :angel:
[LG G5 Guides, News, & Discussion] totalnoob34:
I edited the post, and put the 'in my case' to bold. I hope no one gets misled anymore.

what if my username was like 'stolensexualpics'
[LG G5 Guides, News, & Discussion] Nimueh:
I didn't think there WAS anything misleading, that's why I couldn't help myself and had to laugh :angel: :D

But yea, that would be even funnier :laugh:
[LG G5 Guides, News, & Discussion] totalnoob34:
I've got a question for [MENTION=2684188]autoprime[/MENTION]. I applied his hard fix, confirmed it working, then used UPPERCUT to go back to stock.

Now Bluetooth MAC is the one I entered, but WiFi is reset to 02:00:00:00:00:00.

Funnily enough, the /misc image still reports both MACs I entered, at 6000h and 8000h. Does flashing stock modify anything?

EDIT: Also,

/data/misc/wifi/config contains

cur_etheraddr = [...]

Containing the MAC address I put in the misc image. Something's wrong here.

EDIT2: Just so I suspected, it's reading the MAC address from the wrong spot. Flashing LOS fixed the misread, it is reading the entry I modified again in /misc. Perhaps stock uses a multiple of 0x6000? BT was being recognized fine, WiFi was misread as 20:00:00:00:00:00
[LG G5 Guides, News, & Discussion] Mojo Dodo:
Hello [MENTION=7188028]jeffsga88[/MENTION],

well, first of all thanks for the guide!

My problem is that after being so stupid to

dd if=/dev/zero of=/dev/block/platform/soc/624000.ufshc/by-name/misc

and brick my LG G5 H850 (LG warning screen "Your Device is corrupt. It cannot be trusted and will not boot. ...") which I could get working by flashing stock via LGUP, my current problem is that the WiFi MAC-Adress shows to be 00:00:00:00:00:00.

I flashed LineageOS again and tried the method of your guide, but that just gets me ending up with the LG warning screen again.

How to you got to know the offsets 6000 and 8000? In my misc.img at 6000 and 8000 there's just zeros.

Has anyone an idea?

EDIT: sorry, I meant [MENTION=2684188]autoprime[/MENTION],
[LG G5 Guides, News, & Discussion] totalnoob34:
First, use UPPERCUT and flash 20d KDZ, then root it and install TWRP. At this point, with the phone booted, you follow the guide by autoprime.

What's your problem with offsets? Each row has an offset, and you enter the relevant data at the correct ones. You also have pictures in the guide.
[LG G5 Guides, News, & Discussion] Mojo Dodo:
First of all, thanks for responding!

The problem was that when I added the MAC address to the offset 6000 and 8000 and wanted to flash it back, the image seemed to bee too large (don't know how that can happen) and I ended up with the LG warning screen:

"Your Device is corrupt. It cannot be trusted and will not boot."

adb shell
~ # dd if=/tmp/misc-dump-fixed.img of=/dev/block/bootdevice/by-name/misc
dd: writing '/dev/block/bootdevice/by-name/misc': No space left on device
65536+1 records in
65536+0 records out
33554432 bytes (32.0MB) copied, 2.132651 seconds, 15.0MB/s

So what I did then was:

- I flashed H85020s_00_OPEN_EU_OP_1114.kdz with LGUP

→ phone works again with LG stock Android (although I get a weird error message "Current version is not available for user. Can't find matched cust for NTCODE = [,]"), but MAC address was still 00:00:00:00:00:00

→ from the Android menu I did a network and factory reset

→ supprisingly I then got a MAC address other than 00:00:00:00:00:00 (this was not the case when flashing stock with LGUP before) but it turns out that it now changes randomly (at least now the phone is able to connect to WiFi networks)

- So still I wanted to get my old/correct MAC address back (I have it from the router logs)

→ I made a new image of my misc partition so I could change the MAC address with the hex editor:

adb shell
dd if=/dev/block/bootdevice/by-name/misc of=/tmp/misc-dump.img

then

adb pull /tmp/misc-dump.img

→ at offset 6000 + 8000 already is the old/correct MAC address again. However, it differs from the random MAC addresses I get after rebooting - these show to be different in the Android menu as well as when I check

wlan0

by

adb shell
~ # ip link

- Now I unlocked the bootloader, flashed TWRP, installed lineage-14.1-20180213-nightly-h850-signed.zip

→ MAC address in LineageOS is again 00:00:00:00:00:00

→ again I made an image of /dev/block/bootdevice/by-name/misc → there, the IP is still my old/correct one

Cut a long story short: Flashing stock Android with LGUP and subsequently doing a factory reset, solved my problem of having a constant MAC address of 00:00:00:00:00:00, but still leaves me with the problem of the MAC address changing with every reboot. Installing LineageOS again brings up the MAC address = 00:00:00:00:00:00 issue (while the correct one is still located in the misc partition)

Any help is greatly appreciated :)
[LG G5 Guides, News, & Discussion] totalnoob34:
I have zero clues on that, I can't see how a pulled and edited image can be larger than the place you took it from. I'd say some weird partition corruption happened, or glitch or some sort of lovely unexplainable feckery devices do from time to time.

That's normal, when you flash a KDZ that is not your phone's original brand/version you get that message. Don't worry about it.

That's not surprising. According to my experience, stock ROMs read the WiFi MAC address from a different location in /misc, and apparently randomize it on boot when you happen to wipe it.

I couldn't for the life of me get a working WiFi MAC on stock after wiping /misc. It'd get reset to 02:00:00:00:00:00 for no reason, even though /misc image was reporting the correct values at the correct offset.

Did you perform the image fix in TWRP? If so, try doing it with the phone booted, granting su access to adb. If you read my previous posts, I explain the whole experience in detail.

Let me know how it goes.
[LG G5 Guides, News, & Discussion] waylo:
What utility did you use to edit the pulled .img? Make sure it's overwriting, not augmenting it. That would extend the .img file by 2 MAC addresses' length.
[LG G5 Guides, News, & Discussion] Mojo Dodo:
I did it in TWRP. Didn't consider that there could be a difference.

But the problem now is: I'm on LineageOS and if I open the current .img-file of my misc partition with a hex editor, I have the "correct" MAC address at the offset 6000 and 8000, but still LineageOS shows it to be 00:00:00:00:00:00 and I can't connect to WiFi networks.

If I check the MAC address in adb shell (in LineageOS, flashed with SuperSU) I get:

...
h850:/ # ip link
6: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether [COLOR="blue"]00:00:00:00:00:00[/COLOR] brd ff:ff:ff:ff:ff:ff
...

and

h850:/ $ su
h850:/ # cat data/misc/wifi/config
cur_etheraddr=[COLOR="blue"]00:00:00:00:00:00[/COLOR]

→ i.e. the although the MAC address in misc is correct LineageOS takes 00:00:00:00:00:00

So, I then tried the solution [MENTION=7188028]jeffsga88[/MENTION] and changed data/misc/wifi/config

h850:/ # cat /sdcard/config > data/misc/wifi/config
h850:/ # ls -l data/misc/wifi/config
-rw-r--r-- 1 system wifi 32 2018-02-20 09:45 data/misc/wifi/config

this gives me (xx is the desired address that I set):

h850:/ # cat data/misc/wifi/config
cur_etheraddr=[COLOR="Blue"]xx:xx:xx:xx:xx:xx[/COLOR]

and

h850:/ # ip link
...
6: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether [COLOR="Blue"]00:00:00:00:00:00[/COLOR] brd ff:ff:ff:ff:ff:ff
...

In the LineageOS/Android menu it's also still 00:00:00:00:00:00

Then I rebooted the phone with WiFi turned off (!!) and in the LineageOS/Android menu it now is 20:00:00:00:00:00

the config file has changed again to (so it's not permanent like in [MENTION=7188028]jeffsga88[/MENTION]'s guide):

h850:/ # cat data/misc/wifi/config
cur_etheraddr=[COLOR="Blue"]00:00:00:00:00:00[/COLOR]

However, surprise surprise, ip link shows the correct MAC address:

h850:/ # ip link
...
6: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether [COLOR="Blue"]xx:xx:xx:xx:xx:xx[/COLOR] brd ff:ff:ff:ff:ff:ff
...

But when I now switch WiFi on in the Android menu, the MAC address in Android suddenly changes back to 00:00:00:00:00:00, which is also what ip link then says:

h850:/ # ip link
...
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT mode DORMANT group default qlen 1000
link/ether [COLOR="Blue"]00:00:00:00:00:00[/COLOR] brd ff:ff:ff:ff:ff:ff
...

I don't have all the necessary background knowledge to make sense of that... :confused:

That was probably the problem, thanks! I'm using Bless Hex Editor on Ubuntu. You need to make sure to select the part you want to edit otherwise it will indeed insert additional characters in between. I didn't realize this at the first time, because everything was just 0.
[LG G5 Guides, News, & Discussion] totalnoob34:
Ok, let me say that I really appreciate your thoroughness in explaining what's going on and what you tried, everyone on XDA just goes 'this doesn't work, help' without giving anything to work with. Now, back to business.

When I had this issue I only succeeded when I tried with the phone booted. Moreover, I was also reading the values I entered pulling back the image, so everything you've experienced so far lines up with what happened to me.

Me neither, unfortunately. My conclusion, as I stated before, is that stock reads the addresses from a different location, or processes the values in a different way than Lineage. My best shot is to try repeating the process with the phone booted, in my case that did the trick.

It's important to note that I'm now on Lineage OS and WiFi/BT works, however when flashing a stock ROM (be it a KDZ or stock-based), the WiFi (and not BT) MAC address reverts to 20:00:00:00:00:00. Again, this is beyond my comprehension. I'd very much appreciate a comment by autoprime, but I believe he moved on to a different device, so we could be on our own.

Again, let me know how it goes. Sorry I wasn't of much help.