Integrate custom weston.ini via torizon-core-builder

Hello together,

I am trying to deploy a custom weston.ini via the torizon-core-builder.
My issue is, that I cant find a way that the container has read and write permissions on that file/folder.

I tried this approch: https://community.toradex.com/t/torizoncore-builder-var-lib/19900

But since my docker container is not running as root, it can not read/write the weston.ini
I read somewhere that weston is using dos2unix on the weston.ini so it needs write access.

Putting the weston.ini in home is also not an option as torizon-core-builder refuses to build it:

Traceback (most recent call last):
  File "/builder/torizoncore-builder", line 232, in <module>
    mainargs.func(mainargs)
  File "/builder/tcbuilder/cli/build.py", line 787, in do_build
    build(args.config_fname, args.storage_directory,
  File "/builder/tcbuilder/cli/build.py", line 773, in build
    raise exc
  File "/builder/tcbuilder/cli/build.py", line 758, in build
    handle_output_section(
  File "/builder/tcbuilder/cli/build.py", line 421, in handle_output_section
    union_cli.union(**union_params)
  File "/builder/tcbuilder/cli/union.py", line 225, in union
    commit = ub.union_changes(
  File "/builder/tcbuilder/backend/union.py", line 167, in union_changes
    final_commit = commit_changes(
  File "/builder/tcbuilder/backend/union.py", line 89, in commit_changes
    if not repo.write_dfd_to_mtree(changesdir_fd, ".", mtree):
gi.repository.GLib.GError: g-io-error-quark: Can't replace file with directory: home (0)

I would be thankfull if someone has a working solution.

Thanks and regards,
Marcel

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Deploying Custom weston.ini with TorizonCore Builder

Based on your requirements, there are several approaches to deploy a custom weston.ini file with proper permissions. Let me provide you with the recommended solutions:

Solution 1: Use TorizonCore Builder’s isolate and union commands

The most straightforward approach is to use TorizonCore Builder to modify the system configuration directly (1):

  1. Isolate the current system state:
torizoncore-builder isolate
  1. Modify the weston.ini file in the isolated environment:
    The default weston.ini is located at /etc/xdg/weston/weston.ini (2). You can modify this file in your isolated changes directory.

  2. Apply changes using union:

torizoncore-builder union
  1. Deploy the customized image:
torizoncore-builder deploy <branch-name> --output-directory <output-dir>

Solution 2: Build Command with Configuration File

Use TorizonCore Builder’s build command with a configuration file (1). This approach allows you to specify custom files and their permissions in a structured way:

  1. Create a configuration file that includes your custom weston.ini
  2. Use the build command to create a complete customized image
torizoncore-builder build --file <config-file>

Solution 3: Volume Mounting with Proper Permissions

If you need the container to have write access to weston.ini, you can:

  1. Place your custom weston.ini in /etc/xdg/weston/ using TorizonCore Builder
  2. Ensure proper file permissions are set during the build process
  3. Mount the configuration directory in your Docker Compose file with appropriate permissions

The Weston container runs dos2unix on the weston.ini files during startup (3), which requires write permissions to the file.

Important Considerations

  • File Location: The default weston.ini configuration file is located at /etc/xdg/weston/weston.ini (2)
  • Write Permissions: The Weston entry script does modify the weston.ini file using dos2unix (3), so write permissions are indeed required
  • Container User: Consider the user context under which your Weston container runs and ensure file ownership matches

Avoiding the Home Directory Issue

The error you encountered when trying to place files in the home directory occurs because TorizonCore Builder has specific restrictions on directory replacements (1). The /etc/xdg/weston/ path is the standard location for Weston configuration and should be used instead.

For detailed information about customizing Weston configuration, refer to the comprehensive documentation on working with Weston on Torizon OS (2).

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Greetings @mvo,

We suggest you build a custom Weston container that overrides the weston.ini file as documented here: Working with Weston on Torizon OS | Toradex Developer Center

That way the file lives with the container it’s meant to be used by, and you don’t have to worry about deploying or managing it with TorizonCore Builder.

Best Regards,
Jeremias