Issue building and running Containerized TorizonCore Build on MacOS

I am trying to build out some automated deploy scripts and I can’t seem to get the example for the Basic Build Configuration to work.

Currently, I run into a couple of issues:

1. Unable to assign volume due to permissions mismatch

Defining the workdir on macOS doesn’t seem to work, as pointed out in this Stackoverflow post. When executing the following command:

$ docker run --rm -it --name=crops -v ~/yocto-workdir:/workdir --workdir=/workdir -e MACHINE=colibri-imx8x \
    -e IMAGE=torizon-core-docker -e BRANCH=torizon_5.4 torizon/crops:dunfell-5.x.y startup-tdx.sh

you get the following error:

The uid:gid for "/workdir" is "0:0". The uid and gid must be non-zero. Please check to make sure the "volume" or "bind" specified using either "-v" or "--mount" to docker, exists and has a non-zero uid:gid.

If I omit the --workdir, it appears to no longer have permissions issues, as suggested here.

2. Cannot find bitbake

When running the image and accepting the EULA, I immediately see the following error:

/usr/bin/startup-tdx.sh: line 84: bitbake: command not found

It seems like others have posted similar issues, but I wanted to check to see if others within the Toradex community have faced anything similar with the base example, as it seems like I am doing something wrong?

Hi @dhhagan !

Welcome to Toradex Community! :tada:

Please feel free to browse around :smiley:

Can you please check the ownership and permissions of your ~/yocto-workdir? From the error you are getting, seems like this folder is owned by 0:0.

On the other hand, if the folder ~/yocto-workdir doesn’t exist beforehand, it is created with ownership 0:0. This together with the --workdir=/workdir makes the error occur. As you can see from our documentation (Build Torizon OS from Source With Yocto Project/OpenEmbedded | Toradex Developer Center), the section Linux Setup recommends the creation of the yocto-workdir folder beforehand.

So, if this is the case:

  1. Delete de ~/yocto-workdir from your computer (you can check if it is owned by 0:0 before deleting it just as a sanity check :slight_smile: )
  2. Create ~/yocto-workdir before launching the container
    2.1. Just to be sure, check its ownership and permission after creating it :wink:
  3. Try to run the command again.

Please let us know how goes.

If this doesn’t help you, we need to dig deeper. :slight_smile:

Best regards,

Thanks for the info @henrique.tx - I’ve tried those items to no avail. It seems like the way in which Docker for Mac mounts volumes is one of, if not the primary, issue. While I’m currently using gRPC FUSE for file sharing as opposed to osxfx, it seems like the issue is quite similar as written about here.

Has anyone gotten this to work using MacOS (Monterey in this case)? I tried manually specifying the uid:gid but that also didn’t seem to help much.

Has anyone gotten this to work using MacOS (Monterey in this case)? I tried manually specifying the uid:gid but that also didn’t seem to help much.

Unfortunately, I don’t know any of our customers who have used our containerized crops build on MacOS. Also none of our core developers in Toradex develop on MacOS either to be honest.

While it’s far from an ideal solution, would a Linux VM of some kind be an option?

Best Regards,
Jeremias

Not really. The goal was to develop this locally and then build out a GitHub action so that builds are triggered on any merged PR, but it looks like I may need to just skip the first step and try it all remotely.

Have you tried creating a volume and using Samba as detailed in the instructions for MacOS here: Home · crops/docker-win-mac-docs Wiki · GitHub

In the Github issue you linked previously I see Samba is also recommend.

Best Regards,
Jeremias

I just did, and that does seem to fix the volumes issue; however, I still run into the following:

... A new version of repo (2.36) is available.
... New version is available at: /workdir/torizon/.repo/repo/repo
... The launcher is run from: /bin/repo
!!! The launcher is not writable.  Please talk to your sysadmin or distro
!!! to get an update installed.

fatal: error parsing manifest /workdir/torizon/.repo/manifest.xml: [Errno 2] No such file or directory: '/workdir/torizon/.repo/manifest.xml'
/usr/bin/startup-tdx.sh: line 53: setup-environment: No such file or directory
grep: /workdir/torizon/build-torizon*/conf/local.conf: No such file or directory
You have to accept freescale EULA. Read it carefully and then accept it.
Press "space" to scroll down and "q" to exit
/workdir/torizon/layers/meta-freescale/EULA: No such file or directory
Do you accept the EULA? [y/n] y
EULA accepted
/usr/bin/startup-tdx.sh: line 69: /workdir/torizon/build-torizon*/conf/local.conf: No such file or directory
Build environment configured. Building target image torizon-core-docker
> DISTRO= MACHINE=colibri-imx8x bitbake torizon-core-docker
/usr/bin/startup-tdx.sh: line 84: bitbake: command not found

I think I see what the issue now. In your docker run command you shared in your initial message, you specify -e BRANCH=torizon_5.4. This is not a valid branch as seen here: Build TorizonCore from Source With Yocto Project/OpenEmbedded | Toradex Developer Center

This causes the whole setup to fail, therefore bitbake can’t be found because nothing got setup properly.

I was able to reproduce this error on my Linux machine using this non-existent branch you specified. Therefore this part has nothing to do with MacOS. Please specify a valid branch name, or none at all and the setup will default to the dunfell branch.

Best Regards,
Jeremias