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
Moving SD card between RaspberryPi also takes Mac address? #245
Comments
By way of update. My hypothesis was correct; somehow the os/sd card stores the Mac address it was installed on (!). I removed the SD card, etched the image again, put it in the prod machine and it setup a new hassio and was visible on the correct IP; i.e. the install process worked out the Mac address of the hardware. Would love to know where the Mac address is stored and where I could have changed it rather than starting again! |
That is managed by NetworkManager |
Understand you have closed this, but regardless of a feature being managed by another software package, if said feature is different from both previous hassio installations AND from conventional IT/networking conventions it strikes me it would be worth pointing out. That could be to external documentation, but so far I haven't found anything that, in simple terms, explains the mac address cloning. |
I just had two devices with identical MACs because of Hassos MAC persistence, took quite a while to faultfind. I'd suggest that if NetworkManager is persisting MAC addresses then it's configured incorrectly in the Hassos image. If you're building a Network manager profile then saving it perhaps using this:
To remove the MAC from the profile. or perhaps:
Is getting set somewhere in your creation scripts. |
Neither Hassos nor NetworkManager will change/clone/store any mac address. (tested with ova build 2.5) NetworkManager does persist its dhcp lease, so when Hassos boots it will request the same ip address it had before. It depends on the dhcp-server if it actually will get the requested address. In my case with a Mikrotik router, the dhcp server will send a NAK when the original lease is stlll valid, after which NetworkManager will perform a dhcp discover and gets a different address. When the original lease has expired it will assign the requested ip. When original lease was a static/reserved lease, it will assign a different ip address. If you want to clear the old lease info, you remove the lease info via a debug login from |
Two Raspberry Pi's, lets call them RPIHASSOS and RPITEST
Boot RPIHASSOS that Hassos initially booted from, running Hassos
Shutdown, Swap SD card, reboot
etc, Shutdown
Shutdown, Swap SD card, reboot
Reading more about NetworkManager I see that the Hassos file:
contains the line:
But that is IPv6, so it shouldn't affect IPv4 However I see interesting information in the Networkmanager settings under "stable-id"
Which suggests there may be cross-polination between that IPv6 option and the persisting IPV4 MAC address that I am seeing. I'm new to NetworkManager (I have history with BSD and Linux but I've never used/needed it) But as you can see it is happening. I guess my next port of call it to get a tcpdump of the DHCP exchange, see what NetworkManager is instructing the DHCP Client to do. |
I also see:
Then elsewhere:
|
@Curtis-Fletcher Thanks for your detailed explanation. However you seem to be running Hass.io on Raspbian, not on Hassos, so it seems to be a Raspbian issue. That said, the MAC is probably stored in ether |
I'm afraid you are mistaken. There are two Pi's and two OS installs involved in this testing.
(If you have a look at my log above you should see me noting "shutdown, swap sd"-like actions, this is when I change OS for verification of the actual MAC) The only change made to the Hassos image is that I extracted the squashfs image for the root FS, altered the root user and re-compressed/wrote-back in order to be able to log into the console. Which was only done after this problem manifested in order to fault-find. Also I've looked in the mounted /var/lib/NetworkManager/ location and /etc/NetworkManager/ in running Hassos install and currently don't see it. and yet it is happening. I also wonder if the MAC is being sent to NetworkManager via udev Just for clarity I'll summarize the events listed in my log above
|
@Curtis-Fletcher thanks for your persistence with this. It's good to know I'm not the only one with this issue. You are delving much deeper than I did - but seems we both wasted a bunch of time identifying the issue. Watching this thread with interest. |
@Curtis-Fletcher Can you try with release 2.5 ? |
Maybe it's a bug inside NetworkManager in that version they we use? I agree we don't set the flag for persistent mac. Anyway, the root OS is read-only. There is a partition with persistent config files. You can clean up the |
I don't have them booted right now (because of the MAC issue) but RPIHASSOS was a 3B and RPITEST was a 3B initially then a 3B+ on the second test documented above. Both tests on the 3B and the 3B+ were identical as documented above. At no point was I using wifi. |
Ok, I'm unable to reproduce your issue with some 3B+ devices using a 2.5 image: First device:
(time jump because of ntp time change) After a while shutdown and boot another 3B+ with the same sdcard:
Observations: mac address differs, dhcp reject request for same ip on second boot. ipv6 address is stable and remains the same. All as expected. So, something is different. Maybe the raspi hardware revision matter, or maybe something triggers NetworkManager to change the mac. If you stop NetworkManager, does it change the mac back? |
I transfered my sd from a pi3b to a pi3b+ and also have the same issue with the mac address on hassos. |
Your quickest way to fix might be to backup (in hassos), reinstall hassos from scratch on the new pi, which will use the new pi mac address, and then restore the hassos backup. |
Currently doing that now :) 👍 thanks to the great backup/restore functionality, this is the quickest way. |
Long story short, I have a production raspberry pi that got a corrupt SD card. It was running Hassio (resin version) and I saw the advice was to move to the new HassOS. On a spare raspberry pi and a brand new SD card I install HassOS, setup a few things (e.g. downloaded required addons).
My thinking was that I would then swop the SD card into the production machine, it would come back online and I could complete the config.
I set static DHCP via DHCP reservations on my router. My prod box is set to .15 and my test box to .20
My issue is that after swopping the sd card from test to prod, it is now coming up on .15 IP address - i.e. it seems to have taken the mac address of the test machine!?
I might be going crazy, but is this intended behaviour - does some of the docker/resin/buildroot magic take the IP from the initial device and spoof that on any future devices? I understood mac address was tied to a physical device?
At the moment I'm a bit stuck because many things are set to that prod IP, so I don't want to change it, and I still want to use the test pi with the same MAC address!
Edit: Not sure if it is related to release 1.3 which mentions:
The text was updated successfully, but these errors were encountered: