Skip to contentSkip to conversation

sysvinit: fix missing of boot log

PATCH In review [email protected] 3 participants 8 messages Sep 26, 2013 – Nov 2, 2013

lore
Share & tools
lore
#0 lore raw

v2 cover sysvinit: fix missing of boot log

From: Chen Qi <[email protected]>

The following changes since commit 4d8ab87d25ea6e59dc88375813ef88ee0ac813d0:

build-appliance: Update SRCREV (2013-09-24 18:09:12 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/bootlogd
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/bootlogd

Chen Qi (1):
sysvinit: fix missing of boot log

 meta/recipes-core/sysvinit/sysvinit/bootlogd.init |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 sysvinit: fix missing of boot log

From: Chen Qi <[email protected]>

Previously, our system had no boot log even if the bootlogd daemon was started correctly. The root cause is that the log file doesn't exist when starting the bootlogd.

Add '-c' option to bootlogd so that it will create the boot log if it doesn't exist.

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.

[YOCTO #5273]

---
 meta/recipes-core/sysvinit/sysvinit/bootlogd.init |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +3 -2
index 7b87827..3a10a3c 100755
@@ -42,14 +42,15 @@ esac
 
 case "$ACTION" in
 	start)
+		mount -a -t tmpfs 2>/dev/null
 		echo -n "Starting $DESC: "
 		if [ -d /proc/1/. ]
 		then
 			umask 027
 			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -c
 		else
-			$DAEMON -r
+			$DAEMON -r -c
 		fi
 		echo "$NAME."
 		;;
Signature · 1 line
1.7.9.5
#2 lore raw

meta/recipes-core/sysvinit/sysvinit/bootlogd.init esac · line 45

Quoted 6 lines · <[email protected]> writes:

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.
...
case "$ACTION" in

meta/recipes-core/sysvinit/sysvinit/bootlogd.init +1 -0
 	start)
+		mount -a -t tmpfs 2>/dev/null

This will mount filesystems out-of-order. E.g. it will break an /etc/fstab with

| /dev/mmcblk0p1  /srv/www     ext4  default 1 1
| none            /srv/www/tmp tmpfs default 0 0

Enrico

author
#3 lore raw
Quoted 11 lines · Enrico Scholz

meta/recipes-core/sysvinit/sysvinit/bootlogd.init esac · line 45

Quoted 6 lines · <[email protected]> writes:

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.
...
case "$ACTION" in
start)

meta/recipes-core/sysvinit/sysvinit/bootlogd.init +1 -0
+		mount -a -t tmpfs 2>/dev/null

This will mount filesystems out-of-order. E.g. it will break an /etc/fstab with

Quoted 5 lines
| /dev/mmcblk0p1  /srv/www     ext4  default 1 1
| none            /srv/www/tmp tmpfs default 0 0

Enrico

Hi Enrico,

I tested with this situation just now, and everything worked out well for me. My fstab has:
/dev/hdb /media ext2 defaults 0 0
tmpfs /media/tmp tmpfs defaults 0 0

Note that udev's init script also tries to mount tmpfs. So if you used such fstab, you have already verified it yourself.

So I think we might be OK here.

Best Regards,
Chen Qi

Quoted 6 lines

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#4 lore raw
In reply to [email protected]

ping

Quoted 41 lines · On 09/26/2013 06:02 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

Previously, our system had no boot log even if the bootlogd daemon was started correctly. The root cause is that the log file doesn't exist when starting the bootlogd.

Add '-c' option to bootlogd so that it will create the boot log if it doesn't exist.

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.

[YOCTO #5273]

---
  meta/recipes-core/sysvinit/sysvinit/bootlogd.init |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +3 -2
index 7b87827..3a10a3c 100755
@@ -42,14 +42,15 @@ esac
 
  case "$ACTION" in
  	start)
+		mount -a -t tmpfs 2>/dev/null
  		echo -n "Starting $DESC: "
  		if [ -d /proc/1/. ]
  		then
  			umask 027
  			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -c
  		else
-			$DAEMON -r
+			$DAEMON -r -c
  		fi
  		echo "$NAME."
  		;;
author
#5 lore raw
In reply to [email protected]

ping

Any comment on this one?

Best Regards,
Chen Qi

Quoted 41 lines · On 09/26/2013 06:02 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

Previously, our system had no boot log even if the bootlogd daemon was started correctly. The root cause is that the log file doesn't exist when starting the bootlogd.

Add '-c' option to bootlogd so that it will create the boot log if it doesn't exist.

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.

[YOCTO #5273]

---
  meta/recipes-core/sysvinit/sysvinit/bootlogd.init |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +3 -2
index 7b87827..3a10a3c 100755
@@ -42,14 +42,15 @@ esac
 
  case "$ACTION" in
  	start)
+		mount -a -t tmpfs 2>/dev/null
  		echo -n "Starting $DESC: "
  		if [ -d /proc/1/. ]
  		then
  			umask 027
  			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -c
  		else
-			$DAEMON -r
+			$DAEMON -r -c
  		fi
  		echo "$NAME."
  		;;
#6 lore raw
Quoted 3 lines · ChenQi

ping

Any comment on this one?

Yes, shouldn't the boot ordering be tweaked to ensure the tmpfs is available rather than force mounting it within this init script? This looks like a hack around the problem rather than fixing a real issue.

The -c part is ok so please resend without the mount.

Cheers,

Richard

Quoted 50 lines

Best Regards,
Chen Qi

Quoted 31 lines · On 09/26/2013 06:02 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

Previously, our system had no boot log even if the bootlogd daemon was started correctly. The root cause is that the log file doesn't exist when starting the bootlogd.

Add '-c' option to bootlogd so that it will create the boot log if it doesn't exist.

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.

[YOCTO #5273]

---
  meta/recipes-core/sysvinit/sysvinit/bootlogd.init |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +1 -0
index 7b87827..3a10a3c 100755
@@ -42,14 +42,15 @@ esac
 
  case "$ACTION" in
  	start)
+		mount -a -t tmpfs 2>/dev/null
  		echo -n "Starting $DESC: "
  		if [ -d /proc/1/. ]
  		then

meta/recipes-core/sysvinit/sysvinit/bootlogd.init esac · line 56

Quoted 10 lines
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +2 -2
  			umask 027
  			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -c
  		else
-			$DAEMON -r
+			$DAEMON -r -c
  		fi
  		echo "$NAME."
  		;;

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#7 lore raw
Quoted 7 lines · Richard Purdie
Quoted 3 lines · ChenQi

ping

Any comment on this one?

Yes, shouldn't the boot ordering be tweaked to ensure the tmpfs is available rather than force mounting it within this init script? This looks like a hack around the problem rather than fixing a real issue.

Agree.

Currently in our project, the mountall.sh (mounting the local filesystem) starts really late at boot time. It's started after udev', checkroot.sh', modutils.sh', bootlogd' and even `urandom'. I think we should make it start before udev. In this way, the same hack in the udev's init script could also be removed.
The hack was there in udev's init script because the udev's automount rule might need to write to the /tmp directory.

I will send out a new patchset.

Best Regards,
Chen Qi

Quoted 59 lines

The -c part is ok so please resend without the mount.

Cheers,

Richard

Quoted 49 lines

Best Regards,
Chen Qi

Quoted 31 lines · On 09/26/2013 06:02 PM, [email protected] wrote:

From: Chen Qi <[email protected]>

Previously, our system had no boot log even if the bootlogd daemon was started correctly. The root cause is that the log file doesn't exist when starting the bootlogd.

Add '-c' option to bootlogd so that it will create the boot log if it doesn't exist.

Besides, we need to make sure that tmpfs has been mounted. Otherwise, the boot log will still be missing.

[YOCTO #5273]

---
   meta/recipes-core/sysvinit/sysvinit/bootlogd.init |    5 +++--
   1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +1 -0
index 7b87827..3a10a3c 100755
@@ -42,14 +42,15 @@ esac
 
   case "$ACTION" in
   	start)
+		mount -a -t tmpfs 2>/dev/null
   		echo -n "Starting $DESC: "
   		if [ -d /proc/1/. ]
   		then

meta/recipes-core/sysvinit/sysvinit/bootlogd.init esac · line 56

Quoted 10 lines
meta/recipes-core/sysvinit/sysvinit/bootlogd.init +2 -2
   			umask 027
   			start-stop-daemon --start --quiet \
-				--exec $DAEMON -- -r
+				--exec $DAEMON -- -r -c
   		else
-			$DAEMON -r
+			$DAEMON -r -c
   		fi
   		echo "$NAME."
   		;;

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core