0

I have a situation where I'd like to add a static IP address to one of the network devices on an embedded Linux machine, via systemd.networkd.

Normally I'd do that by creating a file like /etc/systemd/network/eno1.network and specifying the IP address (etc) inside that file, but in this case the root partition's filesystem (where /etc/ is located) is read-only, so I can't create a file there.

Is there a way to get systemd to read config files from an additional location (e.g. from /tmp or somewhere else that I could write to), or alternatively to get systemd to add a static IP address without having to first write config info to a file on the root partition?

1
  • Although not really needed in your case, bind mounting on a file is handy.
    – Tom Yan
    Sep 14, 2023 at 5:45

1 Answer 1

1

It turns out there is a simple answer to this: you can place networkd configuration files in /run/systemd/network, which is writeable even on an otherwise read-only filesystem.

2
  • FWIW, it's because /run has another filesystem mounted on it (most likely a tmpfs).
    – Tom Yan
    Sep 14, 2023 at 5:44
  • /run/systemd imust be on writable tmpfs filesystem. which of course does not persist after reboot. Sep 17, 2023 at 21:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .