Macaddr0 - dragonboard

how to get the sources of the snap find applications(eg: hello/hello-word). i am running snap in arm64. i tried to build the hello word in host machine for arm64 (

ERROR: command ‘[’/bin/sh’, ‘/tmp/tmpon0i6aeh’, ‘./configure’, ‘–prefix=’, ‘–host=arm64’]’ returned non-zero exit status 1

vinaysimha@localhost:~$ snap find hello
Name Version Developer Notes Summary
hello-world 6.3 canonical - The ‘hello-world’ of snaps
hello-takaakisuzuki-aarch 2.12 takaakisuzuki - GNU Hello, the “hello world” snap
hello-securx-snap 1.0 securx - Single-line elevator pitch for your amazing snap
hello 2.10 canonical - GNU Hello, the “hello world” snap

i want to change the macaddr0 for wifi,
echo “aa:bb:cc:dd:ee:ff” > /run/macaddr0

but it says
-bash: /run/macaddr0: Permission denied

so i guess i need to write a snap and modify the macaddr0 content.


Are you on a dragonboard ? (this is to my knowledge the only device using /run/macaddr0) …
the mac address is generated from the board serial in the initrd during boot …

You will not be able to change it as normal user, you need to use sudo and tee like:

ogra@dragonboard:~$ cat /run/macaddr0 
ogra@dragonboard:~$ echo "aa:bb:cc:dd:ee:ff" | sudo tee /run/macaddr0 
ogra@dragonboard:~$ cat /run/macaddr0

Note though that you would also have to restart wlan0 to make this take effect, the driver wont auto-update it if you change the file …

yes, trying in dragonboard.

/run/macaddr0 will not created after installing to emmc (run reflash_ubuntu).

i am not able to create the file after booting the board , it says permission error.

there is definitely no technical reason for this (the same code runs in both cases)

what kernel snap to you have installed, what is the output of:

snap info dragonboard-kernel

even when using the command i gave you above ?

ogra@dragonboard:~$ echo “aa:bb:cc:dd:ee:ff” | sudo tee /run/macaddr0
ogra@dragonboard:~$ cat /run/macaddr0

This works, but after reboot the file /run/macaddr0 will not be present.

[ 18.221508] wcn36xx wcn36xx: Failed (-2) to read macaddressfile wlan/macaddr0, using a random address instead

vinaysimha@localhost:/lib/firmware/wlan$ snap info dragonboard-kernel
name: dragonboard-kernel
summary: “The canonical snapdragon arm64 kernel”
publisher: canonical
description: |
The Ubuntu linux-snapdragon kernel package as a snap
type: kernel
snap-id: S5YcBgAc95C45FDK7w67T5yROH5c2jdA
stable: 4.4.0-1063.68 (27) 123MB -
candidate: (35) 124MB -
beta: (35) 124MB -
edge: (35) 124MB -

This does not look like you have the dragonboard-kernel snap even installed (else there would be “installed:”, “tracking:” and “refreshed:” in this output) … what is the output of:

snap list

Did you use your own kernel snap to create this image ?

vinaysimha@localhost:~$ snap list
Name Version Rev Developer Notes
checkbox-snappy 2.2 860 ce-certification-qa -
core 16-2.27.6 2847 canonical core
hello 2.10 23 canonical -
ifc6309-gadget 16.04-0.18 x1 gadget
ifc6309-kernel 4.4.0-1075.80 x1 kernel

this is the latest git log of the kernel i had built

commit eade5b7ec26476c236f01822ce7c852fae0788b4
Author: Kleber Sacilotto de Souza
Date: Fri Sep 8 10:38:09 2017 +0200

UBUNTU: Ubuntu-snapdragon-4.4.0-1075.80

Signed-off-by: Kleber Sacilotto de Souza <>

i tried with sdcard boot also, even in this case it does update the file locally /run/macaddr0, but after reboot it changes to default.

well, you clearly ended up with a broken initrd there … i’d suggest to try to re-builld your kernel snap in the hope it pulls in the right initrd.img with the script that creates the /run/macaddr0 file … (there might be other, less visible stuff missing)

i will rebuild and check again.

is it possible to avoid “fetching ubuntu core” every time i build the .img using ubuntu-image ?

this script might be overriding the reboot of storing macaddr0 of wlan,

The scripts in:

…are actually the ones that create a binary initrd.img which gets shipped as part of the core snap (this building needs to happen in context of the rootfs build to get the right binary libs and versions of the initramfs-tools scripts etc so we can only reliably do it during core snap creation (which later becomes your rootfs on the image)).

When you build your kernel snap it downloads the latest core snap to pull the binary initrd.img out of it and to re-pack it with the initrd-modules you defined in your snapcraft.yaml

I am curently actively working on a mechanism to avoid exactly this step. In the near future you will only have a modules.img in the kernel snap created from your kernel build and not need this download step anymore … (the initrd will be merged on the fly in ram by the bootloader and the generic initrd.img half will be pulled diectly from the installed core snap).

This is still a bit away though, for the moment you have to live with the download step.

how does this cmdline param androidboot.serialno=f2103d95 get updated?

when i boot the board
[220] [220] target_display_panel_node:510: hw_id=24 panel_name=""
[220] [220] cmdline: androidboot.emmc=true androidboot.serialno=f2103d95 androidboot.baseband=apq mdss_mdp.panel=0:dsi:0:

i had updated the .serial no and saveenv , it had stored in persistent storage,
dragonboard410c => printenv args
args=androidboot.emmc=true androidboot.serialno=f2103d98 androidboot.baseband=apq mdss_mdp.panel=0:dsi:0

But still after rebooting the board, the mac address shows
vinaysimha@localhost:~$ ifconfig -a | grep wlan0
wlan0 Link encap:Ethernet HWaddr 02:00:f2:10:3d:95

it should be 02:00:f2:10:3d:98. Did the booting process is different, it is not picking the cmdline from presistent storage of env.

please suggest.

It is read from the ROM by the bootloader (like normally MAC addresses are read from a readonly source in the hardware as well, since they have to be a uniqe number and identify model and vendor (the /run/macaddr0 thing is actually a workaround that upstream created for a brokeness in the driver that does not read the MAC from the cards ROM))