Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration on unattained embedded devices #7217

Closed
emilm opened this issue Feb 15, 2024 · 4 comments
Closed

Configuration on unattained embedded devices #7217

emilm opened this issue Feb 15, 2024 · 4 comments
Assignees

Comments

@emilm
Copy link

emilm commented Feb 15, 2024

This is not really a bug or anything but comments on the configuration system.

On embedded devices you have things that are different: host names, and device IDs.
Now, the hostname is in the OS through utilities or a file. You can run "hostname" and get the hostname, and strip the \n to get the string.
The serial number is usually embedded in EEPROM or on disk.
The Scope ID is fine, since it's static across the fleet.

The problem is that you can't expect people to log into each device and do config apply every single time, so therefore you must create a bunch of scripts producing the final result with replaced hostname and serial number.
The second problem is that embedded devices have images with read-only file systems. So you can't just apply the configuration.
Then you need to direct the configuration to a writable partition.

Seriously engineered embedded devices have predictable OS images and are not modifiable.

So how I solved this was to look at how the files looked like after applying config, scattered across the different services.
Then I needed to replace hostname + serial number in the appropiate places.
(By the way, you have hostname in both aziot-edged and aziot-identityd by the way. Shouldn't there only be one place this is?)
Next, my template config files are "patched" and put on a writable location.
But iot edge has to know where these files are, so I had to dig in the source code to see if there were any env vars that could change it, and luckily they were. So I had to modify the systemd service as well with vars like AZIOT_EDGED_CONFIG_DIR.

Now, this works, but iotedge check does not pick up these locations. So at the very least (I now it's a bit late to change the configuration system now) it should ask the main service what those locations are to do the check correctly. I know they are correct since it works but I assume the check just checks the default paths. I know you can use overlayfs and point the conf.d directories to the writable partition. But it's still a hack.

My main point is that dynamic things like registration ID and host name should have an option to be automatically be resolved, or extend the configuration to accept a reference to a bash script to resolve them. That way the configuration files can be static in one place.

Just a suggestion!

@konichi3
Copy link

konichi3 commented Mar 5, 2024

Thanks @emilm for the feedback. We are tracking the feature requests in this forum rather than in the GitHub. Can you please create a new post in this forum for feature requests for IoT Edge?

https://feedback.azure.com/d365community/forum/0e2fff5d-f524-ec11-b6e6-000d3a4f0da0

@emilm
Copy link
Author

emilm commented Mar 5, 2024

Thanks, done.

@konichi3
Copy link

konichi3 commented Mar 7, 2024

Great. Thanks for logging.

@konichi3
Copy link

Closing this GH and tracking in a separate forum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants