Power & Source of Big Ideas

HELP: Installing core-qte onto emmc -> rootfs corrupt

Moderators: chensy, FATechsupport

Hello,

I've run into a severe issue trying to flash your core-qte image onto emmc using the eflasher:

While the flashing process completes normally without any error messages, the ext4 root filesystem on emmc is corrupt afterwards. You will not notice this immediately, as the filesystem, even though corrupt "under the hoods", is still good enough to make the NanoPC-T3 boot normally and run the QtEmbedded test app just fine, but once you start doing a larger number of write operations to the root device on emmc, you will sooner or later horribly fail (on next reboot at the latest)...

I tracked this error further down as follows:

The attached script session output shows some commands that I issued from the eflasher environment, i.e. immediately after successful completion of the flashing task.

/dev/mmcblk1p1 (mountpoint: /boot) reports being clean on fsck.ext4, and this can indeed be confirmed by forcing a check with "-f".

But for /dev/mmcblk1p2 (mountpoint: /) aka rootfs, the "normal" fsck.ext4 also reports the partition to be clean, but this is a lie: When the file system check is forced with "-f", you see literally thousands of errors on the filesystem, i.e. it is severely corrupt... :cry:
typescript.zip
Output from running fsck.ext4 against emmc for core-qte
(11.4 KiB) Downloaded 110 times

I have managed to track this down a little further: To me, it looks like the file "images\core-qte\rootfs.img" itself is not corrupt: its md5 matches the md5 on your server. Also, the plain ext4 partition image that results from running the "simg2img" tool on the "sparse" image (rootfs.img) - resulting in the raw image (rootfs.img.raw) - passes a forced fsck.ext4 file system check just fine:

"fsck.ext4 -fn rootfs.img.raw" indeed reports the raw partition image as being free of errors.

So I assume that the bug seems to be hidden in "sd_update", your proprietary binary tool which seems to be used to write a sparse image onto a partition slot.

Can you please reproduce this, and then track the bug down to its root cause and fix it. In the meantime, please comment on whether the following workaround would be vaild:

1) expand sparse rootfs.img with simg2img to raw image rootfs.img.raw
2) directly write raw image onto /dev/mmcblk1p2 using dd (using which parameters?)
3) running resize2fs on /dev/mmcblk1p2

Many thanks for your kind help!
Best regards,
awl
I've continued some more testing and can now reply to my own question:

whether the following workaround would be vaild:
1) expand sparse rootfs.img with simg2img to raw image rootfs.img.raw
2) directly write raw image onto /dev/mmcblk1p2 using dd (using which parameters?)
3) running resize2fs on /dev/mmcblk1p2

I can now confirm that this workaround is valid and works fine, but in order to be really safe, I recommend to add some more steps:

1) expand sparse rootfs.img with simg2img to raw image: rootfs.img.raw
2) run "fsck.ext4 -fn rootfs.img.raw" to confirm this ext4 image is valid/not corrupt
3) directly write raw image onto /dev/mmcblk1p2 using "dd if=rootfs.img.raw of=/dev/mmcblk1p2 bs=512"
4) run "fsck.ext4 -fn /dev/mmcblk1p2" to confirm all is still well
5) run "resize2fs -p /dev/mmcblk1p2" to make the filesystem use the whole partition
6) run "fsck.ext4 -f /dev/mmcblk1p2" to fix single inode i_size error that seems to be caused by resize2fs
7) only now: sync and halt or reboot the NanoPi3 - you now have Ubuntu wily core

Please still look into what is wrong with your stock flashing mechanism (sd_update tool) anyway...

Thanks & best regards,
awl
Hello guys,
There are one easy way to flash image to eMMC, you can read wiki and download the image to use .
Flash image to eMMC with eflasher
Download eflasher

Get the eflasher utility s5p4418-eflasher-sd8g-xxx-full.img.7z and the Windows utility: win32diskimager.rar;


Flash eflasher Image

Insert an SD card(at least 4G) into a Windows PC and run the win32diskimager utility as administrator. On the utility's main window select your SD card's drive, the wanted image file and click on "write" to start flashing the SD card.

Flash image to eMMC
Insert this card into your NanoPC-T2, connect the board to an HDMI monitor or an LCD, press and hold the boot key and power on (with a 5V/2A power source) the board. After your board is powered on you will see multiple OS options and you can select an OS to start installation.
Hello jjm,

many thanks for your reply.

jjm wrote:
There are one easy way to flash image to eMMC, you can read wiki and download the image to use .
Flash image to eMMC with eflasher
I have indeed done exactly what you describe and what is documented in the wiki, but with

s5p6818-eflasher-sd4g-20160630.img (I have NanoPC-T3, so the s5p4418 version you mentioned will be wrong for me I assume)

and the files boot.img and rootfs.img from core-qte-images.tgz downloaded from the images-for-eflasher subdirectory of https://www.mediafire.com/folder/gg764iwvfm0mf/NanoPC-T3_Board

I have successfully created the SD card using Win32DiskImager and copied the two img files to images\core-qte as described. Flashing process also completes fine without any error messages.

But the issue is that this flashing process leaves me with a corrupt rootfs partition, even though all seems to have successfully completed. I was only refering to the fact that the script being used by your eflasher img uses your tool sd_update because I found out that this is what is being used "under the hoods" to flash the img file onto the partition.

So please have a look at the log file from my first post about the file system errors, and try to reproduce this issue yourself by exactly following the description in the wiki, but make sure to run fsck.ext4 -fn ("force mode") on the rootfs partition before rebooting. You will definitely find that it is indeed corrupt... :(

Looking forward for your confirmation...

Thanks & best regards,
awl
Hello @jjm and @FATechsupport,

any news on this one? Have you been able to reproduce?

Thanks & best regards,
awl
awl29 wrote:
Hello jjm,

many thanks for your reply.

jjm wrote:
There are one easy way to flash image to eMMC, you can read wiki and download the image to use .
Flash image to eMMC with eflasher
I have indeed done exactly what you describe and what is documented in the wiki, but with

s5p6818-eflasher-sd4g-20160630.img (I have NanoPC-T3, so the s5p4418 version you mentioned will be wrong for me I assume)

and the files boot.img and rootfs.img from core-qte-images.tgz downloaded from the images-for-eflasher subdirectory of https://www.mediafire.com/folder/gg764iwvfm0mf/NanoPC-T3_Board

I have successfully created the SD card using Win32DiskImager and copied the two img files to images\core-qte as described. Flashing process also completes fine without any error messages.

But the issue is that this flashing process leaves me with a corrupt rootfs partition, even though all seems to have successfully completed. I was only refering to the fact that the script being used by your eflasher img uses your tool sd_update because I found out that this is what is being used "under the hoods" to flash the img file onto the partition.

So please have a look at the log file from my first post about the file system errors, and try to reproduce this issue yourself by exactly following the description in the wiki, but make sure to run fsck.ext4 -fn ("force mode") on the rootfs partition before rebooting. You will definitely find that it is indeed corrupt... :(

Looking forward for your confirmation...

Thanks & best regards,
awl



======

Hello,
So sorry for that our wiki still have not updated , now we are updating NanoPC-T3 wiki about how to 'Boot NanoPC-T3 from eMMC'.
There is one easy way to boot the board from eMMC, first you need download :s5p6818-eflasher-sd8g-20160913-full.img file from https://www.mediafire.com/folder/gg764i ... C-T3_Board .
The ROM includes a small UbuntuCore system that can start from SD card and the latest version Debian,Android and UbuntuCore system image files.
After unziping firmware with 7z software,using Win32DiskImager tool to make one booting SD card. Insert the card into your NanoPC-T3's boot slot,and your NanoPC-T3 should connect LCD or HDMI,press and hold the boot key and power on,after boot the board you can select the system which you want to flash to eMMC.
Hello jjm,

many thanks for the update and the pointer to the new September version! 8-)
jjm wrote:
There is one easy way to boot the board from eMMC, first you need download: s5p6818-eflasher-sd8g-20160913-full.img file from https://www.mediafire.com/folder/gg764i ... C-T3_Board .
The ROM includes a small UbuntuCore system that can start from SD card and the latest version Debian,Android and UbuntuCore system image files.
I can confirm that the core-qte image written to the emmc from the new flash tool now seems to be correct (i.e. no longer corrupt: ext4fs rootfs partition check on emmc is now fine directly after flashing).

But please be warned that there still is one file system error after booting from the newly flashed emmc for the very first time: It seems that resize2fs (which is called to extend the rootfs partition to use the full 8GB emmc size) causes a single inode "i_size" error, so I recommend the following procedure:
  • Write the new s5p6818-eflasher-sd8g-20160913-full.img to a SD card (>= 8GB)
  • Boot from the SD card into the new GUI and flash Ubuntu core-qte to emmc storage from there
  • Boot from the newly flashed emmc for the first time and let it run resize2fs to resize rootfs to the fulll 8GB.
  • Then immediately shutdown one more time.
  • Reboot from the SD card one more time, and fix the filesystem error on emmc partition 2 caused by resize2fs (inode i_size error) on /dev/mmcblk1p2: fsck.ext4 -f /dev/mmcblk1p2
  • You should then be good to go and reboot from emmc without the risk to run into root file system consistency issues later... ;)
Hope this helps & best regards
awl
hi,
thank you for sharing.

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 2 guests