Skip to contentSkip to conversation

system: extend the list of init systems (branch yem/init-choice)

PATCH In review Yann E. MORIN 4 participants 9 messages Aug 30, 2024 – Sep 18, 2024

lore
Share & tools
lore
#0 lore raw

cover system: extend the list of init systems (branch yem/init-choice)

Hello All!

This little series is a proposal to follow on the discussion with Dario and Thomas, about Dario's series adding tiny-init:

    https://lore.kernel.org/buildroot/ZtF1pHPZqUkUit8N@landeda/T/#mc1ef6288de44b9d35d382187ae14edf3185aa0c5

Note that, contrary to what was said in that discussion, there is no need to add a build dependency from Busybox to tini, as tini does not install itself as /init or /sbin/init, so will not be conflicting with Busybox.

Regards,
Yann E. MORIN.

----------------------------------------------------------------
Yann E. MORIN (3):
system: change label for BR2_INIT_NONE
system: classify init systems
system: add tini as init system

 package/tini/Config.in |  1 +
 system/Config.in       | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

PATCH 1/3 system: change label for BR2_INIT_NONE

Currently, the label reads "None", but it can be a bit misleading. Indeed, since its inception in 0c00636e8bbc (system/init: add option for no init system), what it really meant was "none of the above", as briefly laid out in the commit log for 0c00636e8bbc (typo included):

Can be usefull if a local package provides an init procedure.

This was later refined in 4d185e5ec51b (system: add help entry to "none" init system), which explained:

Add a comment that states the user has to provide his own init system, either via a package or a rootfs overlay.

So, change the label to better reflect that.

Cc Dario Binacchi <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 system/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
system/Config.in +1 -1
index 318c538ef1..c710b38e74 100644
@@ -146,7 +146,7 @@ comment "systemd highly recommends Linux >= 4.15"
 	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
 
 config BR2_INIT_NONE
-	bool "None"
+	bool "Custom (none)"
 	select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
 	help
 	  Buildroot will not install any init system. You will
Signature · 6 lines
2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH 2/3 system: classify init systems

In reply to Yann E. MORIN

We're going to add more init systems, and some have a very special purpose, so we do not want to mix them with the mundane platitude of existing init systems.

Add comments to separate the two.

Note that the list would already contain comments, when a br2-external tree provides an init system, so those new comments would not be totally weird-looking.

Cc Dario Binacchi <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 system/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
system/Config.in +4 -0
index c710b38e74..18cc39ad94 100644
@@ -87,6 +87,8 @@ choice
 	prompt "Init system"
 	default BR2_INIT_BUSYBOX
 
+comment "General purpose"
+
 config BR2_INIT_BUSYBOX
 	bool "BusyBox"
 	select BR2_PACKAGE_BUSYBOX
@@ -145,6 +147,8 @@ comment "systemd highly recommends Linux >= 4.15"
 	depends on BR2_INIT_SYSTEMD
 	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
 
+comment "Special purpose (read help)"
+
 config BR2_INIT_NONE
 	bool "Custom (none)"
 	select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
Signature · 6 lines
2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v1 2/3
#3 lore raw

Re: [Buildroot] [PATCH 2/3] system: classify init systems

Hi Yann,

Quoted 41 lines · Yann E. MORIN

We're going to add more init systems, and some have a very special purpose, so we do not want to mix them with the mundane platitude of existing init systems.

Add comments to separate the two.

Note that the list would already contain comments, when a br2-external tree provides an init system, so those new comments would not be totally weird-looking.

Cc Dario Binacchi <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 system/Config.in | 4 ++++
 1 file changed, 4 insertions(+)
system/Config.in +4 -1
index c710b38e74..18cc39ad94 100644
@@ -87,6 +87,8 @@ choice
        prompt "Init system"
        default BR2_INIT_BUSYBOX
 
+comment "General purpose"
+
 config BR2_INIT_BUSYBOX
        bool "BusyBox"
        select BR2_PACKAGE_BUSYBOX
@@ -145,6 +147,8 @@ comment "systemd highly recommends Linux >= 4.15"
        depends on BR2_INIT_SYSTEMD
        depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15
 
+comment "Special purpose (read help)"
+
 config BR2_INIT_NONE
        bool "Custom (none)"
        select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
--
Quoted 2 lines

2.46.0

Regards,
Dario

Signature · 21 lines
Dario Binacchi

Senior Embedded Linux Developer

[email protected]

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
[email protected]

www.amarulasolutions.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH 3/3 system: add tini as init system

In reply to Yann E. MORIN

Tini is a special-purpose init system, aimed at containers.

Add it to the choice of init systems.

tini does not require much, so we re-use the default "none" skeleton.

Note that tini is no longer selectable on its own, which it used to be. This change will require that people using tini be careful when upgrading, though, but that will be very easily caught, as the containers would no longer start at all.

We could ad a comment stating why, but no other init system has such a comment, so adding one for tini alone would be weird, so we don't add one.

Cc Dario Binacchi <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/tini/Config.in |  1 +
 system/Config.in       | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
package/tini/Config.in +1 -0
index 719e1e1f22..bca8ad8e96 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_TINI
 	bool "tini"
 	depends on BR2_USE_MMU # fork()
+	depends on BR2_INIT_TINI
 	help
 	  tini is a simple but valid init binary to
 	  act as PID 1 for containers.
system/Config.in +16 -0
index 18cc39ad94..d7d59db47d 100644
@@ -149,6 +149,22 @@ comment "systemd highly recommends Linux >= 4.15"
 
 comment "Special purpose (read help)"
 
+config BR2_INIT_TINI
+	bool "tini"
+	depends on BR2_USE_MMU  # tini
+	select BR2_PACKAGE_TINI
+	select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
+	help
+	  Tini - A tiny but valid init for containers
+
+	  Tini is the simplest init you could think of.
+
+	  All Tini does is spawn a single child (Tini is meant to be run
+	  in a container), and wait for it to exit all the while reaping
+	  zombies and performing signal forwarding.
+
+	  https://github.com/krallin/tini
+
 config BR2_INIT_NONE
 	bool "Custom (none)"
 	select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
Signature · 6 lines
2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v1 3/3
#5 lore raw

Re: [Buildroot] [PATCH 3/3] system: add tini as init system

Hi Yann,

Quoted 64 lines · Yann E. MORIN

Tini is a special-purpose init system, aimed at containers.

Add it to the choice of init systems.

tini does not require much, so we re-use the default "none" skeleton.

Note that tini is no longer selectable on its own, which it used to be. This change will require that people using tini be careful when upgrading, though, but that will be very easily caught, as the containers would no longer start at all.

We could ad a comment stating why, but no other init system has such a comment, so adding one for tini alone would be weird, so we don't add one.

Cc Dario Binacchi <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/tini/Config.in |  1 +
 system/Config.in       | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
package/tini/Config.in +1 -0
index 719e1e1f22..bca8ad8e96 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_TINI
        bool "tini"
        depends on BR2_USE_MMU # fork()
+       depends on BR2_INIT_TINI
        help
          tini is a simple but valid init binary to
          act as PID 1 for containers.
system/Config.in +16 -1
index 18cc39ad94..d7d59db47d 100644
@@ -149,6 +149,22 @@ comment "systemd highly recommends Linux >= 4.15"
 
 comment "Special purpose (read help)"
 
+config BR2_INIT_TINI
+       bool "tini"
+       depends on BR2_USE_MMU  # tini
+       select BR2_PACKAGE_TINI
+       select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
+       help
+         Tini - A tiny but valid init for containers
+
+         Tini is the simplest init you could think of.
+
+         All Tini does is spawn a single child (Tini is meant to be run
+         in a container), and wait for it to exit all the while reaping
+         zombies and performing signal forwarding.
+
+         https://github.com/krallin/tini
+
 config BR2_INIT_NONE
        bool "Custom (none)"
        select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
--
Quoted 2 lines

2.46.0

Regards,
Dario

Signature · 21 lines
Dario Binacchi

Senior Embedded Linux Developer

[email protected]

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
[email protected]

www.amarulasolutions.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH 3/3] system: add tini as init system

Hi Yann,

Quoted 72 lines · Dario Binacchi

Hi Yann,

Quoted 64 lines · Yann E. MORIN

Tini is a special-purpose init system, aimed at containers.

Add it to the choice of init systems.

tini does not require much, so we re-use the default "none" skeleton.

Note that tini is no longer selectable on its own, which it used to be. This change will require that people using tini be careful when upgrading, though, but that will be very easily caught, as the containers would no longer start at all.

We could ad a comment stating why, but no other init system has such a comment, so adding one for tini alone would be weird, so we don't add one.

Cc Dario Binacchi <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/tini/Config.in |  1 +
 system/Config.in       | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
package/tini/Config.in +1 -0
index 719e1e1f22..bca8ad8e96 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_TINI
        bool "tini"
        depends on BR2_USE_MMU # fork()
+       depends on BR2_INIT_TINI
        help
          tini is a simple but valid init binary to
          act as PID 1 for containers.
system/Config.in +16 -1
index 18cc39ad94..d7d59db47d 100644
@@ -149,6 +149,22 @@ comment "systemd highly recommends Linux >= 4.15"
 
 comment "Special purpose (read help)"
 
+config BR2_INIT_TINI
+       bool "tini"
+       depends on BR2_USE_MMU  # tini
+       select BR2_PACKAGE_TINI
+       select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
+       help
+         Tini - A tiny but valid init for containers
+
+         Tini is the simplest init you could think of.
+
+         All Tini does is spawn a single child (Tini is meant to be run
+         in a container), and wait for it to exit all the while reaping
+         zombies and performing signal forwarding.
+
+         https://github.com/krallin/tini
+
 config BR2_INIT_NONE
        bool "Custom (none)"
        select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
--
Quoted 2 lines

2.46.0

Quoted 3 lines

Regards,
Dario

I think this is completely **wrong**.

People usually do not put docker-init (such as tini/catatonit) in container images, but in the host system, and use it by docker run --init. Only inits such as supervisor/s6 will be placed in container images.

Regards,
TIAN Yuanhao
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

Re: [Buildroot] [PATCH 3/3] system: add tini as init system

TIAN Yuanhao, All,

On 2024-09-18 16:02 +0800, TIAN Yuanhao spake thusly:

Quoted 4 lines
Quoted 3 lines · Dario Binacchi
Quoted 2 lines · Yann E. MORIN

Tini is a special-purpose init system, aimed at containers. Add it to the choice of init systems.

[--SNIP--]

Quoted 4 lines

I think this is completely **wrong**.
People usually do not put docker-init (such as tini/catatonit) in container images, but in the host system, and use it by docker run --init.

The container world does not revolve only around docker; there are other solutions.

We do have a situation where the container runtime will expect us to actually provide our own PID-1 that is a proper reaper. In that situation, we do need to have tini in the container and running as the entrypoint.

Note that tini also works if it is not PID-1; in that case, it uses the subreaper feature (since kernel 3.4, ages ago now!).

You mention catatonit. I was not aware about it, and neither that it was packaged in Buildroot, but then it might make sense to also add that to the list, now.

If one still wants to delegate the PID-1 reaper to a docker-provided tini (or alternative), then it is still possible to select the "Custom (none)" entry in the choice.

Regards,
Yann E. MORIN.

Signature · 23 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
|                 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
| yann.morin (at) orange.com           |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw
In reply to Yann E. MORIN

All,

On 2024-08-30 22:26 +0200, Yann E. MORIN spake thusly:

Quoted 15 lines

Hello All!

This little series is a proposal to follow on the discussion with Dario and Thomas, about Dario's series adding tiny-init:

    https://lore.kernel.org/buildroot/ZtF1pHPZqUkUit8N@landeda/T/#mc1ef6288de44b9d35d382187ae14edf3185aa0c5

Note that, contrary to what was said in that discussion, there is no need to add a build dependency from Busybox to tini, as tini does not install itself as /init or /sbin/init, so will not be conflicting with Busybox.

Regards,
Yann E. MORIN.

Quoted 5 lines

----------------------------------------------------------------
Yann E. MORIN (3):
system: change label for BR2_INIT_NONE
system: classify init systems
system: add tini as init system

As suggested by Thomas, series applied to master with reviews from Dario, thanks!

Regards,
Yann E. MORIN.

Quoted 11 lines
 package/tini/Config.in |  1 +
 system/Config.in       | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot