Hi, there are a few ways to do that. The easiest way is after flashing the image, you may drop a connection profile file to the boot partition’s system-connections directly from your Windows machine. Here is a sample file contents: https://docs.resin.io/reference/OS/network/2.x/#setting-a-static-ip
The easiest way is after flashing the image, you may drop a connection profile file to the boot partition’s system-connections directly from your Windows machine.
I would like to do that, but I cannot, because the filesystem is mounted as Read-only.
Is it safe to temporarily remount as rw? (mount / -o remount,rw)
What I meant is that after flashing the SD card with Etcher, you may access the boot partition from your laptop directly and add the file there - that is before ejecting the SD card from your Windows laptop and before plugging it into the device.
Alternatively like you suggest you may remount temporary the partition in rw mode from the host OS of the device. It is safe to do that.
EDIT: The previous paragraph is not the recommended approach. The /etc/NetworkManager/system-connections folder is already in RW mode and bind mounted to the state partition and serves exactly this purpose
Initially, I edited the connection file directly in /resin-boot/system-connections/ after remounting it as rw. The file I created (resin-static, see above) persisted after a reboot.
I then noticed that /mnt/boot/system-connections/ has different content. I copied my resin-static connection file to /mnt/boot/system-connections/ and now it works.
Actually I misled you on this one… There is another location that is of interest and is already in rw mode. You may add the file directly to /etc/NetworkManager/system-connections which is bind mounted to a folder on the state partition. The state partition is in rw mode and changes should be made preferably there.
That was easy
I got this to work by logging in remotely and creating a /etc/NetworkManager/system-connections/eth1-static connections file to configure the second network interface on our device.
This makes the file appear in /mnt/state/root-overlay/etc/NetworkManager/system-connections, but not in resin-boot/system-connections, as expected.
Am I understanding this correctly, that once this file exists, it is guaranteed to persist across reboots (already tested that), application upgrades, OS upgrades etc?
Hi @dirk, glad you got it working. Yes the files in /mnt/state/root-overlay are the read/write persistent configuration state for a device and should persist between reboots and OS upgrades.
Is there a way to manipulate the /etc/NetworkManager/system-connections directory through the supervisor API? We use dbus and NetworkManager commands today, but would prefer to avoid the Python-based command-line approach.
Is there a way to manipulate the /etc/NetworkManager/system-connections directory through the supervisor API? We use dbus and NetworkManager commands today, but would prefer to avoid the Python-based command-line approach.
I don’t think the supervisor API can be used for that, however it’s possible to use NetworkManager’s DBUS interface with programming languages other than Python. This site provides some pointers and examples: Projects/NetworkManager/Developers - GNOME Wiki!
I meant that other programming languages, like C, Javascript, Ruby and others, can be used to interact with NetworkManager via the DBUS interface, instead of using Python and instead of running command-line tools in child processes. The network-config library may not be a good solution because it seems to be built on ifconfig, and NetworkManager might end up overwriting or conflicting with changes made via ifconfig. If your app uses Javascript / Node, perhaps a library like the following might work better: https://github.com/JumpLink/node-networkmanager although I have not tested it myself.