Skip to contentSkip to conversation

image_types: preserve rootfs if mkext234fs() fails

PATCH In review Saul Wold 6 participants 10 messages Dec 19, 2017 – Dec 20, 2017

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

PATCH 1/1 image_types: preserve rootfs if mkext234fs() fails

We have seen more failures, but have not been able to directly reproduce it maybe svaing the rootfs and it contains some content that is tripping up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +6 -1
index 9188bed4197..6b4f39ed274 100644
@@ -86,9 +86,14 @@ oe_mkext234fs () {
 	bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
 	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
 	bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-	bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
+	bbdebug 1 "Actual Partion size: `ls -l ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
 	bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
 	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
+	if [ $? -ne 0 ]; then
+		tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+		cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+	fi
+
 	# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
 	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype || [ $? -le 3 ]
 }
Signature · 1 line
2.13.6
#1 lore raw
Quoted 15 lines · Saul Wold

We have seen more failures, but have not been able to directly reproduce it maybe svaing the rootfs and it contains some content that is tripping up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +0 -0
index 9188bed4197..6b4f39ed274 100644
@@ -86,9 +86,14 @@ oe_mkext234fs () {
 	bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 10 lines
meta/classes/image_types.bbclass +5 -1
 	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
 	bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-	bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
+	bbdebug 1 "Actual Partion size: `ls -l ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
 	bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
 	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
+	if [ $? -ne 0 ]; then
+		tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+		cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+	fi

Wouldn't it be better to just fail on error here, rather than dump stuff to /tmp ?

Signature · 1 line
Tom
#2 lore raw
Quoted 21 lines · Tom Rini
Quoted 20 lines · Saul Wold

We have seen more failures, but have not been able to directly reproduce it maybe svaing the rootfs and it contains some content that is tripping up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +1 -1
index 9188bed4197..6b4f39ed274 100644
@@ -86,9 +86,14 @@ oe_mkext234fs () {
      bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
      dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
      bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-     bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
+     bbdebug 1 "Actual Partion size: `ls -l ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
      bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
Quoted 8 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 5 lines
meta/classes/image_types.bbclass +4 -0
      mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
+     if [ $? -ne 0 ]; then
+             tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+             cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+     fi

Wouldn't it be better to just fail on error here, rather than dump stuff to /tmp ?

It already does fail with an error. Saving the state is temporary additional debug to help understand why.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=12304

#3 lore raw
Quoted 31 lines · Andre McCurdy
Quoted 21 lines · Tom Rini
Quoted 20 lines · Saul Wold

We have seen more failures, but have not been able to directly reproduce it maybe svaing the rootfs and it contains some content that is tripping up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +1 -1
index 9188bed4197..6b4f39ed274 100644
@@ -86,9 +86,14 @@ oe_mkext234fs () {
      bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
      dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
      bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-     bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
+     bbdebug 1 "Actual Partion size: `ls -l ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
      bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
Quoted 8 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 5 lines
meta/classes/image_types.bbclass +4 -0
      mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
+     if [ $? -ne 0 ]; then
+             tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+             cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+     fi

Wouldn't it be better to just fail on error here, rather than dump stuff to /tmp ?

Quoted 4 lines

It already does fail with an error. Saving the state is temporary additional debug to help understand why.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=12304

So the problem is with the autobuilder where everything else gets blown away. That's fine, this is an autobuilder specific work-around, not a general purpose patch and shouldn't be in mainline, would be my point.

Signature · 1 line
Tom
#4 lore raw
Quoted 43 lines · Tom Rini
Quoted 3 lines · Andre McCurdy
Quoted 2 lines · Tom Rini
Quoted 1 line · Saul Wold

We have seen more failures, but have not been able to directly

reproduce

Quoted 1 line
Quoted 1 line
Quoted 1 line

it maybe svaing the rootfs and it contains some content that is

tripping

Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines

up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/classes/image_types.bbclass

Quoted 5 lines
Quoted 5 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 86

Quoted 5 lines

index 9188bed4197..6b4f39ed274 100644

meta/classes/image_types.bbclass +0 -0
@@ -86,9 +86,14 @@ oe_mkext234fs () {
      bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_

NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 87

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
      dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_

NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024

Quoted 2 lines
Quoted 2 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 89

Quoted 2 lines
meta/classes/image_types.bbclass +0 -1
      bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-     bbdebug 1 "Actual Partion size: `ls -s

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 89

Quoted 1 line
meta/classes/image_types.bbclass +1 -0
+     bbdebug 1 "Actual Partion size: `ls -l

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 90

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
      bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 91

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
      mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype

-d ${IMAGE_ROOTFS}

Quoted 6 lines
Quoted 6 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 4 lines
meta/classes/image_types.bbclass +4 -0
+     if [ $? -ne 0 ]; then
+             tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+             cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+     fi

Wouldn't it be better to just fail on error here, rather than dump

stuff

Quoted 2 lines
Quoted 1 line

to /tmp ?

Quoted 9 lines
Quoted 4 lines

It already does fail with an error. Saving the state is temporary additional debug to help understand why.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=12304

So the problem is with the autobuilder where everything else gets blown away. That's fine, this is an autobuilder specific work-around, not a general purpose patch and shouldn't be in mainline, would be my point.

I suspect this will just hang in master-next and never merge into master.

Ross

#5 lore raw
Quoted 48 lines · Ross
Quoted 46 lines · Tom Rini
Quoted 3 lines · Andre McCurdy
Quoted 2 lines · Tom Rini
Quoted 1 line · Saul Wold

We have seen more failures, but have not been able to directly

reproduce

Quoted 1 line
Quoted 1 line
Quoted 1 line

it maybe svaing the rootfs and it contains some content that is

tripping

Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines

up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/classes/image_types.bbclass

Quoted 5 lines
Quoted 5 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 86

Quoted 5 lines

index 9188bed4197..6b4f39ed274 100644

meta/classes/image_types.bbclass +0 -0
@@ -86,9 +86,14 @@ oe_mkext234fs () {
      bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_

NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 87

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
      dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_

NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024

Quoted 2 lines
Quoted 2 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 89

Quoted 2 lines
meta/classes/image_types.bbclass +0 -1
      bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-     bbdebug 1 "Actual Partion size: `ls -s

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 89

Quoted 1 line
meta/classes/image_types.bbclass +1 -0
+     bbdebug 1 "Actual Partion size: `ls -l

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 90

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
      bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"

Quoted 1 line
Quoted 1 line

meta/classes/image_types.bbclass oe_mkext234fs () { · line 91

Quoted 1 line
meta/classes/image_types.bbclass +0 -0
      mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype

-d ${IMAGE_ROOTFS}

Quoted 6 lines
Quoted 6 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 4 lines
meta/classes/image_types.bbclass +4 -0
+     if [ $? -ne 0 ]; then
+             tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+             cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+     fi

Wouldn't it be better to just fail on error here, rather than dump

stuff

Quoted 5 lines
Quoted 1 line

to /tmp ?

It already does fail with an error. Saving the state is temporary additional debug to help understand why.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

https://bugzilla.yoctoproject.org/show_bug.cgi?id=12304

So the problem is with the autobuilder where everything else gets blown away. That's fine, this is an autobuilder specific work-around, not a general purpose patch and shouldn't be in mainline, would be my point.

I suspect this will just hang in master-next and never merge into master.

That sounds good. And I suppose at this point, it would be pretty likely to not, too. Maybe in the future we want a tag in the commit message or something to make it clear it's not for merging to master itself?

Signature · 1 line
Tom
#6 lore raw
Quoted 8 lines · Tom Rini
Quoted 2 lines · Ross

I suspect this will just hang in master-next and never merge into master.

That sounds good. And I suppose at this point, it would be pretty likely to not, too. Maybe in the future we want a tag in the commit message or something to make it clear it's not for merging to master itself?

The previous two rounds of debug for this issue are already in master, so I expect this will get merged to master too... and then all be reverted once the underlying bug is resolved.

Personally I think occasionally adding some debug to the master branch between releases is OK.

#7 lore raw
In reply to Tom Rini
Quoted 35 lines · Tom Rini
Quoted 34 lines · Saul Wold

We have seen more failures, but have not been able to directly reproduce
it maybe svaing the rootfs and it contains some content that is tripping
up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
 meta/classes/image_types.bbclass | 7 ++++++-

 1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +0 -0
index 9188bed4197..6b4f39ed274 100644
@@ -86,9 +86,14 @@ oe_mkext234fs () {

  bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
  dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
  bbdebug 1 "Actual Rootfs size:  du -s ${IMAGE_ROOTFS}"

meta/classes/image_types.bbclass +0 -1
-	bbdebug 1 "Actual Partion size: `ls -s

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"

meta/classes/image_types.bbclass +1 -0
+	bbdebug 1 "Actual Partion size: `ls -l

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`" bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
  mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d

Quoted 8 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 6 lines

${IMAGE_ROOTFS}

meta/classes/image_types.bbclass +2 -0
+	if [ $? -ne 0 ]; then
+		tmp_saved_rootfs=`mktemp -d -p /tmp

saved_rootfs.XXXXX`

meta/classes/image_types.bbclass +2 -0
+		cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+	fi

Wouldn't it be better to just fail on error here, rather than dump stuff to /tmp ?

We have a problem with a recurring issue where the image generation code is failing in the eSDK selftests. The eSDK selftests run a completely separate build which then gets cleaned up. I'm not entirely sure the best way to handle this but that is why Saul is proposing this.

It may be an idea to detect the failing selftest and then stop the cleanup in that case. That is going to be fairly invasive on the selftest code though.

I may just pull this into master-next (but not master) so at least if it fails there we have better debugging. We are struggling to get to the bottom of the issue :(.

Cheers,

Richard

#8 lore raw
Quoted 45 lines · Richard Purdie
Quoted 35 lines · Tom Rini
Quoted 34 lines · Saul Wold

We have seen more failures, but have not been able to directly reproduce
it maybe svaing the rootfs and it contains some content that is tripping
up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
  meta/classes/image_types.bbclass | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +0 -0
index 9188bed4197..6b4f39ed274 100644
@@ -86,9 +86,14 @@ oe_mkext234fs () {
  	bbdebug 1 Executing "dd if=/dev/zero

of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
  dd if=/dev/zero
of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
  bbdebug 1 "Actual Rootfs size:  du -s ${IMAGE_ROOTFS}"

meta/classes/image_types.bbclass +0 -1
-	bbdebug 1 "Actual Partion size: `ls -s

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"

meta/classes/image_types.bbclass +1 -0
+	bbdebug 1 "Actual Partion size: `ls -l

${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
  bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd
${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
  mkfs.$fstype -F $extra_imagecmd
${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d

Quoted 8 lines

meta/classes/image_types.bbclass oe_mkext234fs () { · line 95

Quoted 6 lines

${IMAGE_ROOTFS}

meta/classes/image_types.bbclass +2 -0
+	if [ $? -ne 0 ]; then
+		tmp_saved_rootfs=`mktemp -d -p /tmp

saved_rootfs.XXXXX`

meta/classes/image_types.bbclass +2 -0
+		cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
+	fi

Wouldn't it be better to just fail on error here, rather than dump stuff to /tmp ?

Quoted 8 lines

We have a problem with a recurring issue where the image generation code is failing in the eSDK selftests. The eSDK selftests run a completely separate build which then gets cleaned up. I'm not entirely sure the best way to handle this but that is why Saul is proposing this.

It may be an idea to detect the failing selftest and then stop the cleanup in that case. That is going to be fairly invasive on the

+1 on this, the cleanup makes the debug very hard when error happens.

// Robert

Quoted 11 lines

selftest code though

I may just pull this into master-next (but not master) so at least if it fails there we have better debugging. We are struggling to get to the bottom of the issue :(.

Cheers,

Richard

#9 lore raw
In reply to Saul Wold

Hi Saul,

Quoted 2 lines · Saul Wold

We have seen more failures, but have not been able to directly reproduce it maybe svaing the rootfs and it contains some content that is tripping

s/svaing/saving/.

Quoted 12 lines

up the e2fsprogs mkfs.ext4 populate_rootfs() function

---
  meta/classes/image_types.bbclass | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes/image_types.bbclass +0 -0
index 9188bed4197..6b4f39ed274 100644

meta/classes/image_types.bbclass oe_mkext234fs () { · line 94

Quoted 10 lines
meta/classes/image_types.bbclass +4 -1
@@ -86,9 +86,14 @@ oe_mkext234fs () {
  	bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
  	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
  	bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
-	bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
+	bbdebug 1 "Actual Partion size: `ls -l ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
  	bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
  	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
+	if [ $? -ne 0 ]; then
+		tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
+		cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs

Maybe save to ${WORKDIR}/tmp rather than /tmp ?

// Robert

Quoted 6 lines
meta/classes/image_types.bbclass +2 -0
+	fi
+
  	# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
  	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype || [ $? -le 3 ]
  }