All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1
@ 2020-03-01 15:17 unixmania at gmail.com
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service unixmania at gmail.com
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: unixmania at gmail.com @ 2020-03-01 15:17 UTC (permalink / raw)
  To: buildroot

From: Carlos Santos <unixmania@gmail.com>

1. Drop the custom getty service, which has issues with openrc 0.42.1.
   Use the already existing agetty service, with two small patches.

2. Bump openrc to version 0.42.1. It requires a patch to prevent
   starting spurions agetty instances for tty[1-6].

3. Add selinux support.

4. Add openrc tests.

Adam Duskett (3):
  package/openrc: bump to version 0.42.1
  package/openrc: add libselinux support
  support/testing: add openrc tests

Carlos Santos (1):
  package/openrc: drop custom getty service

 .gitlab-ci.yml                                |  2 +
 ...ty-replace-sbin-agetty-by-sbin-getty.patch | 33 ++++++++++++
 ...getty-start-agetty-after-all-sevices.patch | 29 +++++++++++
 ...-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch | 34 +++++++++++++
 package/openrc/getty                          | 24 ---------
 package/openrc/openrc.hash                    |  2 +-
 package/openrc/openrc.mk                      | 18 ++++---
 support/testing/tests/init/test_openrc.py     | 51 +++++++++++++++++++
 8 files changed, 161 insertions(+), 32 deletions(-)
 create mode 100644 package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
 create mode 100644 package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
 create mode 100644 package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch
 delete mode 100755 package/openrc/getty
 create mode 100644 support/testing/tests/init/test_openrc.py

-- 
2.18.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service
  2020-03-01 15:17 [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1 unixmania at gmail.com
@ 2020-03-01 15:17 ` unixmania at gmail.com
  2020-03-11 16:52   ` Yann E. MORIN
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1 unixmania at gmail.com
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: unixmania at gmail.com @ 2020-03-01 15:17 UTC (permalink / raw)
  To: buildroot

From: Carlos Santos <unixmania@gmail.com>

In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
create a /sbin/getty symlink pointing to the actual program, so make the
agetty service use that path instead of /sbin/agetty.

Also start agetty after all other services, to prevent mixing startup
messages with the getty prompt on devices with a single serial console.

This allows us to drop the custom getty service, which causes an error
message from openrc 0.42.1 (in a forthcoming patch):

    Error: getty is the name of a real and virtual service.

The patches are required because it's not possible to override the
command or startup order by means of a configuration file. Anyway it's
still better to patch something maintained upstream than depending on a
custom piece that may easily become obsolete.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
CC: Adam Duskett <Aduskett@gmail.com>
---
 ...ty-replace-sbin-agetty-by-sbin-getty.patch | 33 +++++++++++++++++++
 ...getty-start-agetty-after-all-sevices.patch | 29 ++++++++++++++++
 package/openrc/getty                          | 24 --------------
 package/openrc/openrc.mk                      |  8 ++---
 4 files changed, 65 insertions(+), 29 deletions(-)
 create mode 100644 package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
 create mode 100644 package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
 delete mode 100755 package/openrc/getty

diff --git a/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch b/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
new file mode 100644
index 0000000000..feeff22254
--- /dev/null
+++ b/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
@@ -0,0 +1,33 @@
+From b39ab180358ed451eae9df900f49a72ef1eb7442 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sun, 1 Mar 2020 09:04:48 -0300
+Subject: [PATCH] init.d/agetty: replace /sbin/agetty by /sbin/getty
+
+In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
+create a /sbin/getty symlink pointing to the actual program, so make the
+agetty service use that path instead of /sbin/agetty.
+
+The patch is required because it's not possible to override the command
+by means of a configuration file.
+
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ init.d/agetty.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/init.d/agetty.in b/init.d/agetty.in
+index e4866f7a..e1864628 100644
+--- a/init.d/agetty.in
++++ b/init.d/agetty.in
+@@ -14,7 +14,7 @@ supervisor=supervise-daemon
+ port="${RC_SVCNAME#*.}"
+ respawn_period="${respawn_period:-60}"
+ term_type="${term_type:-linux}"
+-command=/sbin/agetty
++command=/sbin/getty
+ command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
+ pidfile="/run/${RC_SVCNAME}.pid"
+ 
+-- 
+2.18.2
+
diff --git a/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch b/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
new file mode 100644
index 0000000000..f1c927a450
--- /dev/null
+++ b/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
@@ -0,0 +1,29 @@
+From c2dc04f6b8c6784941b896e0b17c160dd43a566f Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sun, 1 Mar 2020 11:14:37 -0300
+Subject: [PATCH] init.d/agetty: start agetty after all services
+
+This is required for Buildroot, to prevent mixing service initialization
+messages with the getty prompt on devices with a single serial console.
+
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ init.d/agetty.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/init.d/agetty.in b/init.d/agetty.in
+index e1864628..a1ad4e9f 100644
+--- a/init.d/agetty.in
++++ b/init.d/agetty.in
+@@ -19,7 +19,7 @@ command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
+ pidfile="/run/${RC_SVCNAME}.pid"
+ 
+ depend() {
+-	after local
++	after *
+ 	keyword -prefix
+ 	provide getty
+ }
+-- 
+2.18.2
+
diff --git a/package/openrc/getty b/package/openrc/getty
deleted file mode 100755
index 8fcb071f8a..0000000000
--- a/package/openrc/getty
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/sbin/openrc-run
-# based on agetty service from OpenRC package
-
-description="start getty on terminal"
-supervisor=supervise-daemon
-port="${RC_SVCNAME#*.}"
-term_type="${term_type:-linux}"
-command=/sbin/getty
-command_args_foreground="${getty_options} ${baud} ${port} ${term_type}"
-pidfile="/run/${RC_SVCNAME}.pid"
-
-depend() {
-	# start getty at the very end of init
-	after *
-	keyword -prefix
-}
-
-start_pre() {
-	export EINFO_QUIET="${quiet:-yes}"
-}
-
-stop_pre() {
-	export EINFO_QUIET="${quiet:-yes}"
-}
diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index 1f8516f5ee..ce0b05e965 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -68,17 +68,15 @@ endef
 OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
 
 ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
-OPENRC_GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT)
+OPENRC_GETTY_SVCNAME = agetty.$(SYSTEM_GETTY_PORT)
 OPENRC_GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(OPENRC_GETTY_SVCNAME)
 define OPENRC_SET_GETTY
 	{ \
 		echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\""; \
 		echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" ; \
-		echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
+		echo "agetty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
 	} > $(OPENRC_GETTY_CONF_D)
-	$(INSTALL) -D -m 0755 $(OPENRC_PKGDIR)/getty \
-		$(TARGET_DIR)/etc/init.d/getty
-	ln -sf getty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
+	ln -sf agetty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
 	ln -sf /etc/init.d/$(OPENRC_GETTY_SVCNAME) \
 		$(TARGET_DIR)/etc/runlevels/default/$(OPENRC_GETTY_SVCNAME)
 endef
-- 
2.18.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1
  2020-03-01 15:17 [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1 unixmania at gmail.com
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service unixmania at gmail.com
@ 2020-03-01 15:17 ` unixmania at gmail.com
  2020-03-11 17:22   ` Yann E. MORIN
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support unixmania at gmail.com
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests unixmania at gmail.com
  3 siblings, 1 reply; 16+ messages in thread
From: unixmania at gmail.com @ 2020-03-01 15:17 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

Add a patch to prevent starting agetty on tty[1-6]. Buildroot starts a
single getty, according to the system configuration. Also tty[1-6] may
not even exist (e.g. embedded devices with serial consoles only).

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
Changes v1->v2:
  - Fix agetty issue
---
 ...-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch | 34 +++++++++++++++++++
 package/openrc/openrc.hash                    |  2 +-
 package/openrc/openrc.mk                      |  2 +-
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch

diff --git a/package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch b/package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch
new file mode 100644
index 0000000000..733506ada9
--- /dev/null
+++ b/package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch
@@ -0,0 +1,34 @@
+From 014dc43447fa553e875984ac4a528e5916cc9e06 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sat, 29 Feb 2020 22:41:30 -0300
+Subject: [PATCH] runlevels: do not add agetty.tty[1-6] if MKSYSVINIT=yes
+
+Buildroot starts a single getty, according to the system configuration.
+Also tty[1-6] may not exist (e.g. embedded devices with serial consoles
+only).
+
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ runlevels/Makefile | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/runlevels/Makefile b/runlevels/Makefile
+index 73843d8b..dbfb59ca 100644
+--- a/runlevels/Makefile
++++ b/runlevels/Makefile
+@@ -90,12 +90,6 @@ install:
+ 			fi; \
+ 			ln -snf ${INITDIR}/"$$x" ${SHUTDOWNDIR}/"$$x" || exit $$?; done \
+ 	fi
+-	if test "${MKSYSVINIT}" = yes && test "${OS}" = Linux; then \
+-		for x in tty1 tty2 tty3 tty4 tty5 tty6; do \
+-			ln -snf ${INITDIR}/agetty ${DESTDIR}/${INITDIR}/"agetty.$$x" || exit $$?; \
+-			ln -snf ${INITDIR}/agetty.$$x ${DEFAULTDIR}/"agetty.$$x" || exit $$?; \
+-		done; \
+-	fi
+ 
+ check test::
+ 
+-- 
+2.18.2
+
diff --git a/package/openrc/openrc.hash b/package/openrc/openrc.hash
index 7d58e254c4..bb5880806d 100644
--- a/package/openrc/openrc.hash
+++ b/package/openrc/openrc.hash
@@ -1,3 +1,3 @@
 # Locally calculated
-sha256	c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4	openrc-0.41.2.tar.gz
+sha256	91a01ca6d930a0688fb91338209985de57cac7aa2d37feddacb78fd3d95308e2	openrc-0.42.1.tar.gz
 sha256	96862463f4e77e2508e4fc2c83773fd24807cb699368b63fd93a5e2b466dd624	LICENSE
diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index ce0b05e965..6057451bfe 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-OPENRC_VERSION = 0.41.2
+OPENRC_VERSION = 0.42.1
 OPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
 OPENRC_LICENSE = BSD-2-Clause
 OPENRC_LICENSE_FILES = LICENSE
-- 
2.18.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support
  2020-03-01 15:17 [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1 unixmania at gmail.com
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service unixmania at gmail.com
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1 unixmania at gmail.com
@ 2020-03-01 15:17 ` unixmania at gmail.com
  2020-03-11 17:26   ` Yann E. MORIN
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests unixmania at gmail.com
  3 siblings, 1 reply; 16+ messages in thread
From: unixmania at gmail.com @ 2020-03-01 15:17 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

If the libselinux package is selected, add the package to the dependency list
and explicitly set OPENRC_MAKE_OPTS += MKSELINUX=yes

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
 package/openrc/openrc.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index 6057451bfe..97536dad37 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -18,7 +18,6 @@ OPENRC_MAKE_OPTS = \
 	LIBNAME=lib \
 	LIBEXECDIR=/usr/libexec/rc \
 	MKPKGCONFIG=no \
-	MKSELINUX=no \
 	MKSYSVINIT=yes \
 	BRANDING="Buildroot $(BR2_VERSION_FULL)" \
 	CC=$(TARGET_CC)
@@ -29,6 +28,13 @@ else
 OPENRC_MAKE_OPTS += MKSTATICLIBS=yes
 endif
 
+ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
+OPENRC_MAKE_OPTS += MKSELINUX=yes
+OPENRC_DEPENDENCIES += libselinux
+else
+OPENRC_MAKE_OPTS += MKSELINUX=no
+endif
+
 define OPENRC_BUILD_CMDS
 	$(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
 endef
-- 
2.18.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests
  2020-03-01 15:17 [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1 unixmania at gmail.com
                   ` (2 preceding siblings ...)
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support unixmania at gmail.com
@ 2020-03-01 15:17 ` unixmania at gmail.com
  2020-03-01 17:39   ` Yann E. MORIN
  2020-03-11 17:50   ` Yann E. MORIN
  3 siblings, 2 replies; 16+ messages in thread
From: unixmania at gmail.com @ 2020-03-01 15:17 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

Two simple tests to ensure that openrc boots without any services crashing
with a read only and a read write filing system.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
 .gitlab-ci.yml                            |  2 +
 support/testing/tests/init/test_openrc.py | 51 +++++++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 support/testing/tests/init/test_openrc.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b4dad3173e..382a7c59b2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -368,6 +368,8 @@ tests.init.test_busybox.TestInitSystemBusyboxRoNet: { extends: .runtime_test }
 tests.init.test_busybox.TestInitSystemBusyboxRw: { extends: .runtime_test }
 tests.init.test_busybox.TestInitSystemBusyboxRwNet: { extends: .runtime_test }
 tests.init.test_none.TestInitSystemNone: { extends: .runtime_test }
+tests.init.test_openrc.TestInitSystemOpenrcRoFull: { extends: .runtime_test }
+tests.init.test_openrc.TestInitSystemOpenrcRwFull: { extends: .runtime_test }
 tests.init.test_systemd.TestInitSystemSystemdRoFull: { extends: .runtime_test }
 tests.init.test_systemd.TestInitSystemSystemdRoIfupdown: { extends: .runtime_test }
 tests.init.test_systemd.TestInitSystemSystemdRoNetworkd: { extends: .runtime_test }
diff --git a/support/testing/tests/init/test_openrc.py b/support/testing/tests/init/test_openrc.py
new file mode 100644
index 0000000000..23669a9572
--- /dev/null
+++ b/support/testing/tests/init/test_openrc.py
@@ -0,0 +1,51 @@
+import infra.basetest
+from tests.init.base import InitSystemBase as InitSystemBase
+
+
+class InitSystemOpenrcBase(InitSystemBase):
+    config = \
+        """
+        BR2_arm=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_INIT_OPENRC=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.5.7"
+        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+        BR2_LINUX_KERNEL_DTS_SUPPORT=y
+        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def check_init(self):
+        super(InitSystemOpenrcBase, self)
+
+        # Test all services are OK
+        output, _ = self.emulator.run("rc-status -c")
+        self.assertEqual(len(output), 0)
+
+
+class TestInitSystemOpenrcRoFull(InitSystemOpenrcBase):
+    config = InitSystemOpenrcBase.config + \
+        """
+        BR2_SYSTEM_DHCP="eth0"
+        # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
+        BR2_TARGET_ROOTFS_SQUASHFS=y
+        """
+
+    def test_run(self):
+        self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
+        self.check_init()
+
+
+class TestInitSystemOpenrcRwFull(InitSystemOpenrcBase):
+    config = InitSystemOpenrcBase.config + \
+        """
+        BR2_SYSTEM_DHCP="eth0"
+        BR2_TARGET_ROOTFS_EXT2=y
+        """
+
+    def test_run(self):
+        self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
+        self.check_init()
-- 
2.18.2

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests unixmania at gmail.com
@ 2020-03-01 17:39   ` Yann E. MORIN
  2020-03-03 11:59     ` Carlos Santos
  2020-03-11 17:50   ` Yann E. MORIN
  1 sibling, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2020-03-01 17:39 UTC (permalink / raw)
  To: buildroot

Carlos, Adam, All,

On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> Two simple tests to ensure that openrc boots without any services crashing
> with a read only and a read write filing system.
> 
> Signed-off-by: Adam Duskett <Aduskett@gmail.com>
> Signed-off-by: Carlos Santos <unixmania@gmail.com>

Thanks for this new runtime test! :-)

Would it make sense to apply just this test to master? Or does it really
need the version bump first?

Regards,
Yann E. MORIN.

> ---
>  .gitlab-ci.yml                            |  2 +
>  support/testing/tests/init/test_openrc.py | 51 +++++++++++++++++++++++
>  2 files changed, 53 insertions(+)
>  create mode 100644 support/testing/tests/init/test_openrc.py
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index b4dad3173e..382a7c59b2 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -368,6 +368,8 @@ tests.init.test_busybox.TestInitSystemBusyboxRoNet: { extends: .runtime_test }
>  tests.init.test_busybox.TestInitSystemBusyboxRw: { extends: .runtime_test }
>  tests.init.test_busybox.TestInitSystemBusyboxRwNet: { extends: .runtime_test }
>  tests.init.test_none.TestInitSystemNone: { extends: .runtime_test }
> +tests.init.test_openrc.TestInitSystemOpenrcRoFull: { extends: .runtime_test }
> +tests.init.test_openrc.TestInitSystemOpenrcRwFull: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRoFull: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRoIfupdown: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRoNetworkd: { extends: .runtime_test }
> diff --git a/support/testing/tests/init/test_openrc.py b/support/testing/tests/init/test_openrc.py
> new file mode 100644
> index 0000000000..23669a9572
> --- /dev/null
> +++ b/support/testing/tests/init/test_openrc.py
> @@ -0,0 +1,51 @@
> +import infra.basetest
> +from tests.init.base import InitSystemBase as InitSystemBase
> +
> +
> +class InitSystemOpenrcBase(InitSystemBase):
> +    config = \
> +        """
> +        BR2_arm=y
> +        BR2_TOOLCHAIN_EXTERNAL=y
> +        BR2_INIT_OPENRC=y
> +        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> +        BR2_LINUX_KERNEL=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.5.7"
> +        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
> +        BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
> +        # BR2_TARGET_ROOTFS_TAR is not set
> +        """
> +
> +    def check_init(self):
> +        super(InitSystemOpenrcBase, self)
> +
> +        # Test all services are OK
> +        output, _ = self.emulator.run("rc-status -c")
> +        self.assertEqual(len(output), 0)
> +
> +
> +class TestInitSystemOpenrcRoFull(InitSystemOpenrcBase):
> +    config = InitSystemOpenrcBase.config + \
> +        """
> +        BR2_SYSTEM_DHCP="eth0"
> +        # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
> +        BR2_TARGET_ROOTFS_SQUASHFS=y
> +        """
> +
> +    def test_run(self):
> +        self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
> +        self.check_init()
> +
> +
> +class TestInitSystemOpenrcRwFull(InitSystemOpenrcBase):
> +    config = InitSystemOpenrcBase.config + \
> +        """
> +        BR2_SYSTEM_DHCP="eth0"
> +        BR2_TARGET_ROOTFS_EXT2=y
> +        """
> +
> +    def test_run(self):
> +        self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
> +        self.check_init()
> -- 
> 2.18.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests
  2020-03-01 17:39   ` Yann E. MORIN
@ 2020-03-03 11:59     ` Carlos Santos
  0 siblings, 0 replies; 16+ messages in thread
From: Carlos Santos @ 2020-03-03 11:59 UTC (permalink / raw)
  To: buildroot

On Sun, Mar 1, 2020 at 2:40 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Carlos, Adam, All,
>
> On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> > From: Adam Duskett <Aduskett@gmail.com>
> >
> > Two simple tests to ensure that openrc boots without any services crashing
> > with a read only and a read write filing system.
> >
> > Signed-off-by: Adam Duskett <Aduskett@gmail.com>
> > Signed-off-by: Carlos Santos <unixmania@gmail.com>
>
> Thanks for this new runtime test! :-)
>
> Would it make sense to apply just this test to master? Or does it really
> need the version bump first?
>
> Regards,
> Yann E. MORIN.
>
> > ---
> >  .gitlab-ci.yml                            |  2 +
> >  support/testing/tests/init/test_openrc.py | 51 +++++++++++++++++++++++
> >  2 files changed, 53 insertions(+)
> >  create mode 100644 support/testing/tests/init/test_openrc.py
> >
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index b4dad3173e..382a7c59b2 100644
> > --- a/.gitlab-ci.yml
> > +++ b/.gitlab-ci.yml
> > @@ -368,6 +368,8 @@ tests.init.test_busybox.TestInitSystemBusyboxRoNet: { extends: .runtime_test }
> >  tests.init.test_busybox.TestInitSystemBusyboxRw: { extends: .runtime_test }
> >  tests.init.test_busybox.TestInitSystemBusyboxRwNet: { extends: .runtime_test }
> >  tests.init.test_none.TestInitSystemNone: { extends: .runtime_test }
> > +tests.init.test_openrc.TestInitSystemOpenrcRoFull: { extends: .runtime_test }
> > +tests.init.test_openrc.TestInitSystemOpenrcRwFull: { extends: .runtime_test }
> >  tests.init.test_systemd.TestInitSystemSystemdRoFull: { extends: .runtime_test }
> >  tests.init.test_systemd.TestInitSystemSystemdRoIfupdown: { extends: .runtime_test }
> >  tests.init.test_systemd.TestInitSystemSystemdRoNetworkd: { extends: .runtime_test }
> > diff --git a/support/testing/tests/init/test_openrc.py b/support/testing/tests/init/test_openrc.py
> > new file mode 100644
> > index 0000000000..23669a9572
> > --- /dev/null
> > +++ b/support/testing/tests/init/test_openrc.py
> > @@ -0,0 +1,51 @@
> > +import infra.basetest
> > +from tests.init.base import InitSystemBase as InitSystemBase
> > +
> > +
> > +class InitSystemOpenrcBase(InitSystemBase):
> > +    config = \
> > +        """
> > +        BR2_arm=y
> > +        BR2_TOOLCHAIN_EXTERNAL=y
> > +        BR2_INIT_OPENRC=y
> > +        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> > +        BR2_LINUX_KERNEL=y
> > +        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> > +        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.5.7"
> > +        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
> > +        BR2_LINUX_KERNEL_DTS_SUPPORT=y
> > +        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
> > +        # BR2_TARGET_ROOTFS_TAR is not set
> > +        """
> > +
> > +    def check_init(self):
> > +        super(InitSystemOpenrcBase, self)
> > +
> > +        # Test all services are OK
> > +        output, _ = self.emulator.run("rc-status -c")
> > +        self.assertEqual(len(output), 0)
> > +
> > +
> > +class TestInitSystemOpenrcRoFull(InitSystemOpenrcBase):
> > +    config = InitSystemOpenrcBase.config + \
> > +        """
> > +        BR2_SYSTEM_DHCP="eth0"
> > +        # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
> > +        BR2_TARGET_ROOTFS_SQUASHFS=y
> > +        """
> > +
> > +    def test_run(self):
> > +        self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
> > +        self.check_init()
> > +
> > +
> > +class TestInitSystemOpenrcRwFull(InitSystemOpenrcBase):
> > +    config = InitSystemOpenrcBase.config + \
> > +        """
> > +        BR2_SYSTEM_DHCP="eth0"
> > +        BR2_TARGET_ROOTFS_EXT2=y
> > +        """
> > +
> > +    def test_run(self):
> > +        self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
> > +        self.check_init()
> > --
> > 2.18.2
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot at busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot

The test is very simple and does not depend on any new openrc feature.
I think it's safe to apply it on master.

-- 
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service unixmania at gmail.com
@ 2020-03-11 16:52   ` Yann E. MORIN
  2020-03-11 17:04     ` Carlos Santos
  0 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2020-03-11 16:52 UTC (permalink / raw)
  To: buildroot

Carlos, All,

On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> From: Carlos Santos <unixmania@gmail.com>
> 
> In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
> create a /sbin/getty symlink pointing to the actual program, so make the
> agetty service use that path instead of /sbin/agetty.
> 
> Also start agetty after all other services, to prevent mixing startup
> messages with the getty prompt on devices with a single serial console.
> 
> This allows us to drop the custom getty service, which causes an error
> message from openrc 0.42.1 (in a forthcoming patch):
> 
>     Error: getty is the name of a real and virtual service.
> 
> The patches are required because it's not possible to override the
> command or startup order by means of a configuration file. Anyway it's
> still better to patch something maintained upstream than depending on a
> custom piece that may easily become obsolete.
> 
> Signed-off-by: Carlos Santos <unixmania@gmail.com>

Applied to master, thanks.

It is to be noted, however, that util-linux' agetty is optional (with
BR2_PACKAGE_UTIL_LINUX_AGETTY), but the problem was pre-existing, so
it's not a problem of your patch.

I wonder anyway if we should not try to fix that somehow?

Regards,
Yann E. MORIN.

> ---
> CC: Adam Duskett <Aduskett@gmail.com>
> ---
>  ...ty-replace-sbin-agetty-by-sbin-getty.patch | 33 +++++++++++++++++++
>  ...getty-start-agetty-after-all-sevices.patch | 29 ++++++++++++++++
>  package/openrc/getty                          | 24 --------------
>  package/openrc/openrc.mk                      |  8 ++---
>  4 files changed, 65 insertions(+), 29 deletions(-)
>  create mode 100644 package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
>  create mode 100644 package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
>  delete mode 100755 package/openrc/getty
> 
> diff --git a/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch b/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
> new file mode 100644
> index 0000000000..feeff22254
> --- /dev/null
> +++ b/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
> @@ -0,0 +1,33 @@
> +From b39ab180358ed451eae9df900f49a72ef1eb7442 Mon Sep 17 00:00:00 2001
> +From: Carlos Santos <unixmania@gmail.com>
> +Date: Sun, 1 Mar 2020 09:04:48 -0300
> +Subject: [PATCH] init.d/agetty: replace /sbin/agetty by /sbin/getty
> +
> +In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
> +create a /sbin/getty symlink pointing to the actual program, so make the
> +agetty service use that path instead of /sbin/agetty.
> +
> +The patch is required because it's not possible to override the command
> +by means of a configuration file.
> +
> +Signed-off-by: Carlos Santos <unixmania@gmail.com>
> +---
> + init.d/agetty.in | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/init.d/agetty.in b/init.d/agetty.in
> +index e4866f7a..e1864628 100644
> +--- a/init.d/agetty.in
> ++++ b/init.d/agetty.in
> +@@ -14,7 +14,7 @@ supervisor=supervise-daemon
> + port="${RC_SVCNAME#*.}"
> + respawn_period="${respawn_period:-60}"
> + term_type="${term_type:-linux}"
> +-command=/sbin/agetty
> ++command=/sbin/getty
> + command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
> + pidfile="/run/${RC_SVCNAME}.pid"
> + 
> +-- 
> +2.18.2
> +
> diff --git a/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch b/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
> new file mode 100644
> index 0000000000..f1c927a450
> --- /dev/null
> +++ b/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
> @@ -0,0 +1,29 @@
> +From c2dc04f6b8c6784941b896e0b17c160dd43a566f Mon Sep 17 00:00:00 2001
> +From: Carlos Santos <unixmania@gmail.com>
> +Date: Sun, 1 Mar 2020 11:14:37 -0300
> +Subject: [PATCH] init.d/agetty: start agetty after all services
> +
> +This is required for Buildroot, to prevent mixing service initialization
> +messages with the getty prompt on devices with a single serial console.
> +
> +Signed-off-by: Carlos Santos <unixmania@gmail.com>
> +---
> + init.d/agetty.in | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/init.d/agetty.in b/init.d/agetty.in
> +index e1864628..a1ad4e9f 100644
> +--- a/init.d/agetty.in
> ++++ b/init.d/agetty.in
> +@@ -19,7 +19,7 @@ command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
> + pidfile="/run/${RC_SVCNAME}.pid"
> + 
> + depend() {
> +-	after local
> ++	after *
> + 	keyword -prefix
> + 	provide getty
> + }
> +-- 
> +2.18.2
> +
> diff --git a/package/openrc/getty b/package/openrc/getty
> deleted file mode 100755
> index 8fcb071f8a..0000000000
> --- a/package/openrc/getty
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#!/sbin/openrc-run
> -# based on agetty service from OpenRC package
> -
> -description="start getty on terminal"
> -supervisor=supervise-daemon
> -port="${RC_SVCNAME#*.}"
> -term_type="${term_type:-linux}"
> -command=/sbin/getty
> -command_args_foreground="${getty_options} ${baud} ${port} ${term_type}"
> -pidfile="/run/${RC_SVCNAME}.pid"
> -
> -depend() {
> -	# start getty at the very end of init
> -	after *
> -	keyword -prefix
> -}
> -
> -start_pre() {
> -	export EINFO_QUIET="${quiet:-yes}"
> -}
> -
> -stop_pre() {
> -	export EINFO_QUIET="${quiet:-yes}"
> -}
> diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
> index 1f8516f5ee..ce0b05e965 100644
> --- a/package/openrc/openrc.mk
> +++ b/package/openrc/openrc.mk
> @@ -68,17 +68,15 @@ endef
>  OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
>  
>  ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
> -OPENRC_GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT)
> +OPENRC_GETTY_SVCNAME = agetty.$(SYSTEM_GETTY_PORT)
>  OPENRC_GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(OPENRC_GETTY_SVCNAME)
>  define OPENRC_SET_GETTY
>  	{ \
>  		echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\""; \
>  		echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" ; \
> -		echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
> +		echo "agetty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
>  	} > $(OPENRC_GETTY_CONF_D)
> -	$(INSTALL) -D -m 0755 $(OPENRC_PKGDIR)/getty \
> -		$(TARGET_DIR)/etc/init.d/getty
> -	ln -sf getty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
> +	ln -sf agetty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
>  	ln -sf /etc/init.d/$(OPENRC_GETTY_SVCNAME) \
>  		$(TARGET_DIR)/etc/runlevels/default/$(OPENRC_GETTY_SVCNAME)
>  endef
> -- 
> 2.18.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service
  2020-03-11 16:52   ` Yann E. MORIN
@ 2020-03-11 17:04     ` Carlos Santos
  0 siblings, 0 replies; 16+ messages in thread
From: Carlos Santos @ 2020-03-11 17:04 UTC (permalink / raw)
  To: buildroot

On Wed, Mar 11, 2020 at 1:52 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Carlos, All,
>
> On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> > From: Carlos Santos <unixmania@gmail.com>
> >
> > In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
> > create a /sbin/getty symlink pointing to the actual program, so make the
> > agetty service use that path instead of /sbin/agetty.
> >
> > Also start agetty after all other services, to prevent mixing startup
> > messages with the getty prompt on devices with a single serial console.
> >
> > This allows us to drop the custom getty service, which causes an error
> > message from openrc 0.42.1 (in a forthcoming patch):
> >
> >     Error: getty is the name of a real and virtual service.
> >
> > The patches are required because it's not possible to override the
> > command or startup order by means of a configuration file. Anyway it's
> > still better to patch something maintained upstream than depending on a
> > custom piece that may easily become obsolete.
> >
> > Signed-off-by: Carlos Santos <unixmania@gmail.com>
>
> Applied to master, thanks.
>
> It is to be noted, however, that util-linux' agetty is optional (with
> BR2_PACKAGE_UTIL_LINUX_AGETTY), but the problem was pre-existing, so
> it's not a problem of your patch.
>
> I wonder anyway if we should not try to fix that somehow?

I think nothing else is required, since /sbin/getty always points to a
valid getty program, either provided by busybox or util-linux.

The alternative would be conditionally patching, based on wetter
agetty is selected or not.

-- 
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1 unixmania at gmail.com
@ 2020-03-11 17:22   ` Yann E. MORIN
  2020-03-12  2:03     ` Carlos Santos
  0 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2020-03-11 17:22 UTC (permalink / raw)
  To: buildroot

Carlos, Al,

On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> Add a patch to prevent starting agetty on tty[1-6]. Buildroot starts a
> single getty, according to the system configuration. Also tty[1-6] may
> not even exist (e.g. embedded devices with serial consoles only).

It would be good if that was made into an upstreamable patch, e.g.:

    if test "${MKGETTYS}" != no && test "${OS}" = Linux; then \
        [...]
    fi

(or whatever they'd accept)

> Signed-off-by: Adam Duskett <Aduskett@gmail.com>
> Signed-off-by: Carlos Santos <unixmania@gmail.com>

Applied to master, thanks!

Regards,
Yann E. MORIN.

> ---
> Changes v1->v2:
>   - Fix agetty issue
> ---
>  ...-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch | 34 +++++++++++++++++++
>  package/openrc/openrc.hash                    |  2 +-
>  package/openrc/openrc.mk                      |  2 +-
>  3 files changed, 36 insertions(+), 2 deletions(-)
>  create mode 100644 package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch
> 
> diff --git a/package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch b/package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch
> new file mode 100644
> index 0000000000..733506ada9
> --- /dev/null
> +++ b/package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch
> @@ -0,0 +1,34 @@
> +From 014dc43447fa553e875984ac4a528e5916cc9e06 Mon Sep 17 00:00:00 2001
> +From: Carlos Santos <unixmania@gmail.com>
> +Date: Sat, 29 Feb 2020 22:41:30 -0300
> +Subject: [PATCH] runlevels: do not add agetty.tty[1-6] if MKSYSVINIT=yes
> +
> +Buildroot starts a single getty, according to the system configuration.
> +Also tty[1-6] may not exist (e.g. embedded devices with serial consoles
> +only).
> +
> +Signed-off-by: Carlos Santos <unixmania@gmail.com>
> +---
> + runlevels/Makefile | 6 ------
> + 1 file changed, 6 deletions(-)
> +
> +diff --git a/runlevels/Makefile b/runlevels/Makefile
> +index 73843d8b..dbfb59ca 100644
> +--- a/runlevels/Makefile
> ++++ b/runlevels/Makefile
> +@@ -90,12 +90,6 @@ install:
> + 			fi; \
> + 			ln -snf ${INITDIR}/"$$x" ${SHUTDOWNDIR}/"$$x" || exit $$?; done \
> + 	fi
> +-	if test "${MKSYSVINIT}" = yes && test "${OS}" = Linux; then \
> +-		for x in tty1 tty2 tty3 tty4 tty5 tty6; do \
> +-			ln -snf ${INITDIR}/agetty ${DESTDIR}/${INITDIR}/"agetty.$$x" || exit $$?; \
> +-			ln -snf ${INITDIR}/agetty.$$x ${DEFAULTDIR}/"agetty.$$x" || exit $$?; \
> +-		done; \
> +-	fi
> + 
> + check test::
> + 
> +-- 
> +2.18.2
> +
> diff --git a/package/openrc/openrc.hash b/package/openrc/openrc.hash
> index 7d58e254c4..bb5880806d 100644
> --- a/package/openrc/openrc.hash
> +++ b/package/openrc/openrc.hash
> @@ -1,3 +1,3 @@
>  # Locally calculated
> -sha256	c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4	openrc-0.41.2.tar.gz
> +sha256	91a01ca6d930a0688fb91338209985de57cac7aa2d37feddacb78fd3d95308e2	openrc-0.42.1.tar.gz
>  sha256	96862463f4e77e2508e4fc2c83773fd24807cb699368b63fd93a5e2b466dd624	LICENSE
> diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
> index ce0b05e965..6057451bfe 100644
> --- a/package/openrc/openrc.mk
> +++ b/package/openrc/openrc.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -OPENRC_VERSION = 0.41.2
> +OPENRC_VERSION = 0.42.1
>  OPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
>  OPENRC_LICENSE = BSD-2-Clause
>  OPENRC_LICENSE_FILES = LICENSE
> -- 
> 2.18.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support unixmania at gmail.com
@ 2020-03-11 17:26   ` Yann E. MORIN
  2020-03-11 17:35     ` Yann E. MORIN
  2020-04-16  2:20     ` Carlos Santos
  0 siblings, 2 replies; 16+ messages in thread
From: Yann E. MORIN @ 2020-03-11 17:26 UTC (permalink / raw)
  To: buildroot

Carlos, All,

On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> If the libselinux package is selected, add the package to the dependency list
> and explicitly set OPENRC_MAKE_OPTS += MKSELINUX=yes

This SELinux stuff has always been a bit boo-I-dont-want-too-touch for
me, because it looks overly complex, so just adding the dependency
without explanations on how openrc uses/fits with SELinux is a bit too
much for me to handle, so I defer to a SELinux-knowledgeable maintainer
to look a it...

Regards,
Yann E. MORIN.

> Signed-off-by: Adam Duskett <Aduskett@gmail.com>
> Signed-off-by: Carlos Santos <unixmania@gmail.com>
> ---
>  package/openrc/openrc.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
> index 6057451bfe..97536dad37 100644
> --- a/package/openrc/openrc.mk
> +++ b/package/openrc/openrc.mk
> @@ -18,7 +18,6 @@ OPENRC_MAKE_OPTS = \
>  	LIBNAME=lib \
>  	LIBEXECDIR=/usr/libexec/rc \
>  	MKPKGCONFIG=no \
> -	MKSELINUX=no \
>  	MKSYSVINIT=yes \
>  	BRANDING="Buildroot $(BR2_VERSION_FULL)" \
>  	CC=$(TARGET_CC)
> @@ -29,6 +28,13 @@ else
>  OPENRC_MAKE_OPTS += MKSTATICLIBS=yes
>  endif
>  
> +ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
> +OPENRC_MAKE_OPTS += MKSELINUX=yes
> +OPENRC_DEPENDENCIES += libselinux
> +else
> +OPENRC_MAKE_OPTS += MKSELINUX=no
> +endif
> +
>  define OPENRC_BUILD_CMDS
>  	$(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
>  endef
> -- 
> 2.18.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support
  2020-03-11 17:26   ` Yann E. MORIN
@ 2020-03-11 17:35     ` Yann E. MORIN
  2020-04-16  2:41       ` Carlos Santos
  2020-04-16  2:20     ` Carlos Santos
  1 sibling, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2020-03-11 17:35 UTC (permalink / raw)
  To: buildroot

CArlos, Adam, All,

On 2020-03-11 18:26 +0100, Yann E. MORIN spake thusly:
> On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> > From: Adam Duskett <Aduskett@gmail.com>
> > If the libselinux package is selected, add the package to the dependency list
> > and explicitly set OPENRC_MAKE_OPTS += MKSELINUX=yes
> 
> This SELinux stuff has always been a bit boo-I-dont-want-too-touch for
> me, because it looks overly complex, so just adding the dependency
> without explanations on how openrc uses/fits with SELinux is a bit too
> much for me to handle, so I defer to a SELinux-knowledgeable maintainer
> to look a it...

WHAT I forgot to say above the current commit log, is that it is not
that helpful: it just repeats in english what the patch does, which is
anyway already pretty trivial to see... What a commit log should say, is
why the patch exists, and how the patch works.

Totally hypotetical commit log:

    package/openrc: add libselinux support

    OpenRC has suport for SELinux contexts, but we currently forcibly
    disable it.

    When SELinux is enabled, we know a policy will be installed, so we
    can enable SELinux support in OpenRC.

    Signed-off-by: you
    Signed-off-by: the other

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests
  2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests unixmania at gmail.com
  2020-03-01 17:39   ` Yann E. MORIN
@ 2020-03-11 17:50   ` Yann E. MORIN
  1 sibling, 0 replies; 16+ messages in thread
From: Yann E. MORIN @ 2020-03-11 17:50 UTC (permalink / raw)
  To: buildroot

Carlos, All,

On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> Two simple tests to ensure that openrc boots without any services crashing
> with a read only and a read write filing system.
> 
> Signed-off-by: Adam Duskett <Aduskett@gmail.com>
> Signed-off-by: Carlos Santos <unixmania@gmail.com>

Applied to master, but see some comments below...

> ---
>  .gitlab-ci.yml                            |  2 +
>  support/testing/tests/init/test_openrc.py | 51 +++++++++++++++++++++++
>  2 files changed, 53 insertions(+)
>  create mode 100644 support/testing/tests/init/test_openrc.py
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index b4dad3173e..382a7c59b2 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -368,6 +368,8 @@ tests.init.test_busybox.TestInitSystemBusyboxRoNet: { extends: .runtime_test }
>  tests.init.test_busybox.TestInitSystemBusyboxRw: { extends: .runtime_test }
>  tests.init.test_busybox.TestInitSystemBusyboxRwNet: { extends: .runtime_test }
>  tests.init.test_none.TestInitSystemNone: { extends: .runtime_test }
> +tests.init.test_openrc.TestInitSystemOpenrcRoFull: { extends: .runtime_test }
> +tests.init.test_openrc.TestInitSystemOpenrcRwFull: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRoFull: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRoIfupdown: { extends: .runtime_test }
>  tests.init.test_systemd.TestInitSystemSystemdRoNetworkd: { extends: .runtime_test }
> diff --git a/support/testing/tests/init/test_openrc.py b/support/testing/tests/init/test_openrc.py
> new file mode 100644
> index 0000000000..23669a9572
> --- /dev/null
> +++ b/support/testing/tests/init/test_openrc.py
> @@ -0,0 +1,51 @@
> +import infra.basetest
> +from tests.init.base import InitSystemBase as InitSystemBase
> +
> +
> +class InitSystemOpenrcBase(InitSystemBase):
> +    config = \
> +        """
> +        BR2_arm=y
> +        BR2_TOOLCHAIN_EXTERNAL=y
> +        BR2_INIT_OPENRC=y
> +        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> +        BR2_LINUX_KERNEL=y

Why can't we use the pre-built kernel?

> +        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.5.7"
> +        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
> +        BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
> +        # BR2_TARGET_ROOTFS_TAR is not set
> +        """
> +
> +    def check_init(self):
> +        super(InitSystemOpenrcBase, self)

I'm not sure what this is supposed to achieve... Did you forget to
append the actual call to the super's check_init():

    super(InitSystemOpenrcBase, self).check_init('/sbin/openrc-init')

I've fixed that and applied, but I'd still like some feedback at least
on the kernel question, above.

Regards,
Yann E. MORIN.

> +        # Test all services are OK
> +        output, _ = self.emulator.run("rc-status -c")
> +        self.assertEqual(len(output), 0)
> +
> +
> +class TestInitSystemOpenrcRoFull(InitSystemOpenrcBase):
> +    config = InitSystemOpenrcBase.config + \
> +        """
> +        BR2_SYSTEM_DHCP="eth0"
> +        # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
> +        BR2_TARGET_ROOTFS_SQUASHFS=y
> +        """
> +
> +    def test_run(self):
> +        self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
> +        self.check_init()
> +
> +
> +class TestInitSystemOpenrcRwFull(InitSystemOpenrcBase):
> +    config = InitSystemOpenrcBase.config + \
> +        """
> +        BR2_SYSTEM_DHCP="eth0"
> +        BR2_TARGET_ROOTFS_EXT2=y
> +        """
> +
> +    def test_run(self):
> +        self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
> +        self.check_init()
> -- 
> 2.18.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1
  2020-03-11 17:22   ` Yann E. MORIN
@ 2020-03-12  2:03     ` Carlos Santos
  0 siblings, 0 replies; 16+ messages in thread
From: Carlos Santos @ 2020-03-12  2:03 UTC (permalink / raw)
  To: buildroot

On Wed, Mar 11, 2020 at 2:22 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Carlos, Al,
>
> On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> > From: Adam Duskett <Aduskett@gmail.com>
> >
> > Add a patch to prevent starting agetty on tty[1-6]. Buildroot starts a
> > single getty, according to the system configuration. Also tty[1-6] may
> > not even exist (e.g. embedded devices with serial consoles only).
>
> It would be good if that was made into an upstreamable patch, e.g.:
>
>     if test "${MKGETTYS}" != no && test "${OS}" = Linux; then \
>         [...]
>     fi
>

Done: https://github.com/OpenRC/openrc/pull/355

-- 
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support
  2020-03-11 17:26   ` Yann E. MORIN
  2020-03-11 17:35     ` Yann E. MORIN
@ 2020-04-16  2:20     ` Carlos Santos
  1 sibling, 0 replies; 16+ messages in thread
From: Carlos Santos @ 2020-04-16  2:20 UTC (permalink / raw)
  To: buildroot

On Wed, Mar 11, 2020 at 2:26 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Carlos, All,
>
> On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> > From: Adam Duskett <Aduskett@gmail.com>
> >
> > If the libselinux package is selected, add the package to the dependency list
> > and explicitly set OPENRC_MAKE_OPTS += MKSELINUX=yes
>
> This SELinux stuff has always been a bit boo-I-dont-want-too-touch for
> me, because it looks overly complex, so just adding the dependency
> without explanations on how openrc uses/fits with SELinux is a bit too
> much for me to handle, so I defer to a SELinux-knowledgeable maintainer
> to look a it...

I tested it.

-- 
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support
  2020-03-11 17:35     ` Yann E. MORIN
@ 2020-04-16  2:41       ` Carlos Santos
  0 siblings, 0 replies; 16+ messages in thread
From: Carlos Santos @ 2020-04-16  2:41 UTC (permalink / raw)
  To: buildroot

On Wed, Mar 11, 2020 at 2:35 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> CArlos, Adam, All,
>
> On 2020-03-11 18:26 +0100, Yann E. MORIN spake thusly:
> > On 2020-03-01 12:17 -0300, unixmania at gmail.com spake thusly:
> > > From: Adam Duskett <Aduskett@gmail.com>
> > > If the libselinux package is selected, add the package to the dependency list
> > > and explicitly set OPENRC_MAKE_OPTS += MKSELINUX=yes
> >
> > This SELinux stuff has always been a bit boo-I-dont-want-too-touch for
> > me, because it looks overly complex, so just adding the dependency
> > without explanations on how openrc uses/fits with SELinux is a bit too
> > much for me to handle, so I defer to a SELinux-knowledgeable maintainer
> > to look a it...
>
> WHAT I forgot to say above the current commit log, is that it is not
> that helpful: it just repeats in english what the patch does, which is
> anyway already pretty trivial to see... What a commit log should say, is
> why the patch exists, and how the patch works.
>
> Totally hypotetical commit log:
>
>     package/openrc: add libselinux support
>
>     OpenRC has suport for SELinux contexts, but we currently forcibly
>     disable it.

OK, I will send a new patch with a better commit message and explained
how I tested it.

>     When SELinux is enabled, we know a policy will be installed, so we
>     can enable SELinux support in OpenRC.

Actually no policy is installed along with OpenRC. Enabling SELinux in
OpenRC only adds code to perform the initial policy load and set the
enforcing mode. See the security_load_policy(3) man page for
additional details.

In order to make the SELinux support useful you also need a complete
policy, currently provided by the refpolicy package, as well as the
policycoreutils (for restorecon and other utilities). I'm not sure if
those packages should be selected along with openrc (they are not
selected by systemd, for instance).

As explained in the package help, the refpolicy works for the most
part in permissive mode, only.

-- 
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-04-16  2:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-01 15:17 [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1 unixmania at gmail.com
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service unixmania at gmail.com
2020-03-11 16:52   ` Yann E. MORIN
2020-03-11 17:04     ` Carlos Santos
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1 unixmania at gmail.com
2020-03-11 17:22   ` Yann E. MORIN
2020-03-12  2:03     ` Carlos Santos
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support unixmania at gmail.com
2020-03-11 17:26   ` Yann E. MORIN
2020-03-11 17:35     ` Yann E. MORIN
2020-04-16  2:41       ` Carlos Santos
2020-04-16  2:20     ` Carlos Santos
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests unixmania at gmail.com
2020-03-01 17:39   ` Yann E. MORIN
2020-03-03 11:59     ` Carlos Santos
2020-03-11 17:50   ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.