Debian: MAC address keeps changing on every reboot
#1
My router DHCP server is unable to assign a fixed IP address to Rock 64 running ayufan's Debian Jessie because the MAC address keeps changing after every reboot. 

In the file /etc/network/interfaces.d/eth0 , I tried to add a line "hwaddress ether 00:11:22:33:44:55"  after "iface eth0 inet dhcp" line, rebooted the Rock, but it has no effect.

I really need this fixed IP address assignment using the router DHCP to do port forwarding, etc. can any kind soul please help me?

Thanks in advance

Update: Using "dmesg | tail" command, I found some errors. It looks like something is broken here.

[   16.107739] systemd-journald[284]: Received request to flush runtime journal from PID 1
[   16.677610] rk_gmac-dwmac ff540000.eth: rk_get_eth_addr: rk_vendor_read eth mac address failed (6)
[   16.684179] rk_gmac-dwmac ff540000.eth: rk_get_eth_addr: generate random eth mac address: 46:dc:5a:a0:be:8a
[   17.087857] rk_gmac-dwmac ff540000.eth: rk_get_eth_addr: mac address: 46:dc:5a:a0:be:8a
[   17.092156] eth0: device MAC address 46:dc:5a:a0:be:8a
[   19.975103] rk_gmac-dwmac ff550000.eth: rk_get_eth_addr: mac address: 46:dc:5a:a0:be:8a
[   19.987574] eth1: device MAC address 46:dc:5a:a0:be:8a
[   21.159028] rk_gmac-dwmac ff540000.eth eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   24.618565] tty_port_close_start: tty->count = 1 port count = 2.
  Reply
#2
You can try a script in /etc/network/if-pre-up.d that changes the mac via ip link set ...
  Reply
#3
(08-19-2017, 01:04 PM)dlu Wrote: You can try a script in /etc/network/if-pre-up.d that changes the mac via ip link set ...

Thanks but it doesn't help. Google search on this topic brought up several past threads about this similar issue with Pine A64 as well. Fortunately, the workaround was found by hardcoding the MAC address on /boot/uEnv.txt but this only applies to Pine A64. Rock 64 doesn't have this file.
  Reply
#4
Clear SPI flash. Run `dd if=/dev/zero of=/dev/mtd3` and restart. From now on address should be persisted.
Homepage: https://ayufan.eu

Releases:
Rock/Pro 64/Pinebook Pro: LinuxChromium OS
So/Pine A64/Pinebook: LinuxAndroid 6.0Android 7.1

Buy me a Beer
  Reply
#5
Just for grins and other computer science reasons, you might want to backup the original spi_flash bytes before you wipe it out !

mkdir  spi_flash

cd spi_flash

sudo  dd  if=/dev/mtd3  of=spi_flash.org

That should create a file called  spi_flash.org  size 262144;   


Shy

I wanted to compare the SPI flash from the pre production boards vs the production boards.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#6
(08-19-2017, 07:45 PM)ayufan Wrote: Clear SPI flash. Run `dd if=/dev/zero of=/dev/mtd3` and restart. From now on address should be persisted.

Yes, it works!!! It took two reboots for it to take effect after running `dd if=/dev/zero of=/dev/mtd3` Thanks ayufan. You are the best!  Smile
  Reply
#7
btw,  there is no difference between the pre production boards and the production boards ;  SPI flash defaults to the same hexdump  FFFF FFFF FFFF FFFF FFFF FFFF FFFF ...

So, wiping the SPI flash from /dev/null  fills it with zeros rather than 1's ...

Dodgy
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#8
Here is my hexdump now after clearing the SPI

rock64@rock64:~$ sudo dd if=/dev/mtd3 of=spi_flash.hex
512+0 records in
512+0 records out
262144 bytes (262 kB) copied, 0.106056 s, 2.5 MB/s
rock64@rock64:~$ hexdump -c spi_flash.hex
0000000 D V K R 002 \0 \0 \0 001 \0 001 \0 @ \0 � �
0000010 003 \0 \0 \0 006\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
0000400 202 c � e � � \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000410 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
000fff0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 002 \0 \0 \0
0010000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
0040000
  Reply
#9
Yes zeroing out this memory worked. The stable MAC address appears at 0x400-0x405 from what I can see here.
  Reply
#10
Can someone explain the solution please?

- If the mac address resides in the "SPI flash", then 00:...:00 and FF:...:FF are both invalid addresses. Which software part corrected the zeroes, and why didn't it correct the FFs?
- Where does the new value for the stable mac address come from? Is it the same code path as seen in rontants loglines (random_ether_addr in rk_get_eth_addr)? Or somewhere else?
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to update/compile Debian 12.5? Wizardknight 2 208 03-14-2024, 05:30 AM
Last Post: diederik
  Rock64 Debian 11 (Bullseye) install problem jbize 15 7,960 10-12-2023, 05:14 PM
Last Post: tpaul
  rock64-debian-mrfixit-190531.img.xz : missing /usr/lib/dri/rockchip_dri.so popi 5 5,118 08-12-2021, 04:55 AM
Last Post: igorp
  Debian build from mrfixit2001 Luke 18 26,582 05-17-2021, 02:35 AM
Last Post: Wizzard
  Debian kernel stuck at 4.4.167 Enig123 5 5,481 12-29-2020, 12:57 PM
Last Post: kwinz
  Debian (Vanilla) on Rock64 and eMMC - how ? as365n4 4 5,139 09-21-2020, 04:33 AM
Last Post: as365n4
  pcsx rearmed on rock64 debian stretch does not go fullscreen RockyBoulder 2 4,147 05-09-2020, 03:15 AM
Last Post: lawrencejd
  Fedora 31 crosscompilation fdt problem mimics debian 888789 kf5zmi 2 4,076 01-20-2020, 12:25 PM
Last Post: kf5zmi
  Upgrading Debian Stretch image to Buster cosuhi 2 4,651 08-27-2019, 02:42 AM
Last Post: Malmgren
  Ayufan Debian Stretch Openmediavault 4 5G Wifi Not Connecting Poincare 0 2,230 03-26-2019, 07:28 PM
Last Post: Poincare

Forum Jump:


Users browsing this thread: 1 Guest(s)