Skip to contentSkip to conversation

package/podman: new package (branch yem/podman)

PATCH Superseded Yann E. MORIN 4 participants 24 messages Mar 1, 2025 – Mar 9, 2025

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover package/podman: new package (branch yem/podman)

Hello All!

This series introduce podman, an alternative to Docker. Podman is daemon-less, and does not need root either.

The series starts with preparatory commits in existing packages and the testing infra: then it introduces new packages on which podman will rely.

Not required by podman, skopeo is made a target package as well, as it was of help debugging podman (and Docker in a separate series).

Changes v1 -> v2:
- add licensing info for netavark and podman (Julien)

Changes v2 -> v3:
- make rootless actually work (Raphael)

Regards,
Yann E. MORIN.

----------------------------------------------------------------
Yann E. MORIN (9):
support/testing: set date in emulated machine package/shadow: install to staging for subids package/conmon: depends on systemd when enabled package/slirp4netns: needs TUN support in the kernel package/skopeo: add target variant package/cgroupfs-mount: tweak the kernel config package/cgroupfs-v2-mount: new package package/netavark: new package package/podman: new package

 package/Config.in                              |   4 +
 package/cgroupfs-mount/Config.in               |  12 +-
 package/cgroupfs-mount/cgroupfs-mount.mk       |  11 ++
 package/cgroupfs-v2-mount/Config.in            |  10 ++
 package/cgroupfs-v2-mount/S30cgroupfs2         |  44 ++++++++
 package/cgroupfs-v2-mount/cgroupfs-v2-mount.mk |  20 ++++
 package/conmon/conmon.mk                       |   4 +
 package/netavark/Config.in                     |  10 ++
 package/netavark/netavark.hash                 |   3 +
 package/netavark/netavark.mk                   |  19 ++++
 package/podman/Config.in                       |  41 +++++++
 package/podman/containers.conf                 |   2 +
 package/podman/podman.hash                     |   3 +
 package/podman/podman.mk                       | 114 +++++++++++++++++++
 package/podman/policy.json                     |   7 ++
 package/podman/registries.conf                 |   1 +
 package/shadow/shadow.mk                       |   1 +
 package/skopeo/Config.in                       |  25 +++++
 package/skopeo/skopeo.mk                       |  10 ++
 package/slirp4netns/slirp4netns.mk             |   9 ++
 support/testing/infra/emulator.py              |   5 +
 support/testing/tests/package/test_podman.py   | 147 +++++++++++++++++++++++++
 support/testing/tests/package/test_skopeo.py   |  41 +++++++
 23 files changed, 532 insertions(+), 11 deletions(-)
 create mode 100644 package/cgroupfs-v2-mount/Config.in
 create mode 100644 package/cgroupfs-v2-mount/S30cgroupfs2
 create mode 100644 package/cgroupfs-v2-mount/cgroupfs-v2-mount.mk
 create mode 100644 package/netavark/Config.in
 create mode 100644 package/netavark/netavark.hash
 create mode 100644 package/netavark/netavark.mk
 create mode 100644 package/podman/Config.in
 create mode 100644 package/podman/containers.conf
 create mode 100644 package/podman/podman.hash
 create mode 100644 package/podman/podman.mk
 create mode 100644 package/podman/policy.json
 create mode 100644 package/podman/registries.conf
 create mode 100644 package/skopeo/Config.in
 create mode 100644 support/testing/tests/package/test_podman.py
 create mode 100644 support/testing/tests/package/test_skopeo.py

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

|  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 v3 1/9 support/testing: set date in emulated machine

When time comes to check certificates, the date and time in the emulated machine should be close enough to the actual values, so that certificate validity can be checked.

Set the date to the date of the system. This is going to be accurate to the second, which is, by far, enough for our purpose.

The Emulator() class doesn't inherit from unittest.TestCase, so we can't call any of the usual self.assertXXX() methods; instead, we just raise a standard exception, like is done a few lines above to detect the login prompt.

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v2:
- catch failure to set the date

---
 support/testing/infra/emulator.py | 5 +++++
 1 file changed, 5 insertions(+)
support/testing/infra/emulator.py +5 -0
index ef5be2a19e..9be1143944 100644
@@ -5,6 +5,7 @@ import os
 
 import pexpect
 import pexpect.replwrap
+import time
 
 import infra
 
@@ -152,6 +153,10 @@ class Emulator(object):
 
         self.connect_shell()
 
+        output, exit_code = self.run(f"date @{int(time.time())}")
+        if exit_code:
+            raise SystemError("Cannot set date in virtual machine")
+
     def connect_shell(self):
         extra_init_cmd = " && ".join([
             'export PAGER=cat',
Signature · 6 lines
2.47.0

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

Re: [Buildroot] [PATCH 1/9 v3] support/testing: set date in emulated machine

Hi Yann, all,

Quoted 36 lines · Yann E. MORIN

When time comes to check certificates, the date and time in the emulated machine should be close enough to the actual values, so that certificate validity can be checked.

Set the date to the date of the system. This is going to be accurate to the second, which is, by far, enough for our purpose.

The Emulator() class doesn't inherit from unittest.TestCase, so we can't call any of the usual self.assertXXX() methods; instead, we just raise a standard exception, like is done a few lines above to detect the login prompt.

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v2:
- catch failure to set the date

---
 support/testing/infra/emulator.py | 5 +++++
 1 file changed, 5 insertions(+)
support/testing/infra/emulator.py +1 -0
index ef5be2a19e..9be1143944 100644
@@ -5,6 +5,7 @@ import os
 
 import pexpect
 import pexpect.replwrap
+import time
 
 import infra
 

support/testing/infra/emulator.py class Emulator(object): · line 159

Quoted 7 lines
support/testing/infra/emulator.py +4 -0
@@ -152,6 +153,10 @@ class Emulator(object):
 
         self.connect_shell()
 
+        output, exit_code = self.run(f"date @{int(time.time())}")
+        if exit_code:
+            raise SystemError("Cannot set date in virtual machine")
+

Is this really needed?

Arm and Aarch64 qemu machines includes a pl031 RTC. x86/x86_64 includes a mc146818 RTC.
RISC-V has a Goldfish RTC.

If we revert this patch, the podman runtime test still succeed. In the runtime log "TestPodman-run.log", when the kernel boots, we see:

...
rtc-pl031 10017000.rtc: registered as rtc0
rtc-pl031 10017000.rtc: setting system clock to 2025-03-07T17:38:24 UTC (1741369104)
...

I understand that it is not always guaranteed that the qemu machine has a rtc and the used kernel has a driver for it, which is why we would like to set the date like this. But this could be left to the test implementer to make sure this is properly handled. And in the podman test case, you did.

What do you think?

Best regards,

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

#3 lore raw

Re: [Buildroot] [PATCH 1/9 v3] support/testing: set date in emulated machine

Julien, All,

On 2025-03-07 19:49 +0100, Julien Olivain spake thusly:

Quoted 7 lines · Yann E. MORIN
Quoted 6 lines

When time comes to check certificates, the date and time in the emulated machine should be close enough to the actual values, so that certificate validity can be checked.

Set the date to the date of the system. This is going to be accurate to the second, which is, by far, enough for our purpose.

[--SNIP--]

Quoted 5 lines

support/testing/infra/emulator.py class Emulator(object): · line 159

Quoted 4 lines
support/testing/infra/emulator.py +4 -0
+        output, exit_code = self.run(f"date @{int(time.time())}")
+        if exit_code:
+            raise SystemError("Cannot set date in virtual machine")
+

Is this really needed?

Yes: the skopeo test added in this series would otherwise fail with (lines wrapped for readability):

[BRTEST# skopeo --version
skopeo version 1.18.0
[BRTEST# echo $?
0
[BRTEST# skopeo inspect docker://busybox:latest FATA[0000] Error parsing image name "docker://busybox:latest":
pinging container registry registry-1.docker.io:
Get "https://registry-1.docker.io/v2/": tls: failed to verify
certificate: x509: certificate has expired or is not yet valid:
current time 1970-01-01T00:00:11Z is before 2025-03-05T00:00:00Z

Quoted 3 lines

Arm and Aarch64 qemu machines includes a pl031 RTC. x86/x86_64 includes a mc146818 RTC.
RISC-V has a Goldfish RTC.

The skopeo test uses the bundeled kernel with the "default" virtual machine, and in that machine, the date is not set on boot: there is no RTC regferenced in the kernel log, at least.

Quoted 1 line

If we revert this patch, the podman runtime test still succeed.

The reason to introduce this patch was not for podman, but for skopeo.

[--SNIP--]

Quoted 3 lines

I understand that it is not always guaranteed that the qemu machine has a rtc and the used kernel has a driver for it, which is why we would like to set the date like this.

Exactly.

Quoted 5 lines

But this could be left to the
test implementer to make sure this is properly handled. And in the podman test case, you did.

What do you think?

I think that setting the time is a generic topic, and that tests should not need to do that.

Regards,
Yann E. MORIN.

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
#4 lore raw

Re: [Buildroot] [PATCH 1/9 v3] support/testing: set date in emulated machine

Hi Yann, All,

Quoted 51 lines · Yann E. MORIN

Julien, All,

On 2025-03-07 19:49 +0100, Julien Olivain spake thusly:

Quoted 7 lines · Yann E. MORIN
Quoted 6 lines

When time comes to check certificates, the date and time in the emulated machine should be close enough to the actual values, so that certificate validity can be checked.

Set the date to the date of the system. This is going to be accurate to the second, which is, by far, enough for our purpose.

[--SNIP--]

Quoted 5 lines

support/testing/infra/emulator.py class Emulator(object): · line 159

Quoted 4 lines
support/testing/infra/emulator.py +4 -0
+        output, exit_code = self.run(f"date @{int(time.time())}")
+        if exit_code:
+            raise SystemError("Cannot set date in virtual machine")
+

Is this really needed?

Yes: the skopeo test added in this series would otherwise fail with (lines wrapped for readability):

[BRTEST# skopeo --version
skopeo version 1.18.0
[BRTEST# echo $?
0
[BRTEST# skopeo inspect docker://busybox:latest FATA[0000] Error parsing image name "docker://busybox:latest":
pinging container registry registry-1.docker.io:
Get "https://registry-1.docker.io/v2/": tls: failed to verify
certificate: x509: certificate has expired or is not yet valid:
current time 1970-01-01T00:00:11Z is before

2025-03-05T00:00:00Z
Quoted 3 lines

Arm and Aarch64 qemu machines includes a pl031 RTC. x86/x86_64 includes a mc146818 RTC.
RISC-V has a Goldfish RTC.

The skopeo test uses the bundeled kernel with the "default" virtual machine, and in that machine, the date is not set on boot: there is no RTC regferenced in the kernel log, at least.

Quoted 1 line

If we revert this patch, the podman runtime test still succeed.

The reason to introduce this patch was not for podman, but for skopeo.

[--SNIP--]

Quoted 3 lines

I understand that it is not always guaranteed that the qemu machine has a rtc and the used kernel has a driver for it, which is why we would like to set the date like this.

Exactly.

Quoted 8 lines
Quoted 5 lines

But this could be left to the
test implementer to make sure this is properly handled. And in the podman test case, you did.

What do you think?

I think that setting the time is a generic topic, and that tests should not need to do that.

Thanks for the explanations. I agree with you that we should keep this patch.

If you send another version of this patch, could you add small comment in the commit log about why we are not using qemu RTCs here? Something like:
"""
Some Qemu machines includes an emulated RTC which could be used to pass the host time to the guest. For example, arm vexpress-a9 has a pl031 rtc. The Kernel has to include the driver for this to work.

Since the Buildroot bundled default test kernel does not have this support, and also to avoid handling the complexity of which architectures/machines/kernels is supported, those emulated RTCs are not used here and the date is simply set with the "date" command. """

Quoted 2 lines

Regards,
Yann E. MORIN.

Best regards,

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

#5 lore raw

PATCH v3 2/9 package/shadow: install to staging for subids

In reply to Yann E. MORIN

When the subids feature is enabled, shadow will install a library and a header:

    $ sort output/build/shadow-4.16.0/.files-list.txt
    [...]
    shadow,./lib/libsubid.la
    shadow,./lib/libsubid.so
    shadow,./lib/libsubid.so.5
    shadow,./lib/libsubid.so.5.0.0
    [...]
    shadow,./usr/include/shadow/subid.h
    [...]

Install to staging in that case.

Cc Raphael Pavlidis <[email protected]>
---
 package/shadow/shadow.mk | 1 +
 1 file changed, 1 insertion(+)
package/shadow/shadow.mk +1 -0
index cea984012d..c598ad88fd 100644
@@ -46,6 +46,7 @@ SHADOW_CONF_OPTS += --disable-account-tools-setuid
 endif
 
 ifeq ($(BR2_PACKAGE_SHADOW_SUBORDINATE_IDS),y)
+SHADOW_INSTALL_STAGING = YES
 SHADOW_CONF_OPTS += --enable-subordinate-ids
 define SHADOW_SUBORDINATE_IDS_PERMISSIONS
 	/usr/bin/newuidmap f 4755 0 0 - - - - -
Signature · 6 lines
2.47.0

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

Re: [Buildroot] [PATCH 2/9 v3] package/shadow: install to staging for subids

Hello Yann,
the changes looks good.

Thanks you.

Regards,
Raphael

Quoted 26 lines · Yann E. MORIN

When the subids feature is enabled, shadow will install a library and a header:

     $ sort output/build/shadow-4.16.0/.files-list.txt
     [...]
     shadow,./lib/libsubid.la
     shadow,./lib/libsubid.so
     shadow,./lib/libsubid.so.5
     shadow,./lib/libsubid.so.5.0.0
     [...]
     shadow,./usr/include/shadow/subid.h
     [...]

Install to staging in that case.

Cc Raphael Pavlidis <[email protected]>
---
  package/shadow/shadow.mk | 1 +
  1 file changed, 1 insertion(+)
package/shadow/shadow.mk +0 -0
index cea984012d..c598ad88fd 100644

package/shadow/shadow.mk SHADOW_CONF_OPTS += --disable-account-tools-setuid · line 52

Quoted 7 lines
package/shadow/shadow.mk +1 -0
@@ -46,6 +46,7 @@ SHADOW_CONF_OPTS += --disable-account-tools-setuid
  endif
 
  ifeq ($(BR2_PACKAGE_SHADOW_SUBORDINATE_IDS),y)
+SHADOW_INSTALL_STAGING = YES
  SHADOW_CONF_OPTS += --enable-subordinate-ids
  define SHADOW_SUBORDINATE_IDS_PERMISSIONS
  	/usr/bin/newuidmap f 4755 0 0 - - - - -

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

#7 lore raw

PATCH v3 3/9 package/conmon: depends on systemd when enabled

In reply to Yann E. MORIN

When it detects it runs under systemd, conmon will want to log to the journal. However, it needs to be linked with libsystemd to do so and if not, will error out:

    Feb 22 11:10:03 buildroot conmon[199]: conmon 3b462ce6f2cc64f75c42 <error>: Include journald in compilation path to log to systemd journal

This prevents starting any container.

Add a dependency to systemd when it is enabled.

Cc Christian Stewart <[email protected]>
---
 package/conmon/conmon.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/conmon/conmon.mk +4 -0
index 1e57786686..ed1a2554fa 100644
@@ -18,6 +18,10 @@ else
 CONMON_DISABLE_SECCOMP = 1
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+CONMON_DEPENDENCIES += systemd
+endif
+
 define CONMON_CONFIGURE_CMDS
 	printf '#!/bin/bash\necho "$(CONMON_DISABLE_SECCOMP)"\n' > \
 		$(@D)/hack/seccomp-notify.sh
Signature · 6 lines
2.47.0

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

PATCH v3 4/9 package/slirp4netns: needs TUN support in the kernel

In reply to Yann E. MORIN

slirp4netns needs a kernel with TUN support, so enable that and the few options it depends on.

Cc Raphael Pavlidis <[email protected]>
---
 package/slirp4netns/slirp4netns.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/slirp4netns/slirp4netns.mk +9 -0
index ffcd334ab6..5923957c25 100644
@@ -12,4 +12,13 @@ SLIRP4NETNS_DEPENDENCIES = libcap libglib2 libseccomp slirp
 
 SLIRP4NETNS_AUTORECONF = YES
 
+define SLIRP4NETNS_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CORE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETDEVICES)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CORE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_INET)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_TUN)
+endef
+
 $(eval $(autotools-package))
Signature · 6 lines
2.47.0

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

Re: [Buildroot] [PATCH 4/9 v3] package/slirp4netns: needs TUN support in the kernel

Hello Yann,
the changes looks good.

On 3/1/25 16:05, Yann E. MORIN wrote:
[snip]

package/slirp4netns/slirp4netns.mk SLIRP4NETNS_DEPENDENCIES = libcap libglib2 libseccomp slirp · line 22

Quoted 9 lines
package/slirp4netns/slirp4netns.mk +8 -0
+define SLIRP4NETNS_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CORE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETDEVICES)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CORE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_INET)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_TUN)
+endef

Yes, you are right; those kernel configurations have to be applied.

Thank you for the trial and error. ;)

[snip]

Regards,
Raphael

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

#10 lore raw

PATCH v3 5/9 package/skopeo: add target variant

In reply to Yann E. MORIN

Skopeo can be used to manipulate container images, and so can be usefull on target devices that are going to be used as a host to run containers.

So, add a target variant for skopeo.

... with a runtime test while at it.

Cc Christian Stewart <[email protected]>
Cc Yann E. MORIN <[email protected]>
---
 package/Config.in                            |  1 +
 package/skopeo/Config.in                     | 25 ++++++++++++
 package/skopeo/skopeo.mk                     | 10 +++++
 support/testing/tests/package/test_skopeo.py | 41 ++++++++++++++++++++
 4 files changed, 77 insertions(+)
 create mode 100644 package/skopeo/Config.in
 create mode 100644 support/testing/tests/package/test_skopeo.py
package/Config.in +1 -0
index 4a81a62ec4..33fcfd0597 100644
@@ -2892,6 +2892,7 @@ menu "System tools"
 	source "package/sdbusplus/Config.in"
 	source "package/seatd/Config.in"
 	source "package/shadow/Config.in"
+	source "package/skopeo/Config.in"
 	source "package/smack/Config.in"
 	source "package/start-stop-daemon/Config.in"
 	source "package/supervisor/Config.in"
package/skopeo/Config.in new file +25 -0
new file mode 100644
index 0000000000..f1acc3a50f
@@ -0,0 +1,25 @@
+config BR2_PACKAGE_SKOPEO
+	bool "skopeo"
+	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
+	depends on BR2_USE_MMU  # btrfs-progs, libgpgme, lvm2
+	depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS  # libgpgme
+	depends on BR2_TOOLCHAIN_HAS_THREADS  # btrfs-progs, lvm2
+	depends on !BR2_STATIC_LIBS  # lvm2
+	select BR2_PACKAGE_HOST_GO
+	select BR2_PACKAGE_BTRFS_PROGS
+	select BR2_PACKAGE_LIBGPGME
+	select BR2_PACKAGE_LVM2
+	help
+	  skopeo is a command line utility that performs various
+	  operations on container images and image repositories.
+
+	  https://github.com/containers/skopeo
+
+comment "skopeo needs a toolchain w/ threads, sahred libs"
+	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
+	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS \
+		|| BR2_STATIC_LIBS
package/skopeo/skopeo.mk +10 -0
index 8e3a302e8d..b3b213983f 100644
@@ -11,13 +11,23 @@ SKOPEO_LICENSE = Apache-2.0
 SKOPEO_LICENSE_FILES = LICENSE
 SKOPEO_CPE_ID_VALID = YES
 
+SKOPEO_DEPENDENCIES = \
+	host-pkgconf \
+	btrfs-progs \
+	libgpgme \
+	lvm2
+
 HOST_SKOPEO_DEPENDENCIES = \
 	host-btrfs-progs \
 	host-libgpgme \
 	host-lvm2 \
 	host-pkgconf
 
+SKOPEO_GO_ENV = PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig
+SKOPEO_BUILD_TARGETS = cmd/skopeo
+
 HOST_SKOPEO_GO_ENV = PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig
 HOST_SKOPEO_BUILD_TARGETS = cmd/skopeo
 
+$(eval $(golang-package))
 $(eval $(host-golang-package))
support/testing/tests/package/test_skopeo.py new file +41 -0

41 lines not on this page · raw message

Signature · 6 lines
2.47.0

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

PATCH v3 6/9 package/cgroupfs-mount: tweak the kernel config

In reply to Yann E. MORIN

When it was introduced in 2016 with commit 0e1547a87cfd (cgroupfs-mount:
new package), we did not yet have the infrastrucutre for package to set kernel config options, which only came 4 years later with commit 0aed4c2dae76 (linux: allow packages to set kernel config options).

So at that time, the requirements for cgroupfs-mount were documented in the help for the Kconfig symbol.

But now that we do have tha infrastructure in place, actually use it to set the required options, and drop the list from the Lconfig entry (that would be duplication, prone to bit-rot with time, and other packages do not document their requirements in LKconfig, they just use the infra to set the options).

---
 package/cgroupfs-mount/Config.in         | 12 +-----------
 package/cgroupfs-mount/cgroupfs-mount.mk | 11 +++++++++++
 2 files changed, 12 insertions(+), 11 deletions(-)
package/cgroupfs-mount/Config.in +1 -11
index 0b2e4ba1e7..29a40c93d1 100644
@@ -4,16 +4,6 @@ config BR2_PACKAGE_CGROUPFS_MOUNT
 	help
 	  cgroupfs mount and umount scripts.
 
-	  requires a Linux kernel >= 3.0 with the following options
-	  enabled:
-
-	  - CONFIG_BLK_CGROUP
-	  - CONFIG_CGROUPS
-	  - CONFIG_CGROUP_CPUACCT
-	  - CONFIG_CGROUP_DEVICE
-	  - CONFIG_CGROUP_FREEZER
-	  - CONFIG_CGROUP_WRITEBACK
-	  - CONFIG_CGROUP_SCHED
-	  - CONFIG_CGROUP_PIDS
+	  Requires a Linux kernel >= 3.0
 
 	  https://github.com/tianon/cgroupfs-mount
package/cgroupfs-mount/cgroupfs-mount.mk +11 -0
index 5af87629ea..156d584266 100644
@@ -10,6 +10,17 @@ CGROUPFS_MOUNT_LICENSE = GPL-3.0+
 CGROUPFS_MOUNT_LICENSE_FILES = debian/copyright
 CGROUPFS_MOUNT_CPE_ID_VALID = YES
 
+define CGROUPFS_MOUNT_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_CGROUP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_CPUACCT)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_DEVICE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_FREEZER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_WRITEBACK)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_PIDS)
+endef
+
 define CGROUPFS_MOUNT_INSTALL_TARGET_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/cgroupfs-mount $(TARGET_DIR)/usr/bin/cgroupfs-mount
 	$(INSTALL) -D -m 0755 $(@D)/cgroupfs-umount $(TARGET_DIR)/usr/bin/cgroupfs-umount
Signature · 6 lines
2.47.0

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

PATCH v3 7/9 package/cgroupfs-v2-mount: new package

In reply to Yann E. MORIN

Currently, the cgroupfs-mount package only mounts a cgroup v1 hierarchy, but v1 is considered legacy and obsolete, while v2 has ben around for a while now, and is required by some packages (e.g. podman whines about v1).

cgroupfs-mount has not had a release in almost 8 years now, and only the occasional commit since then and until more than 3 years ago. It's not going to evolve...

Add a new package with a simple-enough sysv startup script, that mounts the cgroup v2 hierarchy filesystem. For systemd, there's nothing to do, as systemd handles the mount by itself.

Since both cgroup v1 and v2 use the same mountpoint, we can't have both enabled at the same time, and thus we restrict the v2 to be hidden when v1 is enabled (quite a few packages select the v1; changing those would require that they be validated against v2 first...)

Note that, due to limitations in Kconfig, cgroupfs-v2-mount will appear indented below cgroupfs-mount, because it has a (negative) dependnecy on it. This spurious indentation is unfortunate and annoying, but benign; fixing that would require breaking the dependency with a random Kconfig symbole, which we dont have, and which we decided not to introduce jsut for this one use-case (well, there's host-gnupg and host-gnupg2 that have the exact same issue, but meh...)

Cc Fiona Klute <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v2 -> v3;
- enable cgroups in the kernel
- really unmount on stop, rather than mounting again

---
 package/Config.in                             |  1 +
 package/cgroupfs-v2-mount/Config.in           | 10 +++++
 package/cgroupfs-v2-mount/S30cgroupfs2        | 44 +++++++++++++++++++
 .../cgroupfs-v2-mount/cgroupfs-v2-mount.mk    | 20 +++++++++
 4 files changed, 75 insertions(+)
 create mode 100644 package/cgroupfs-v2-mount/Config.in
 create mode 100644 package/cgroupfs-v2-mount/S30cgroupfs2
 create mode 100644 package/cgroupfs-v2-mount/cgroupfs-v2-mount.mk
package/Config.in +1 -0
index 33fcfd0597..a152268209 100644
@@ -2808,6 +2808,7 @@ menu "System tools"
 	source "package/balena-engine/Config.in"
 	source "package/bubblewrap/Config.in"
 	source "package/cgroupfs-mount/Config.in"
+	source "package/cgroupfs-v2-mount/Config.in"
 	source "package/circus/Config.in"
 	source "package/conmon/Config.in"
 	source "package/containerd/Config.in"
package/cgroupfs-v2-mount/Config.in new file +10 -0
new file mode 100644
index 0000000000..2dd2dbc089
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_CGROUPFS_V2_MOUNT
+	bool "cgroupfs-v2-mount"
+	depends on !BR2_INIT_SYSTEMD
+	depends on !BR2_PACKAGE_CGROUPFS_MOUNT
+	help
+	  Mount the cgroup v2 hierarchy filesystem.
+
+comment "cgroupfs-v2-mount is incompatible with cgroupfs-mount"
+	depends on !BR2_INIT_SYSTEMD
+	depends on BR2_PACKAGE_CGROUPFS_MOUNT
package/cgroupfs-v2-mount/S30cgroupfs2 new file +44 -0

44 lines not on this page · raw message

package/cgroupfs-v2-mount/cgroupfs-v2-mount.mk new file +20 -0
new file mode 100644
index 0000000000..10e18d8d41
@@ -0,0 +1,20 @@
+################################################################################
+#
+# cgroupfs-v2-mount
+#
+################################################################################
+
+CGROUPFS_V2_MOUNT_VERSION =
+CGROUPFS_V2_MOUNT_SITE =
+
+define CGROUPFS_V2_MOUNT_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
+endef
+
+define CGROUPFS_V2_MOUNT_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D \
+		$(CGROUPFS_V2_MOUNT_PKGDIR)/S30cgroupfs2 \
+		$(TARGET_DIR)/etc/init.d/S30cgroupfs2
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.47.0

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

PATCH v3 8/9 package/netavark: new package

In reply to Yann E. MORIN

---
Changes v1 -> v2:
- add licensing information (Julien)

---
 package/Config.in              |  1 +
 package/netavark/Config.in     | 10 ++++++++++
 package/netavark/netavark.hash |  3 +++
 package/netavark/netavark.mk   | 19 +++++++++++++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 package/netavark/Config.in
 create mode 100644 package/netavark/netavark.hash
 create mode 100644 package/netavark/netavark.mk
package/Config.in +1 -0
index a152268209..460955cb90 100644
@@ -2559,6 +2559,7 @@ endif
 	source "package/ndisc6/Config.in"
 	source "package/net-tools/Config.in"
 	source "package/netatalk/Config.in"
+	source "package/netavark/Config.in"
 	source "package/netcalc/Config.in"
 	source "package/netcat/Config.in"
 	source "package/netcat-openbsd/Config.in"
package/netavark/Config.in new file +10 -0
new file mode 100644
index 0000000000..caac3c4872
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_NETAVARK
+	bool "netavark"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_RUSTC
+	help
+	  Netavark is a rust based network stack for containers. It
+	  is being designed to work with Podman but is also applicable
+	  for other OCI container management applications.
+
+	  https://github.com/containers/netavark
package/netavark/netavark.hash new file +3 -0
new file mode 100644
index 0000000000..585763be42
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  09471bd116fdebfd3f7a8100b37809e3a306d0f18e5feee8445ed1e01a22e0aa  netavark-v1.14.0-git4-cargo2.tar.gz
+sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
package/netavark/netavark.mk new file +19 -0
new file mode 100644
index 0000000000..b2508bb5a8
@@ -0,0 +1,19 @@
+################################################################################
+#
+# netavark
+#
+################################################################################
+
+NETAVARK_VERSION = v1.14.0
+NETAVARK_SITE = https://github.com/containers/netavark
+NETAVARK_SITE_METHOD = git
+
+NETAVARK_LICENSE = Apache-2.0
+NETAVARK_LICENSE_FILES = LICENSE
+
+# For protoc
+NETAVARK_DEPENDENCIES = host-protobuf
+
+NETAVARK_CARGO_ENV = PROTOC=$(HOST_DIR)/bin/protoc
+
+$(eval $(cargo-package))
Signature · 6 lines
2.47.0

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

PATCH v3 9/9 package/podman: new package

In reply to Yann E. MORIN

Podman is a container manager not unlike Docker, but is daemon-less.

Similalry to docker-engine, quite a few kernel config options are required; as they are very similar in goals and features, the options from docker-engine ahve been duplicated for podman. As that was not enough, a few additional options have been added after trial-and-error testing (they are not explicitly listed in the documentaion).

The documentation [0] states that seccomp can be disabled (i.e. not enabled), but we were unable to start a container without seccomp support in podman. So we make that mandatory.

Podman can run either as the root user, in which case it would need netavark as a network helper (not sure why, but it missing is a hard error for podman), or it can run rootless, i.e. by a non-root user, which hrequires a bit of setup (see below, in the runtime test) and a few other dependencies: slirp4netns [1] (network backend), and support for subordinate UIDs and GIDs with the shadow library. Rootless mode is one of the main selling point for podman, so we decided that this would not be configurable in Buildroot.

Similar to Docker, podman can inject a minimalist init as PID1 in containers, and like Docker, this is optional; podman however can only use catatonit as such an init [2]. Given the size of catatonit (1.3% that of podman!), we do not bother to make it optional, and always enable it as well.

Podman requires at least three config files; they can be either per-user or system-wide:
- containers.conf [3]: defines various settings for the container

    runtimes;
  - policy.json [4]: defines what signature to accept to validate
    images; without one such file, podman just refuses to pull images;

- registries.conf [5]: defines where to pull iamges from; without it, podman does not know how to pull un-qualified images (i.e. images where the registry is not specified in the path, and which Docker would fetch from the Docker Hub, e.g. "busybox:latest").

For those three files, we provide a very minimal default that (in the same order as above):
- uses the slirp4netns network backend for rootless operation (the default in podman is to use pasta [1], so we need to explicitly configure it to use slirp4netns);
- allows pulling images which signature can't be verified;
- pulls unqualified images from the Docker Hub, as is traditional.

Providing actual files is going to be use-case dependent, and interested parties will have to provide their own config files, e.g. in a rootfs overlay.

Finally, we add a runtime test for podman. The official busybox image on the Docker Hub supports a lot of architectures, of which armv7 which we use for this runtime test. Finding a small image that also supports armv7 on other registries was a bit of a challenge; we eventually found one busybox image on quay.io, but it is not an official busybox image; still, it fits the bill, so we use it.

The default kernel used in runtime tests is missing a lot of features, so we need to build our own. We can't use cpio either, because we need a filesystem that can be used as a lower and upper of overlayfs, which is not possible with the filesystem the cpio is extracted into; ext2 fits the bill, so we use that. We need a bit of space to store images and stuff, so let's be generous and allocate 256M.

To test rootless operation, we need a non-root user that has some special setup [6]; it is easier to run the commands from the infra rather than carry a user-definition table and a rootfs overlay. We need that user to have the same prompts (main and continuation) so that the REPLWrapper still detects those; it has the unfortunate side effect that it is not immediately obvious whether a command was run as root or not, and one has to look back up in the run-log to see whether there was a transition to another user earlier.

There is no runtime test with systemd, as this requires quite some additional setup that does not look very trivial to do; when it detects it is running under systemd in rootless mode, podman expects that a full user session exists, or it whines about it every time it is started, reverting to non-systemd behaviour; getting a full user session does not look to be that trivial (PAM?), so this would not exercise the actual integration with systemd, so the test would not be meaningful, so it is not provided. This is left as an exercise to an interested party to extend the tests.

PS: Hat-tip to Raphael, who provided some pointers and hints on this change, especially for rootless mode. Thanks! 👍

[0] https://podman.io/docs/installation#get-source-code
[1] it is possible to use another backend, but it is not packaged in
in Buildroot yet: https://passt.top/passt/about/#pasta-pack-a-subtle-tap-abstraction
[2] podman expects a 'catatonit' helper in /usr/libexec/podman, so even if tini would be usable instead, it would not feel right to use it to impersonate catatonit. So let's assume that only catatonit is supported.
[3] https://github.com/containers/common/blob/main/docs/containers.conf.5.md
[4] https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md
[5] https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md
[6] https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md

Cc Raphael Pavlidis <[email protected]>
Cc Christian Stewart <[email protected]>
Cc Julien Olivain <[email protected]>

---
Changes v1 -> v2:
- add licensing information (Julien)

Changes v2 -> v3:
- make it work with rootless

---
 package/Config.in                            |   1 +
 package/podman/Config.in                     |  41 ++++++
 package/podman/containers.conf               |   2 +
 package/podman/podman.hash                   |   3 +
 package/podman/podman.mk                     | 114 ++++++++++++++
 package/podman/policy.json                   |   7 +
 package/podman/registries.conf               |   1 +
 support/testing/tests/package/test_podman.py | 147 +++++++++++++++++++
 8 files changed, 316 insertions(+)
 create mode 100644 package/podman/Config.in
 create mode 100644 package/podman/containers.conf
 create mode 100644 package/podman/podman.hash
 create mode 100644 package/podman/podman.mk
 create mode 100644 package/podman/policy.json
 create mode 100644 package/podman/registries.conf
 create mode 100644 support/testing/tests/package/test_podman.py
package/Config.in +1 -0
index 460955cb90..65c458bfa9 100644
@@ -2868,6 +2868,7 @@ menu "System tools"
 	source "package/openvmtools/Config.in"
 	source "package/pamtester/Config.in"
 	source "package/petitboot/Config.in"
+	source "package/podman/Config.in"
 	source "package/polkit/Config.in"
 	source "package/powerpc-utils/Config.in"
 	source "package/procps-ng/Config.in"
package/podman/Config.in new file +41 -0

41 lines not on this page · raw message

package/podman/containers.conf new file +2 -0
new file mode 100644
index 0000000000..1db48c1905
@@ -0,0 +1,2 @@
+[network]
+default_rootless_network_cmd = "slirp4netns"
package/podman/podman.hash new file +3 -0
new file mode 100644
index 0000000000..4cbba59dc0
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  e5cae3433931e6d6259b72d8d6513661f70cb083ea338068604c47fff5666127  podman-v5.4.0-git4-go2.tar.gz
+sha256  62fb8a3a9621dc2388174caaabe9c2317b694bb9a1d46c98bcf5655b68f51be3  LICENSE
package/podman/podman.mk new file +114 -0

114 lines not on this page · raw message

package/podman/policy.json new file +7 -0
new file mode 100644
index 0000000000..9333053f93
@@ -0,0 +1,7 @@
+{
+  "default": [
+    {
+      "type": "insecureAcceptAnything"
+    }
+  ]
+}
package/podman/registries.conf new file +1 -0
new file mode 100644
index 0000000000..d44d892da3
@@ -0,0 +1 @@
+unqualified-search-registries = ["docker.io"]
support/testing/tests/package/test_podman.py new file +147 -0

147 lines not on this page · raw message

Signature · 6 lines
2.47.0

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

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

Hello Yann, All,

On 3/1/25 16:05, Yann E. MORIN wrote:
[snip]

Quoted 4 lines

The documentation [0] states that seccomp can be disabled (i.e. not enabled), but we were unable to start a container without seccomp support in podman. So we make that mandatory.

You can start a container without seccomp by passing the --security-opt=seccomp=unconfined` option. But it is okay for me if it is mandatory.

Quoted 1 line

[snip]

Quoted 6 lines

Similar to Docker, podman can inject a minimalist init as PID1 in containers, and like Docker, this is optional; podman however can only use catatonit as such an init [2]. Given the size of catatonit (1.3% that of podman!), we do not bother to make it optional, and always enable it as well.

I think systemd can also be used as a init. According to the documentation [1].

[snip]

package/podman/Config.in line 16

Quoted 1 line
package/podman/Config.in new file +1 -0
+	select BR2_PACKAGE_IPTABLES  # runtime

I am sure that you do not need iptables if you are using nftables.

[snip]

package/podman/podman.mk line 103

Quoted 8 lines
package/podman/podman.mk new file +8 -0
+		$(PODMAN_PKGDIR)/containers.conf \
+		$(TARGET_DIR)/etc/containers/containers.conf
+	$(Q)$(INSTALL) -D -m 0644 \
+		$(PODMAN_PKGDIR)/policy.json \
+		$(TARGET_DIR)/etc/containers/policy.json
+	$(Q)$(INSTALL) -D -m 0644 \
+		$(PODMAN_PKGDIR)/registries.conf \
+		$(TARGET_DIR)/etc/containers/registries.conf

Just for curiosity, why not installing those files under /usr/share/containers?

[snip]

Thanks for your good work.

Regards,
Raphael Pavlidis

[1]: https://docs.podman.io/en/latest/markdown/podman-run.1.html#systemd-true-false-always

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

#16 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

Hi,

Quoted 16 lines · Raphael Pavlidis

Hello Yann, All,

On 3/1/25 16:05, Yann E. MORIN wrote:

I am sure that you do not need iptables if you are using nftables.

[snip]

package/podman/podman.mk line 103

Quoted 8 lines
package/podman/podman.mk new file +8 -0
+             $(PODMAN_PKGDIR)/containers.conf \
+             $(TARGET_DIR)/etc/containers/containers.conf
+     $(Q)$(INSTALL) -D -m 0644 \
+             $(PODMAN_PKGDIR)/policy.json \
+             $(TARGET_DIR)/etc/containers/policy.json
+     $(Q)$(INSTALL) -D -m 0644 \
+             $(PODMAN_PKGDIR)/registries.conf \
+             $(TARGET_DIR)/etc/containers/registries.conf
Quoted 3 lines

Just for curiosity, why not installing those files under /usr/share/containers?

I agree that as far as the defaults we install with the package, they should go to /usr/share/containers

https://github.com/containers/common/blob/main/docs/containers.conf.5.md

Container engines read the /usr/share/containers/containers.conf, /etc/containers/containers.conf, and /etc/containers/containers.conf.d/*.conf for global configuration that effects all users.

Otherwise looks good!

Best,
Christian

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

#17 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

Christian, All,

On 2025-03-07 11:38 -0800, Christian Stewart spake thusly:

Quoted 13 lines

On Fri, Mar 7, 2025, 5:40 AM Raphael Pavlidis <[1][email protected]> wrote:

    On 3/1/25 16:05, Yann E. MORIN wrote:
    > +             $(PODMAN_PKGDIR)/containers.conf \
    > +             $(TARGET_DIR)/etc/containers/containers.conf
    > +     $(Q)$(INSTALL) -D -m 0644 \
    > +             $(PODMAN_PKGDIR)/policy.json \
    > +             $(TARGET_DIR)/etc/containers/policy.json
    > +     $(Q)$(INSTALL) -D -m 0644 \
    > +             $(PODMAN_PKGDIR)/registries.conf \
    > +             $(TARGET_DIR)/etc/containers/registries.conf
    Just for curiosity, why not installing those files under
    /usr/share/containers?
Quoted 7 lines

I agree that as far as the defaults we install with the package, they should go to /usr/share/containers [2]https://github.com/containers/common/blob/main/docs/containers.conf.5.md

Container engines read the /usr/share/containers/containers.conf, /etc/ containers/containers.conf, and /etc/containers/containers.conf.d/*.conf for global configuration that effects all users.

See my reply to Raphael, that explains why I choose those locations for those files.

I'll move the contrainers.conf file to its primary location, in /usr/share/, in the next respin.

Thanks!

Regards,
Yann E. MORIN.

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
#18 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

In reply to Raphael Pavlidis

Raphael, All,

On 2025-03-07 14:40 +0100, Raphael Pavlidis spake thusly:

Quoted 7 lines · Yann E. MORIN
Quoted 3 lines

The documentation [0] states that seccomp can be disabled (i.e. not enabled), but we were unable to start a container without seccomp support in podman. So we make that mandatory.

You can start a container without seccomp by passing the --security-opt=seccomp=unconfined` option. But it is okay for me if it is mandatory.

Ok, good to know. But it means that, by default, podman uses seccomp, and there is no way (that I could find, like in containers/conf for example) to disble it unless with a non-trivial --option. Also, having seccomp support does not preclude not using it. So I would still consider that, for the Buildroot integration, we can make it mandatory.

Thanks for the hint about the --option!

Quoted 7 lines
Quoted 5 lines

Similar to Docker, podman can inject a minimalist init as PID1 in containers, and like Docker, this is optional; podman however can only use catatonit as such an init [2]. Given the size of catatonit (1.3% that of podman!), we do not bother to make it optional, and always enable it as well.

I think systemd can also be used as a init. According to the documentation [1].

https://docs.podman.io/en/latest/markdown/podman-run.1.html#init

As far as I understand it, using --init is what will cause catatonit to be mounted into the container, and then called as PID 1, with catatonit then spawning the actual command (or entrypoing etc...).

Using --systemd=XXX is "just" a way to tell podman to automatically do a few preliminary setup (mounting tmpfs where needed, etc...) before spawning the command in the container (i.e. either the one specified on the podman copmmand line, or the entrypoint etc...) With --systemd=true the setup is done if the commadn is systemd, /usr/sbin/init, /sbin/init or /usr/local/sbin/init (whether those are actually systemd or not, by the way!); with --systemd=false, the setup is never done, and with --systemd=always, the setup is always done.

Of course, I would expect that using --init (and thus catatonit as PID 1), with a systemd in the container, will not play nicely, as systemd would not be PID 1...

So, I think the catatonit init is unrelated to systemd, and one can not use systemd as the process used by podman --init. Of course, it is entirely possible that I misunderstood that part of podman too. ;-)

Quoted 2 lines

package/podman/Config.in line 16

Quoted 1 line
package/podman/Config.in new file +1 -0
+	select BR2_PACKAGE_IPTABLES  # runtime

I am sure that you do not need iptables if you are using nftables.

I briefly tried with nftables, it did not work, so I did not investigate further; IIRC it was before I had to write containers.conf, so maybe we can specify the firewall driver there... Ah, yes, it seems we can do that:

firewall_driver=""

The firewall driver to be used by netavark. [...] supported drivers are "iptables", "nftables" [...]

I can regive it a spin, and add a blurb in the commit log if the outcome is still negative.

But either way, it can be an improvement afterwards, once the series is applied.

Quoted 10 lines

package/podman/podman.mk line 103

Quoted 8 lines
package/podman/podman.mk new file +8 -0
+		$(PODMAN_PKGDIR)/containers.conf \
+		$(TARGET_DIR)/etc/containers/containers.conf
+	$(Q)$(INSTALL) -D -m 0644 \
+		$(PODMAN_PKGDIR)/policy.json \
+		$(TARGET_DIR)/etc/containers/policy.json
+	$(Q)$(INSTALL) -D -m 0644 \
+		$(PODMAN_PKGDIR)/registries.conf \
+		$(TARGET_DIR)/etc/containers/registries.conf

Just for curiosity, why not installing those files under /usr/share/containers?

The first such file I wrote was policy.json, and the documentation for it states [0]:

By default, the policy is read from $HOME/.config/containers/policy.json, if it exists, otherwise from /etc/containers/policy.json ; [...]

So I did not look further and put it in /etc/containers/. Then I had to write registries.conf (for seemless access to the docker hub), and again the documentation also states [1]:

By default, the policy is read from $HOME/.config/containers/policy.json, if it exists, otherwise from /etc/containers/policy.json ; [...]

So again, I put it /etc/containers/ without much ado. And when it came to write containers.conf to use slirp4netns instead of pasta, it seemed like a good idea to pu it there too, and as the documentatiopn also states this is a valid location [2], I decided to put all config files together.

I now looked at my Fedora, and policy.json and registries.json are indeed in /etc, but containers.conf is in /usr/share/. I'll move it.

Thanks for the good and interesting feedback! :-)

Regards,
Yann E. MORIN.

[0] https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md#description
[1] https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md#description
[2] https://github.com/containers/common/blob/main/docs/containers.conf.5.md#description

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
#19 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

Raphael, All,

On 2025-03-08 12:00 +0100, Yann E. MORIN spake thusly:

Quoted 2 lines

On 2025-03-07 14:40 +0100, Raphael Pavlidis spake thusly:

Quoted 1 line · Yann E. MORIN

[--SNIP--]

Quoted 10 lines
Quoted 10 lines

package/podman/podman.mk line 103

Quoted 8 lines
package/podman/podman.mk new file +8 -0
+		$(PODMAN_PKGDIR)/containers.conf \
+		$(TARGET_DIR)/etc/containers/containers.conf
+	$(Q)$(INSTALL) -D -m 0644 \
+		$(PODMAN_PKGDIR)/policy.json \
+		$(TARGET_DIR)/etc/containers/policy.json
+	$(Q)$(INSTALL) -D -m 0644 \
+		$(PODMAN_PKGDIR)/registries.conf \
+		$(TARGET_DIR)/etc/containers/registries.conf

Just for curiosity, why not installing those files under /usr/share/containers?

Quoted 9 lines

The first such file I wrote was policy.json, and the documentation for it states [0]:
By default, the policy is read from $HOME/.config/containers/policy.json, if it exists, otherwise from /etc/containers/policy.json ; [...]
So I did not look further and put it in /etc/containers/. Then I had to write registries.conf (for seemless access to the docker hub), and again the documentation also states [1]:
By default, the policy is read from $HOME/.config/containers/policy.json, if it exists, otherwise from /etc/containers/policy.json ; [...]

Sorry, that second excerpt should have been:

Container engines will use the $HOME/.config/containers/registries.conf if it exists, otherwise they will use /etc/containers/registries.conf

Quoted 1 line

[1] https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md#description

Sorry for the confusion...

Regards,
Yann E. MORIN.

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
#20 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

In reply to Yann E. MORIN

raphael, All,

On 2025-03-08 12:00 +0100, Yann E. MORIN spake thusly:

Quoted 2 lines

On 2025-03-07 14:40 +0100, Raphael Pavlidis spake thusly:

Quoted 1 line · Yann E. MORIN

[--SNIP--]

Quoted 9 lines
Quoted 2 lines

package/podman/Config.in line 16

Quoted 1 line
package/podman/Config.in new file +1 -0
+	select BR2_PACKAGE_IPTABLES  # runtime

I am sure that you do not need iptables if you are using nftables.

I briefly tried with nftables, it did not work, so I did not investigate further; IIRC it was before I had to write containers.conf, so maybe we can specify the firewall driver there... Ah, yes, it seems we can do that:
firewall_driver=""
The firewall driver to be used by netavark. [...] supported drivers are "iptables", "nftables" [...]

Doing so was not enough to use nftables. Even with every NFT modules enabled in the kernel, netavark would still whine than nft would fail to list rules, or apply them.

So, I eventually got to the bottom of the issue: netavark requires that nftables be build with support for JSON output. Once this is done, then it all magically works (magically, as with all the tears ands sweat and swearwords as the trinkets and incatation needed for such a spell...)

Regards,
Yann E. MORIN.

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
#21 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

In reply to Yann E. MORIN

Hi Yann, all,

Quoted 1 line · Yann E. MORIN

Podman is a container manager not unlike Docker, but is daemon-less.

[...]

Quoted 62 lines
support/testing/tests/package/test_podman.py new file +33 -0
new file mode 100644
index 0000000000..9e5be98b00
@@ -0,0 +1,147 @@
+import infra.basetest
+import json
+import os
+
+
+class TestPodman(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a9=y
+        BR2_ARM_ENABLE_VFP=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
+        BR2_PER_PACKAGE_DIRECTORIES=y
+        BR2_SYSTEM_DHCP="eth0"
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.202"
+        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+        BR2_LINUX_KERNEL_DTS_SUPPORT=y
+        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+        BR2_PACKAGE_PODMAN=y
+        BR2_PACKAGE_UTIL_LINUX=y
+        BR2_PACKAGE_UTIL_LINUX_MOUNT=y
+        BR2_PACKAGE_HOST_GO_BIN=y
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        kernel_file = os.path.join(self.builddir, 'images', 'zImage')
+        dtb_file = os.path.join(self.builddir, 'images', 

'vexpress-v2p-ca9.dtb')
+ ext2_file = os.path.join(self.builddir, 'images',
'rootfs.ext2')

support/testing/tests/package/test_podman.py new file +20 -0
+        self.emulator.boot(
+            arch='armv5',
+            kernel=kernel_file,
+            kernel_cmdline=[
+                'root=/dev/mmcblk0',
+                'rootwait',
+                'console=ttyAMA0',
+            ],
+            options=[
+                '-M', 'vexpress-a9',
+                '-dtb', dtb_file,
+                '-drive', f'file={ext2_file},if=sd,format=raw',
+            ]
+        )
+        self.emulator.login()
+
+        # Do some preparation for rootless use
+        self.assertRunOk("mount --make-shared /")
+        self.assertRunOk("chmod 666 /dev/net/tun")
+        self.assertRunOk("useradd -d /home/foo -m -s /bin/sh -u 1000 
Quoted 1 line

foo")

It would be nice to keep tests idempotent. This can be useful while debugging tests, and avoid rebuilding everything at each attempt. It is even more useful in tests with a long build time like this one.

In the current state, running the test once with the command:

    utils/docker-run support/testing/run-tests \
        -k -d dl -o output_folder \
        tests.package.test_podman

succeeds. But running it a second time, it fails with error:

useradd: user 'foo' already exists

This because this tests emulates a persistent storage.

If possible, could you improve the test to make sure it can run at least two time in a row with the run-tests "-k" option, please?

For example, with a construct like:

id -u foo || useradd ... foo

There is possibly few other places that might need cleanup too.

Best regards,

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

#22 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

Julien, All,

On 2025-03-07 19:55 +0100, Julien Olivain spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

Podman is a container manager not unlike Docker, but is daemon-less.

[--SNIP--]

Quoted 5 lines
Quoted 2 lines

+ self.assertRunOk("useradd -d /home/foo -m -s /bin/sh -u 1000
foo")

It would be nice to keep tests idempotent. This can be useful while debugging tests, and avoid rebuilding everything at each attempt.

You know that you can just remove the "build-done" filestamp in the test build directory, to just rebuild the image and not the whole thing, right? ;-)

    $ rm -f run-tests/TestSkopeo/build-done
Quoted 2 lines

It is even more useful in tests with a long build time like this one.

Well, you'd get other issues as well in case the tests are failing: if the test fails to remove the images from local storage, then restarting the test will fail even earlier, as it expects an empty local storage to start with...

Furthermore, the virtual machine is abruptly terminated when the test ends (the qemu process is killed without letting the VM a chance to shutdown), the filesystem will be inconsistent, leaving all sorts of false negative (or positives) if restarting the test anyway (e.g. removing the images from local storage, even is sucessful, might not have had a chance to hit the disk yet).

Quoted 4 lines

If possible, could you improve the test to make sure it can run at least two time in a row with the run-tests "-k" option, please? For example, with a construct like:
id -u foo || useradd ... foo

Sorry, but this is not a good idea I believe. The tests should be run from a clean build, or at the very least from a clean image (which is easy to do, see above).

In retrospect, I believe the build should always be restarted to always start the test from a clean image, and so the "build-done" filestamp is in fact counter-productive: we _want_ to rebuild the rootfs image before starting tests.

Quoted 1 line

There is possibly few other places that might need cleanup too.

There are so many other tests that are probably not idempotent either, unfortunately, as soon as they do not use the CPIO or do not use a read-only persistent storage.

For example, the docker-compose test is not idempotent, as the image will remain on the disk (but OK, the second run would not fail, just the download would not happen, which means though that the second run would not test the same thing as the first run).

So, I am not very inclined in making this one test idempotent.

Instead, I think we should really just get rid of build-done.

Thanks for the review! :-)

Regards,
Yann E. MORIN.

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
#23 lore raw

Re: [Buildroot] [PATCH 9/9 v3] package/podman: new package

Hi Yann,

Quoted 53 lines · Yann E. MORIN

Julien, All,

On 2025-03-07 19:55 +0100, Julien Olivain spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

Podman is a container manager not unlike Docker, but is daemon-less.

[--SNIP--]

Quoted 5 lines
Quoted 2 lines

+ self.assertRunOk("useradd -d /home/foo -m -s /bin/sh -u 1000
foo")

It would be nice to keep tests idempotent. This can be useful while debugging tests, and avoid rebuilding everything at each attempt.

You know that you can just remove the "build-done" filestamp in the test build directory, to just rebuild the image and not the whole thing, right? ;-)

    $ rm -f run-tests/TestSkopeo/build-done
Quoted 2 lines

It is even more useful in tests with a long build time like this one.

Well, you'd get other issues as well in case the tests are failing: if the test fails to remove the images from local storage, then restarting the test will fail even earlier, as it expects an empty local storage to start with...

Furthermore, the virtual machine is abruptly terminated when the test ends (the qemu process is killed without letting the VM a chance to shutdown), the filesystem will be inconsistent, leaving all sorts of false negative (or positives) if restarting the test anyway (e.g. removing the images from local storage, even is sucessful, might not have had a chance to hit the disk yet).

Quoted 4 lines

If possible, could you improve the test to make sure it can run at least two time in a row with the run-tests "-k" option, please? For example, with a construct like:
id -u foo || useradd ... foo

Sorry, but this is not a good idea I believe. The tests should be run from a clean build, or at the very least from a clean image (which is easy to do, see above).

In retrospect, I believe the build should always be restarted to always start the test from a clean image, and so the "build-done" filestamp is in fact counter-productive: we _want_ to rebuild the rootfs image before starting tests.

Quoted 1 line

There is possibly few other places that might need cleanup too.

There are so many other tests that are probably not idempotent either, unfortunately, as soon as they do not use the CPIO or do not use a read-only persistent storage.

Quoted 8 lines

For example, the docker-compose test is not idempotent, as the image will remain on the disk (but OK, the second run would not fail, just the download would not happen, which means though that the second run would not test the same thing as the first run).

So, I am not very inclined in making this one test idempotent.

Instead, I think we should really just get rid of build-done.

You are right. It is probably the "run-tests -k" command which might need to be idempotent (rather than the test itself).

So, forget about my change suggestions in this test. I'm taking a note about a possible future improvement on run-tests, instead.

Quoted 4 lines

Thanks for the review! :-)

Regards,
Yann E. MORIN.

Best regards,

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