initscripts: fixes for booting with busybox init
cover initscripts: fixes for booting with busybox init
From: Wenzong Fan <[email protected]>
* check for the existence of /etc/default/rcS
* minor fixes to checkroot.sh
* disable mountall.sh for busybox init
The following changes since commit 5dacc5516718efdf0a470e074a5c05b1ecf8cc15:
bitbake: main: Give a user readable error if we can't locate topdir (2017-10-31 09:09:21 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib wenzong/initscripts
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/initscripts
Wenzong Fan (3):
initscripts: Check for the existence of /etc/default/rcS
initscripts: minor fixes to checkroot.sh
initscripts: disable mountall.sh for busybox init
meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 6 +++--- meta/recipes-core/initscripts/initscripts-1.0/mountall.sh | 2 +- .../initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/urandom | 2 +- meta/recipes-core/initscripts/initscripts_1.0.bb | 11 ++++++++--- 7 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 initscripts: Check for the existence of /etc/default/rcS
From: Wenzong Fan <[email protected]>
/etc/default/rcS might be missing if the init manager is not sysvinit, we have to check for the existence of this file before sourcing it.
--- meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/mountall.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/urandom | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh +1 -1
@@ -8,7 +8,7 @@ # Short-Description: Misc and other. ### END INIT INFO -. /etc/default/rcS +[ -f /etc/default/rcS ] && . /etc/default/rcS # # Put a nologin file in /etc to prevent people from logging in before # system startup is complete.
meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh +1 -1
@@ -8,7 +8,7 @@ # Short-Description: Check all other file systems ### END INIT INFO -. /etc/default/rcS +[ -f /etc/default/rcS ] && . /etc/default/rcS # # Check the rest of the filesystems.
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +1 -1
@@ -8,7 +8,7 @@ # Short-Description: Check to root file system. ### END INIT INFO -. /etc/default/rcS +[ -f /etc/default/rcS ] && . /etc/default/rcS # # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +1 -1
@@ -9,7 +9,7 @@ # Description: ### END INIT INFO -. /etc/default/rcS +[ -f /etc/default/rcS ] && . /etc/default/rcS # # Mount local filesystems in /etc/fstab. For some reason, people
meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh +1 -1
@@ -1,6 +1,6 @@ #!/bin/sh -. /etc/default/rcS +[ -f /etc/default/rcS ] && . /etc/default/rcS [ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
meta/recipes-core/initscripts/initscripts-1.0/urandom +1 -1
@@ -15,7 +15,7 @@ test -c /dev/urandom || exit 0 RANDOM_SEED_FILE=/var/lib/urandom/random-seed -. /etc/default/rcS +[ -f /etc/default/rcS ] && . /etc/default/rcS [ -f /etc/default/urandom ] && . /etc/default/urandom case "$1" in
Signature · 1 line
2.11.0
PATCH 2/3 initscripts: minor fixes to checkroot.sh
In reply to [email protected]From: Wenzong Fan <[email protected]>
Fix checkroot.sh issue while booting:
sh: no: unknown operand
--- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +2 -2
@@ -74,9 +74,9 @@ test "$VERBOSE" != no && echo "Activating swap" # # Check the root filesystem. # -if test -f /fastboot || test $rootcheck = no +if test -f /fastboot || test "$rootcheck" = no then - test $rootcheck = yes && echo "Fast boot, no filesystem check" + test "$rootcheck" = yes && echo "Fast boot, no filesystem check" else # # Ensure that root is quiescent and read-only before fsck'ing.
Signature · 1 line
2.11.0
PATCH 3/3 initscripts: disable mountall.sh for busybox init
In reply to [email protected]From: Wenzong Fan <[email protected]>
Disable 'mountall.sh' to avoid system halt while the init manager is set as 'busybox'.
In busybox init, the 'SIGUSR1' was handled as 'halt', calling to the 'mountall.sh' would trigger the signal with:
+ kill -USR1 1
This works fine for sysvinit but will fail with the busybox init.
As a replacement, busybox provides 'inittab' to mount all of those:
::sysinit:/bin/mount -t proc proc /proc ::sysinit:/bin/mount -t sysfs sysfs /sys ::sysinit:/bin/mount -t devtmpfs devtmpfs /dev ::sysinit:/bin/mount -o remount,rw / ::sysinit:/bin/mkdir -p /dev/pts
::sysinit:/bin/mount -t devpts devpts /dev/pts ::sysinit:/bin/mount -a
--- meta/recipes-core/initscripts/initscripts_1.0.bb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
meta/recipes-core/initscripts/initscripts_1.0.bb +8 -3
@@ -8,13 +8,13 @@ PR = "r155" INHIBIT_DEFAULT_DEPS = "1" +MOUNTALL_SH = "${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','busybox','','file://mountall.sh',d)}" SRC_URI = "file://functions \ file://halt \ file://umountfs \ file://devpts.sh \ file://devpts \ file://hostname.sh \ - file://mountall.sh \ file://banner.sh \ file://bootmisc.sh \ file://mountnfs.sh \
@@ -35,6 +35,7 @@ SRC_URI = "file://functions \ file://dmesg.sh \ file://logrotate-dmesg.conf \ ${@bb.utils.contains('DISTRO_FEATURES','selinux','file://sushell','',d)} \ + ${MOUNTALL_SH} \ " S = "${WORKDIR}"
@@ -88,7 +89,9 @@ do_install () { install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d + if [ -n "${MOUNTALL_SH}" ]; then + install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d + fi install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/rmnologin.sh ${D}${sysconfdir}/init.d
@@ -136,7 +139,9 @@ do_install () { update-rc.d -r ${D} save-rtc.sh start 25 0 6 . update-rc.d -r ${D} banner.sh start 02 S . update-rc.d -r ${D} checkroot.sh start 06 S . - update-rc.d -r ${D} mountall.sh start 03 S . + if [ -n "${MOUNTALL_SH}" ]; then + update-rc.d -r ${D} mountall.sh start 03 S . + fi update-rc.d -r ${D} hostname.sh start 39 S . update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 . update-rc.d -r ${D} bootmisc.sh start 36 S .
Signature · 1 line
2.11.0
Re: [PATCH 3/3] initscripts: disable mountall.sh for busybox init
Hello,
Quoted 8 lines · On Wed, Nov 1, 2017 at 4:04 AM, <[email protected]> wrote:
From: Wenzong Fan <[email protected]>
Disable '
mountall.sh' to avoid system halt while the init manager is set as 'busybox'.In busybox init, the 'SIGUSR1' was handled as 'halt', calling to the '
mountall.sh' would trigger the signal with:
+ kill -USR1 1
Wouldn't be better to add the signal handler for it?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH 3/3] initscripts: disable mountall.sh for busybox init
Quoted 5 lines · Otavio Salvador
Hello,
Quoted 2 lines · On Wed, Nov 1, 2017 at 4:04 AM, <[email protected]> wrote:
From: Wenzong Fan <[email protected]>
Quoted 8 lines
Quoted 6 lines
Disable '
mountall.sh' to avoid system halt while the init manager is set as 'busybox'.In busybox init, the 'SIGUSR1' was handled as 'halt', calling to the '
mountall.sh' would trigger the signal with:
+ kill -USR1 1Wouldn't be better to add the signal handler for it?
There's the handler in busybox-1.24.1/init/init.c:
788 /* The SIGPWR/SIGUSR[12]/SIGTERM handler */ 789 static void halt_reboot_pwoff(int sig) NORETURN; 790 static void halt_reboot_pwoff(int sig) 791 {
...
803 run_shutdown_and_kill_processes();
...
817 }
I think it was intended to halt the system.
Thanks
Wenzong
Quoted 1 line
Re: [PATCH 3/3] initscripts: disable mountall.sh for busybox init
Quoted 32 lines · wenzong fan
Quoted 10 lines · Otavio Salvador
Hello,
Quoted 6 lines · On Wed, Nov 1, 2017 at 4:04 AM, <[email protected]> wrote:
From: Wenzong Fan <[email protected]>
Disable '
mountall.sh' to avoid system halt while the init manager is set as 'busybox'.Quoted 6 lines
Quoted 3 lines
In busybox init, the 'SIGUSR1' was handled as 'halt', calling to the '
mountall.sh' would trigger the signal with:
+ kill -USR1 1Wouldn't be better to add the signal handler for it?
There's the handler in
busybox-1.24.1/init/init.c:788 /* The SIGPWR/SIGUSR[12]/SIGTERM handler */ 789 static void
halt_reboot_pwoff(int sig)NORETURN; 790 static voidhalt_reboot_pwoff(int sig)791 {
...
803run_shutdown_and_kill_processes();
...
817 }
Quoted 1 line
I think it was intended to halt the system.
Ok; but what mountall will offer to OE-Core then?
If we use systemd, it all another way to provide the same. So why not dropping it?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Re: [PATCH 3/3] initscripts: disable mountall.sh for busybox init
Quoted 33 lines · Otavio Salvador
Quoted 32 lines · wenzong fan
Quoted 10 lines · Otavio Salvador
Hello,
Quoted 6 lines · On Wed, Nov 1, 2017 at 4:04 AM, <[email protected]> wrote:
From: Wenzong Fan <[email protected]>
Disable '
mountall.sh' to avoid system halt while the init manager is set as 'busybox'.Quoted 6 lines
Quoted 3 lines
In busybox init, the 'SIGUSR1' was handled as 'halt', calling to the '
mountall.sh' would trigger the signal with:
+ kill -USR1 1Wouldn't be better to add the signal handler for it?
There's the handler in
busybox-1.24.1/init/init.c:788 /* The SIGPWR/SIGUSR[12]/SIGTERM handler */ 789 static void halt_reboot_pwoff(int sig) NORETURN; 790 static void halt_reboot_pwoff(int sig) 791 { ... 803 run_shutdown_and_kill_processes(); ... 817 }
Quoted 7 lines
Quoted 1 line
I think it was intended to halt the system.
Ok; but what mountall will offer to OE-Core then?
If we use systemd, it all another way to provide the same. So why not dropping it?
We can drop it for systemd and busybox. Actually it has been limited to be used with sysvinit only from the packagegroup-core-boot.bb:
+ SYSVINIT_SCRIPTS = "${@bb.utils.contains('MACHINE_FEATURES', 'rtc', '${VIRTUAL-RUNTIME_base-utils-hwclock}', '', d)} \
+ modutils-initscripts \
+ init-ifupdown \
+ ${VIRTUAL-RUNTIME_initscripts} \
"+ RDEPENDS_${PN} = "\
+ ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
+ ...
+"
Please ignore my patches, they fix the issues for "busybox + initscrtipts" which won't be supported again.
Thanks
Wenzong
busybox init is not intended to be used with initscripts, which is for sysvinit. Please check packagegroup-core-boot.bb for more info.
Best Regards,
Chen Qi
Quoted 29 lines · On 11/01/2017 02:04 PM, [email protected] wrote:
From: Wenzong Fan <[email protected]>
* check for the existence of
/etc/default/rcS
* minor fixes tocheckroot.sh
* disablemountall.shfor busybox initThe following changes since commit
5dacc5516718efdf0a470e074a5c05b1ecf8cc15:bitbake: main: Give a user readable error if we can't locate topdir (2017-10-31 09:09:21 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contribwenzong/initscripts
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/initscriptsWenzong Fan (3):
initscripts: Check for the existence of/etc/default/rcS
initscripts: minor fixes tocheckroot.sh
initscripts: disablemountall.shfor busybox initmeta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 6 +++--- meta/recipes-core/initscripts/initscripts-1.0/mountall.sh | 2 +- .../initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 2 +- meta/recipes-core/initscripts/initscripts-1.0/urandom | 2 +- meta/recipes-core/initscripts/initscripts_1.0.bb | 11 ++++++++--- 7 files changed, 16 insertions(+), 11 deletions(-)