{"id":17336842,"url":"https://github.com/chris2511/meta-s6-rc","last_synced_at":"2026-01-06T06:48:15.560Z","repository":{"id":137476048,"uuid":"388253201","full_name":"chris2511/meta-s6-rc","owner":"chris2511","description":"Yocto layer adding support for the s6 init system and s6rc","archived":false,"fork":false,"pushed_at":"2024-06-11T18:49:20.000Z","size":116,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"mickledore","last_synced_at":"2025-02-01T12:31:15.049Z","etag":null,"topics":["init","s6","s6-rc","yocto-layer"],"latest_commit_sha":null,"homepage":"","language":"BitBake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chris2511.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-21T21:45:04.000Z","updated_at":"2024-11-20T18:29:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c16b54b-560a-4483-a6e7-25ad9dde8540","html_url":"https://github.com/chris2511/meta-s6-rc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2511%2Fmeta-s6-rc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2511%2Fmeta-s6-rc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2511%2Fmeta-s6-rc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2511%2Fmeta-s6-rc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chris2511","download_url":"https://codeload.github.com/chris2511/meta-s6-rc/tar.gz/refs/heads/mickledore","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245800644,"owners_count":20674336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["init","s6","s6-rc","yocto-layer"],"created_at":"2024-10-15T15:32:41.575Z","updated_at":"2026-01-06T06:48:15.553Z","avatar_url":"https://github.com/chris2511.png","language":"BitBake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# S6-RC: An alternative to SysV and Systemd\n\nThis layer introduces [s6-rc](https://skarnet.org/software/s6-rc) as init system.\n\n## Quickstart\n\n```sh\ngit clone git://git.yoctoproject.org/poky\n(cd poky \u0026\u0026 git checkout -b kirkstone origin/kirkstone)\ngit clone https://github.com/chris2511/meta-s6-rc.git\n. poky/oe-init-build-env\nbitbake-layers add-layer ../meta-s6-rc\nTCLIBC = \"musl\" INIT_MANAGER = \"s6\" bitbake core-image-minimal\nrunqemu serialstdio nographic kvm\n```\n\nOr as usual put them into your conf/local.conf:\n```\nTCLIBC = \"musl\"\nINIT_MANAGER = \"s6\"\n```\n\n## Documentation\n\nThe S6 system itself is thoroughly documented by its author.\n\nThis layer adds the `s6rc.bbclass`, which allows to easily\ncreate new services with dependencies. It populates the\n`/etc/s6-rc/tree` directory with services declared by the following\nvariables:\n - S6RC\\_BUNDLES, S6RC\\_BUNDLE\\_% and S6RC\\_BUNDLE\\_%[ ]\n - S6RC\\_ONESHOTS and S6RC\\_ONESHOT\\_%[ ]\n - S6RC\\_LONGRUNS and S6RC\\_LONGRUN\\_%[ ] S6RC\\_LONGRUN\\_%\\_log[ ]\n - S6RC\\_INITD\\_SYMLINKS\n\n`s6-init.bb` shows how to use them in practice.\nPlease read/know about the concepts documented in\n[s6-rc-compile](https://skarnet.org/software/s6-rc/s6-rc-compile.html)\n\nThe S6RC\\_INITD\\_SYMLINKS variable declares a space separated\nlist of service names that will be put as symlinks to `s6-startstop`\nto `/etc/init.d/`. This enables SysV/Systemd feeling by providing:\n`/etc/init.d/\u003cservice\u003e [start|stop|restart|enable|disable|status|pid|\ncrashes|logs|logf]`\n\nThe S6RC\\_DEBUG\\_BOOT variable set to anything != \"\" allows to debug\nthe boot sequence by setting the option `-1` when calling\n`s6-linux-init-maker`\n\n### Bundles\n\n`S6RC_BUNDLES` contains a space separated list of bundle-names.\nEach `S6RC_BUNDLE_%` with % replaced by a bundle name contains a space separated\nlist of services and bundles that will be written to the\n`contents` file of the bundle.\n\nExample:\n```\nS6RC_BUNDLES = \"bundleA bundleB\"\nS6RC_BUNDLE_bundleA = \"service1 service2\"\nS6RC_BUNDLE_bundleB = \"svcx svcy bundleA\"\n```\nwill result in\n```\n/etc/s6-rc/tree/bundleA/type (which contains 'bundle')\n/etc/s6-rc/tree/bundleA/contents (which contains 'service1\\nservice2')\n/etc/s6-rc/tree/bundleB/type (which contains 'bundle')\n/etc/s6-rc/tree/bundleB/contents (which contains 'svx\\nsvy\\nbundleA')\n```\n\nAdding bundles, oneshots and longruns to bundles defined in other recipes,\nfor example the `default` bundle, can be achieved by the\n`S6RC_[LONGRUN|ONESHOT|BUNDLE]_\u003cname\u003e[bundles]` variable.\nAdding the longrun `dropbear` to the `default` and `network` bundle\nis done by\n```\nS6RC_LONGRUN_dropbear[bundles] = \"default networking\"\n```\nNon-existing bundles will be created on-the-fly.\n\n### Atomic services\n\nAll regular files recognized by s6-rc-compile can either be directly\nadded as `S6RC_ONESHOT_runner-a[dependencies] = \"runner-b bundle-x\"`\nor provided as `\u003cservice-name\u003e.\u003cproperty\u003e` file.\nIn this example a `runner-a.dependencies` will be used as runner-a/dependencies file verbatim.\nThis is especially useful for `up` and `run` files, which may become lengthy\nand cumbersome to write in one line.\n\nAll atomic services may additionally contain the special file `influences`\nwhich is the inverse of `dependencies`:\nAll atomics listed in `influences` of an other atomic\nwill depend on the other atomic.\n\n### Oneshots\n\n`S6RC_ONESHOTS` contains a space separated list of oneshot-names.\n`S6RC_ONESHOT_%[ ]` declares properties with % replaced by a oneshot-name\n\nProperties for oneshots are those documented in the [s6-rc-compile](https://skarnet.org/software/s6-rc/s6-rc-compile.html):\n\nExample:\n```\nS6RC_ONESHOTS = \"start mount-procsysdev networking\"\nS6RC_ONESHOT_start[up] = 'echo \"init-stage2 starting.\"'\nS6RC_ONESHOT_mount-procsysdev[dependencies] = \"start\"\n```\nwill result in\n```\n/etc/s6-rc/tree/start/type (which contains 'oneshot')\n/etc/s6-rc/tree/start/up (which contains 'echo \"init-stage2 starting.\"')\n/etc/s6-rc/tree/mount-procsysdev/type (which contains 'oneshot')\n/etc/s6-rc/tree/mount-procsysdev/dependencies (which contains 'start')\n```\nAn existing file `${S}/mount-procsysdev.up` will be copied verbatim to\n`/etc/s6-rc/tree/mount-procsysdev/up`\n\n### Longruns\n\n`S6RC_LONGRUNS` contains a space separated list of longrun-names.\n`S6RC_LONGRUN_%[ ]` declares properties with % replaced by a longrun-name\n\nThe functionality and behavior is analog to the oneshots, just with the\nlongrun properties.\nThe `producer-for` and `consumer-for` entries don't have to appear pairwise.\nThe s6rc class will resolve missing entries as it does with the `influences`\nentry as the reverse of `depends`.\nThis allows to declare dependencies unidirectional if depending services are\ndeclared in different layers.\n\n#### Filedescriptor storage\n\nLongruns may have an additional verb `filedescriptors`, which is an execline\nscript, creating filedescriptors via `piperw` or `s6-tcpserver-socketbinder`\nand storing them in the new fd-holder service called `fdstore`. It canm be\ndone as usual as inline declaration or by a `\u003clongrun\u003e.filedescriptors`\nfile with `s6-fdholder-store /service/fdstore/s [socket|write|read]:\u003cname\u003e`.\n\nThe all-in-one logger of templates also uses this mechanism.\n\nThe oneshot `fdstore-fill` executes all `filedescriptors` scripts.\nLongruns using this mechanisms must depend on the `fdstorage` bundle\nto be sure the descriptors are ready. This is automatically done by the\n`s6rc.bbclass`\n\n#### Logging\n\nA log service will always be setup, unless `S6RC_LONGRUN_%[no-log]`\nexists. `S6RC_LONGRUN_%_log[]` properties are evaluated\nwith the following property files:\n - name: `\u003clongrun-name\u003e-log`\n - notification-fd: 3\n - consumer-for: `\u003clongrun-name\u003e`\n - dependencies: mount-temp\n - run: `umask {umask} s6-setuidgid {user} s6-log -d3 {script} {dir}`\n   with {...} replaced by overrideable defaults:\n   - umask: 0037\n   - user: logger\n   - script: `T s100000 n10`\n   - dir: `/var/log/\u003clongrun-name\u003e`\n\nAll properties can be overwritten (and not extended) by an explicit\nvalue. For example: `S6RC_LONGRUN_%_log[dependencies] = \"mount-temp other\"`\n\nExample:\n```\nS6RC_LONGRUNS = \"getty syslogd\"\nS6RC_LONGRUN_getty[run] = \"fdmove -c 2 1 /sbin/getty -L 0 console 2\u003e\u00261\"\nS6RC_LONGRUN_getty[dependencies] = \"mount-procsysdev hostname\"\nS6RC_LONGRUN_getty[down-signal] = \"9\"\nS6RC_LONGRUN_syslogd[dependencies] = \"mount-procsysdev\"\nS6RC_LONGRUN_syslogd[notification-fd] = \"3\"\nS6RC_LONGRUN_syslogd_log[user] = \"logger\"\n```\nThe `syslogd/run` file is expected to be found in \"${S}/syslogd.run\"\n\n### Templates\n\n`S6RC_TEMPLATES` contains a space separated list of templates that\ncan be instantiated by the [*rc-dynamic*](#rc-dynamic) command.\n`S6RC_TEMPLATE_%[ ]` declares service properties with % replaced by a template-name.\nA *run* script is mandatory\n\nA log service will be setup if `S6RC_TEMPLATE_%_log[mode]` exists and contains a valid value. For template services, there are two log modes available \"all-in-one\" and \"per-instance\".\n\nWith `all-in-one` a single log file service will be setup that can be used to collect the log entries of all service instances. For this to work, the log service stores a file descriptor in the s6-fdholder service `fdstore` that must be retrieved by each service instance.\n\nThe file descriptor can be retrieved with `s6-fdholder-retrieve /service/fdstore/s write:${TEMPLATE}-log`. See also [*Filedescriptor storage*](#filedescriptor-storage).\nWhen instantiating templates inside a [*Oneshot*](#oneshots)\n\nThe mode `per-instance` creates a minimal log service for each service instance. Stdout will be automatically forwarded to this log service.\n\n## Additional commands\n\n### rc-recompile\n\nAfter manually modifying the `/etc/s6-rc/tree` the rc-recompile script\nwill do the `s6-rc-compile, s6-rc-update, symlink` magic\nas proposed in [Managing compiled databases](https://skarnet.org/software/s6-rc/faq.html#compiledmanagement)\njust that `rc-recompile` toggles between \"compiledA\" and \"compiledB\"\n\n### rc-config\n\nusage: `rc-config [enable|disable] \u003cserviceX|oneshotY|bundleZ\u003e`\n\nAdds or removes the given services, oneshots and bundles\nto the `default` bundle, which is the default bundle when booting.\n\nIt first modifies the source tree in `/etc/s6-rc/tree/default/contents`,\nthen adds or removes it to the compiled database by\n`s6-rc-bundle -f add default ...`\nand finally updates the live state by `s6-rc -up -v2 change default`.\n\n### rc-dynamic\n\nusage `rc-dynamic [setup|teardown] \u003cservice-name\u003e\n\nCreate an instance from an [S6RC\\_TEMPLATE](#templates). The name of the dynamic service is **instance@template**\nThe template from the directory */etc/s6-rc/templates/* is copied with the whole service name\nto */run/service*. An envfile called *env/instance* is created inside the service with 2 variables:\n - INSTANCE=\"\\\u003cinstance-name\\\u003e\"\n - TEMPLATE=\"\\\u003ctemplate-name\\\u003e\"\n\nThe run and finish scripts may source it or the execlie way: *envfile env/instance* it and\nuse the INSTANCE variable name for starting this specific instance.\nAn optional executable file in the template: *data/check-instance* may be used to validate\nthe instance name. It will be called with the instance-name as argument and must exit 0\nif the instance is valid. If it exits non-zero, the instance creation fails.\n\n### s6-startstop\n\nThe script `/etc/init.d/s6-startstop` is never called directly, but called\nvia a symlink, which determines the service to act on.\nIt provides the following subcommands:\n - *enable:* permanently enable and start the service\n - *disable:* permanently stop and disable the service\n - *start:* temporarily start the service and all its dependencies until\n   reboot. After a reboot it returns to the enabled/disabled state\n - *stop:* temporarily stop the service and all its dependencies until reboot.\n   After a reboot it returns to the enabled/disabled state\n - *restart:* same as start, but terminates the service\n   if it is already running.\n - *status:* prints the `s6-svstat` output\n - *pid:* prints the pid of the service\n - *crashes:* prints the death tally of the service\n - *logs:* prints the complete log\n - *logf:* does a tail -f of the last logs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris2511%2Fmeta-s6-rc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchris2511%2Fmeta-s6-rc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris2511%2Fmeta-s6-rc/lists"}