I'm trying to symlink file /etc/systemd/network/00-default.link to /boot/00-default.link. This allows me to force a change to my MAC address from the boot directory, which is the only directory accessible from my Mac computer when I plug in the SD card.

However, when I use the command:

sudo ln -s /etc/systemd/network/00-default.link /boot/00-default.link

I receive the error:

ln: failed to create symbolic link '/boot/00-default.link': Operation not permitted

Any idea what might be causing this?

Note: I've created /etc/systemd/network/00-default.link already but I have not yet created /boot/00-default.link

up vote 2 down vote accepted

From your earlier questions, I know why you want to do this from boot, and symlinking /boot/00-default.link to /etc/systemd/network/00-default.link doesn't help, because /etc/systemd/network/00-default.link seems to be processed before /boot is mounted - therefore /etc/systemd/network/00-default.link is a broken link at the time it is being processed

I don't know if this is fact, but I know that linking that way also doesn't help, so I am assuming it to be fact :p

Here's a solution I came up with :p

Create a service in /etc/systemd/system - lets call it macoverride.service

Description=Copy user mac_override.link

ExecStart=/bin/mv /boot/mac_override.link /etc/systemd/network/00-default.link


note about After=local-fs.target - I played around with this a bit, there may be an earlier target you can use, or use Before= - but this one works

Now, enable it

sudo systemctl enable /etc/systemd/system/macoverride.service

What this service does is

  1. if /boot/mac_override.link exists - move it to /etc/systemd/network/00-default.link
  2. reboot

Now, since step 1 moves the file, it won't exist after the reboot - so there's no chance of a reboot loop :p

Here's a more generic solution, by generic, I mean you'll be able to change what the file on the boot partition can do

Create a file for example, /etc/systemd/system/ssmatt.service

Description=Super special Matt code (change this to suit :p)

ExecStart=/bin/sh /boot/matt.sh



systemctl enable ssmatt.service
systemctl start ssmatt.service

Now, create a matt.sh file in the boot partition

ifconfig eth0 down
ifconfig eth0 hw ether 10:00:00:00:00:11
ifconfig eth0 up

again After=basic.target is just the earliest target I found where this code was reliable for changing MAC

Using this method, the one downside is that matt.sh must exist in boot partition for the MAC to be changed, however the up side is that you can use matt.sh to do more than just changing the MAC

  • 1
    The OP might want to consider accepting this answer as it addresses the "implicit" issue of the question far better than mine ;) Your approach reminds me of what Raspbian is doing with the wpa_supplicant.conf file that is magically transferred from /boot to the correct spot somewhere in /etc. – Ghanima Oct 16 at 1:03
  • @Ghanima - your answer actually answers the question though, so more useful for "future readers" - I've helped the OP in two other questions, so I kinda know the overall picture of what he's trying to achieve - as such, while this answer does provide a possible solution (there are others) this doesn't really answer the question, and so, not really helpful to anyone but Matt :p – Jaromanda X Oct 16 at 1:13
  • This is beautiful. Can't thank you enough again @JaromandaX. Spot on as always. Cheers – Matt Oct 16 at 5:26
  • Which do you think you'll use? the mac override or the "super special" :p – Jaromanda X Oct 16 at 5:27
  • @Ghanima agreed, although your answer more directly addressed my question, this answer provides a solution to address the underlying issue. To any future readers take a look at Ghanima's answer to see why this issue is occurring. – Matt Oct 16 at 5:41

/boot is a FAT filesystem that unfortunately does not support symbolic links.

So this cannot work

sudo ln -s /etc/systemd/network/00-default.link /boot/00-default.link

Turning it around and placing the file itself (source) on /boot and the link (target) on /etc however should do

sudo ln -s /boot/00-default.link /etc/systemd/network/00-default.link

This would however lack unixoid access permissions for the file - if that is an issue.

  • Interesting. I've noticed that if I move the file into /boot/ then symlink that file into somewhere else it works fine though, how is it able to work in one direction and not the other though? – Matt Oct 15 at 21:21
  • Follow up question - since /boot/ requires a hard copy of the file and /etc/systemd/network/ also requires a hard copy to change the MAC address, would it be possible to use an intermediary third symlinked file as a bridge between the two hard files (meaning I could edit hard file /boot/00-default.link, which would edit the symlink /home/Pi/Desktop/bridge.link which in turn would edit hard copy of /etc/systemd/00-default.link)? Hopefully that made sense – Matt Oct 15 at 21:25
  • 1
    w.r.t. the first comment, so you have a link from a unixoid FS to the vfat partition? That's just fine. – Ghanima Oct 15 at 21:26
  • correct, I have a hard file /boot/my_script.py with symlink /home/Pi/Desktop/my_symlinked_script.py – Matt Oct 15 at 21:27
  • Thanks for adding that edit @Ghaninma, that clarified a lot. I believe in this case the lack of unixoid access permissions is causing an issue for whatever reason. Can you think of any way to get around that while still linking the file to /boot/ – Matt Oct 15 at 21:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.