Systemd service

I try to add some service in build chain of ClipOs :

  • I add some specific user for my service by adding in product/clipos/core/configure.d/ :
m audit systemd-myservice
  • I add bash file in /product/configure.d to configure my service

But when i build clip, i received this error and i can’t fix it :

[#] Command 'runc run --bundle /home/clipos/run/containers/clipos-sdk.configure.clipos-core.bj_90t8b clipos-sdk.configure.clipos-core.bj_90t8b' failed.

Did i do something wrong to add my servcice ?

If you want to create a new user, you need to use the ‘u’ type in the sysusers configurations (see sysusers.d(5)).

Can you run the configure build step in debug mode and post the output somewhere (do not copy it inline here in full, use a pastebin like service):

(toolkit) $ cosmk --debug configure clipos/core

Thank you for the answer.
I add the end of the command result on :

standard_init_linux.go:211: exec user process caused "exec format error"

This means that your clipos/core/configure.d/ script is invalid. Probably missing execute permission or bash shebang. Can you paste it somewhere?

My bash file have the same permission as :
-rwxr-xr-x 1536 juin 18 17:08
-rwxr-xr-x 713 juin 21 15:21
And I use the same command than :

In the file you’ve pasted, there are spaces before the bash shebang. With the whitespace removed, the script runs on my system.

mkdir "${CURRENT_OUT_ROOT}/etc/systemd/service/"
install -o 0 -g 0 -m 0755 -d "${CURRENT_OUT_ROOT}/etc/systemd/service/service.conf"
ln -sf "/src/portage/gentoo/sys-apps/systemd/files/service/default.conf" "${CURRENT_OUT_ROOT}/etc/systemd/service/service.conf"

Service specific configuration should probably go into a separated folder in /etc, not in /etc/systemd. You can not use symbolic links to files from the portage tree as those files won’t be available in the final image. You have to install them with an ebuild.

install -o 0 -g 0 -m 0755 -d "${CURRENT_OUT_ROOT}/lib64/systemd/system-service"
ln -sf "/service/service" "${CURRENT_OUT_ROOT}/lib64/systemd/system-service"

Same here: /service/service will not be available in the final image.