The MAC address changes on every reboot on Raspbian Lite after installing Home Assistant

It has nothing to do with this software.

  1. I completely reinstalled Raspbian using balenaEtcher.
  2. I connected the Raspberry Pi 4 to a TV via HDMI (relevant?!).
  3. I logged in with the username pi and password raspberry.
  4. I ran sudo raspi-config.
  5. I selected 1 Change User Password and set a new password.
  6. I selected 2 Network Options > N1 Hostname and set it to hassio.
  7. I selected 2 Network Options > N2 Wi-fi and I entered my Wi-Fi SSID and password.
  8. I selected 5 Interfacing Options > P2 SSH and enabled it.
  9. I selected Finish and rebooted.
  10. I SSHed into it using ssh [email protected] and entering the password.
  11. I ran ifconfig, which printed
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether dc:a6:32:0d:3e:9a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.111  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::9e53:e5ff:f1bf:c2a  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:0d:3e:9b  txqueuelen 1000  (Ethernet)
        RX packets 1641  bytes 218905 (213.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1134  bytes 106043 (103.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  1. I ran sudo reboot.
  2. I ran ifconfig, which printed the same MAC addresses.
  3. I ran sudo apt-get update.
  4. I ran sudo apt-get install network-manager, as it is mentioned in the official guide, which “stopped” at

Setting up modemmanager (1.10.0-1) …

  1. I ran ssh [email protected].
  2. I ran ifconfig, which printed
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
-        inet 192.168.0.111  netmask 255.255.255.0  broadcast 192.168.0.255
+        inet 192.168.0.108  netmask 255.255.255.0  broadcast 192.168.0.255
-        inet6 fe80::9e53:e5ff:f1bf:c2a  prefixlen 64  scopeid 0x20<link>
+        inet6 fe80::8dc7:e73a:310f:552e  prefixlen 64  scopeid 0x20<link>
-        ether dc:a6:32:0d:3e:9b  txqueuelen 1000  (Ethernet)
+        ether 9e:bd:79:78:5b:b4  txqueuelen 1000  (Ethernet)
-        RX packets 1641  bytes 218905 (213.7 KiB)
+        RX packets 17081  bytes 21368136 (20.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
-        TX packets 1134  bytes 106043 (103.5 KiB)
+        TX packets 7932  bytes 853589 (833.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  1. I ran sudo reboot.
  2. I ran ssh [email protected].
  3. I ran ifconfig, which printed
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
-        inet 192.168.0.108  netmask 255.255.255.0  broadcast 192.168.0.255
+        inet 192.168.0.117  netmask 255.255.255.0  broadcast 192.168.0.255
-        inet6 fe80::8dc7:e73a:310f:552e  prefixlen 64  scopeid 0x20<link>
+        inet6 fe80::2105:7f1:9a1a:147d  prefixlen 64  scopeid 0x20<link>
-        ether 9e:bd:79:78:5b:b4  txqueuelen 1000  (Ethernet)
+        ether aa:17:35:2b:22:c2  txqueuelen 1000  (Ethernet)
-        RX packets 17081  bytes 21368136 (20.3 MiB)
+        RX packets 339  bytes 36629 (35.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
-        TX packets 7932  bytes 853589 (833.5 KiB)
+        TX packets 316  bytes 45023 (43.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  1. I ran sudo systemctl disable ModemManager and sudo apt-get purge modemmanager (again, from the official guide).
  2. I ran ifconfig, which printed the same MAC addresses as the last time.
  3. I ran sudo reboot.
  4. I ran ssh [email protected].
  5. I ran ifconfig, which printed
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
-        inet 192.168.0.117  netmask 255.255.255.0  broadcast 192.168.0.255
+        inet 192.168.0.105  netmask 255.255.255.0  broadcast 192.168.0.255
-        inet6 fe80::2105:7f1:9a1a:147d  prefixlen 64  scopeid 0x20<link>
+        inet6 fe80::c9fd:f715:6019:afbb  prefixlen 64  scopeid 0x20<link>
-        ether aa:17:35:2b:22:c2  txqueuelen 1000  (Ethernet)
+        ether 06:a2:2d:bc:4d:84  txqueuelen 1000  (Ethernet)
-        RX packets 339  bytes 36629 (35.7 KiB)
+        RX packets 244  bytes 32537 (31.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
-        TX packets 316  bytes 45023 (43.9 KiB)
+        TX packets 274  bytes 40498 (39.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

As you can see, after installing network-manager, the MAC address started to change on every reboot. Exactly like I guessed in the very first comment. The difference was that, the first time, I installed all the required packages at once, installed Home Assistant, set it up, and I didn’t know which exact step caused it.

Now, was there something I did wrong?

Installing Home Assistant using the official guide has nothing to do with Home Assistant?

No, because I do want to

be able to control my host network setup over the UI

Maybe you should ask on the raspbian forums, as this has nothing to do with HA.

1 Like

I don’t see anywhere where the MAC address changed or you reserved the MAC address in your router.

Also… why do you want to run a server on WiFi?

1 Like

Screenshot from https://www.home-assistant.io/hassio/installation/#debianubuntu.

Because I don’t have any free ethernet port on my router, so I want to connect to it over the Wi-Fi network.

I’d argue that Home Assistant’s instructions should be updated, and I will gladly create a PR for it. Because, as I demonstrated, I followed them and stumbled upon an issue that is not mentioned at all.

And I don’t mean that Home Assistant’s instructions should have an actual solution for it, if it’s not directly related.

But a simple “If you have problems with a Linux distribution that is not mentioned here, please seek help on their official forum” is clearly missing.

This whole exercise if even without HA started, so it has nothing to do with HA. The best help about it is on the raspbian forums, there are the people with much more knowledge about issues like that.

This whole exercise came directly from https://www.home-assistant.io/hassio/installation/#debianubuntu.

Then, https://www.home-assistant.io/hassio/installation/#debianubuntu should be moved to the Raspbian website.

On that page, I don’t see anything from this exercise.

There is nothing on that page about changing mac-addresses, and it is an issue with network-manager.

Exactly! And that is the issue. That that page isn’t mentioning this issue, caused by installing a package that that page tells you to do.

5 minutes google :

Network-Manager will reset your mac address during the wifi scanning.

To permanently change your mac address:

Edit your /etc/NetworkManager/NetworkManager.conf as follows:

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

[keyfile]

Edit your /etc/network/interfaces by adding the following line:

pre-up ifconfig wlp68s0b1 hw ether xx:xx:xx:yy:yy:yy

The xx:xx:xx:yy:yy:yy is the new mac address obtained from the output of macchanger -A wlp68s0b1

Reboot and verify your settings.

I’m not the only one confused about incomplete documentation:

And guess what, they’re on Home Assistant’s GitHub repos, not on Raspbian forum.

Do you want to create a PR for this?

I added it: https://github.com/home-assistant/home-assistant.io/pull/12342.

1 Like