PINE64
[Solved] How I got fsck.f2fs to get unstuck and fix not booting PP - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+--- Thread: [Solved] How I got fsck.f2fs to get unstuck and fix not booting PP (/showthread.php?tid=16014)



[Solved] How I got fsck.f2fs to get unstuck and fix not booting PP - gab - 02-07-2022

My PinePhone (v1.2, 3GB running Mobian testing from eMMC) was low on battery and the red USB C cable was not perfectly plugged so it got unplugged, the PP abruptly turned off and ... it would not boot again Confused . That was the first time ever I got this problem, in 11 months of daily driving (no other phone), and a lot of drained batteries (thats bad, I know...).


tldr: to fix it I flashed Mobian on a micro sd card, then fsck.f2fs was not working but after I mounted / unmounted /dev/mmcblk2p2 I retried fsck.f2fs which then surprisingly worked and apparently fixed any problem left.


More details:

First log I got using the UART cable:


Quote:(initramfs) Begin: Will now check root file system ... fsck from util-linux 2.37.3
[/sbin/fsck.f2fs (1) -- /dev/mmcblk2p2] fsck.f2fs -a /dev/mmcblk2p2
Info: Fix the reported corruption.
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 60022751 (29307 MB)
Info: MKFS version
  "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
Info: FSCK version
  from "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
    to "Linux version 5.15-sunxi64 (salsaci@runner-2v5hjq-3-project-17289439-concurrent-0) (gcc (Debian 11.2.0-14) 11.2.0, GNU ld (GNU Binutils for Debian) 2.37.50.20220106) #1 SMP Fri Jan 21 03:21:56 UTC 2022"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 60022744 (29307 MB)
Info: CKPT version = 5439e3cc
[f2fs_do_mount:3563] record_fsync_data failed
fsck exited with status code 255
done.
Failure: File system check of the root filesystem failed
The root filesystem on /dev/mmcblk2p2 requires a manual fsck


After that here is what I would got when running fsck:


Quote:fsck /dev/mmcblk2p2
fsck from util-linux 2.37.3
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 60022751 (29307 MB)
Info: MKFS version
  "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
Info: FSCK version
  from "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
    to "Linux version 5.15-sunxi64 (salsaci@runner-2v5hjq-3-project-17289439-concurrent-0) (gcc (Debian 11.2.0-14) 11.2.0, GNU ld (GNU Binutils for Debian) 2.37.50.20220106) #1 SMP Fri Jan 21 03:21:56 UTC 2022"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 60022744 (29307 MB)
Info: CKPT version = 5439e3cc
[f2fs_do_mount:3563] record_fsync_data failed


Then I was able to mount then unmount /dev/mmcblk2p2 from Mobian running on sdcard, and I got fsck to work:


Quote:fsck from util-linux 2.37.2
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 60022751 (29307 MB)
Info: MKFS version
  "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
Info: FSCK version
  from "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
    to "Linux version 5.10-sunxi64 (builder@mobian) (gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PREEMPT Sat Aug 7 12:10:38 UTC 2021"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 60022744 (29307 MB)
Info: CKPT version = 5439e436
Info: checkpoint state = 45 :  crc compacted_summary unmount
[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0xa]
[FSCK] valid_block_count matching with CP            [Ok..] [0x27997d]
[FSCK] valid_node_count matching with CP (de lookup)  [Ok..] [0x2522a]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x2522a]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x24c4d]
[FSCK] free segment_count matched with CP            [Ok..] [0x148d]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                          [Ok..]

Done: 132.889887 secs


Then the PP was booting fine  Smile


RE: [Solved] How I got fsck.f2fs to get unstuck and fix not booting PP - gab - 02-08-2022

Strange, happened again today.

I got this from booting Mobian on sdcard:

Quote:root@mobian:/home/mobian# fsck /dev/mmcblk2p2
fsck from util-linux 2.37.2
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 60022751 (29307 MB)
Info: MKFS version
  "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
Info: FSCK version
  from "Linux version 5.9.0-5-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-1) 10.2.1 20201207, GNU ld (GNU Binutils for Debian) 2.35.1) #1 SMP Debian 5.9.15-1 (2020-12-17)"
    to "Linux version 5.10-sunxi64 (builder@mobian) (gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PREEMPT Sat Aug 7 12:10:38 UTC 2021"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 60022744 (29307 MB)
Info: CKPT version = 5439e952
[  56.014787] ov5640 4-004c: firmware upload success
[f2fs_do_mount:3563] record_fsync_data failed


then


Quote:root@mobian:/home/mobian# mkdir /media/mmcbk2p2
root@mobian:/home/mobian# mount /dev/mmcblk2p2 /media/mmcbk2p2
[  79.500869] F2FS-fs (mmcblk2p2): recover_inode: ino = 14b47, name = permissions.sqlite, inline = 1
[  79.510263] F2FS-fs (mmcblk2p2): recover_data: ino = 14b47 (i_size: keep) recovered = 16, err = 0
[  79.519219] F2FS-fs (mmcblk2p2): recover_inode: ino = 38f91, name = webappsstore.sqlite-wal, inline = 1
[  79.529627] F2FS-fs (mmcblk2p2): recover_data: ino = 38f91 (i_size: keep) recovered = 121, err = 0
[  79.538696] F2FS-fs (mmcblk2p2): recover_inode: ino = 14b7c, name = webappsstore.sqlite, inline = 1
[  79.548059] F2FS-fs (mmcblk2p2): recover_data: ino = 14b7c (i_size: keep) recovered = 24, err = 0
[  79.561690] F2FS-fs (mmcblk2p2): recover_data: ino = 14b7c (i_size: keep) recovered = 16, err = 0
[  79.570605] F2FS-fs (mmcblk2p2): recover_inode: ino = 3a147, name = 3318935238tbwe.sqlite-wal, inline = 1
[  79.580286] F2FS-fs (mmcblk2p2): recover_data: ino = 3a147 (i_size: keep) recovered = 1, err = 0
[  79.589106] F2FS-fs (mmcblk2p2): recover_inode: ino = 38f91, name = webappsstore.sqlite-wal, inline = 1
[  79.598602] F2FS-fs (mmcblk2p2): recover_data: ino = 38f91 (i_size: keep) recovered = 0, err = 0
[  79.607421] F2FS-fs (mmcblk2p2): recover_inode: ino = 3a147, name = 3318935238tbwe.sqlite-wal, inline = 1
[  79.617076] F2FS-fs (mmcblk2p2): recover_data: ino = 3a147 (i_size: keep) recovered = 3, err = 0
[  79.625899] F2FS-fs (mmcblk2p2): recover_inode: ino = 1ba3, name = 3318935238tbwe.sqlite, inline = 1
[  79.635118] F2FS-fs (mmcblk2p2): recover_data: ino = 1ba3 (i_size: keep) recovered = 0, err = 0
[  79.644860] F2FS-fs (mmcblk2p2): recover_inode: ino = 3a147, name = 3318935238tbwe.sqlite-wal, inline = 1
[  79.654520] F2FS-fs (mmcblk2p2): recover_data: ino = 3a147 (i_size: keep) recovered = 1, err = 0
[  79.674609] F2FS-fs (mmcblk2p2): checkpoint: version = 5439e953
[  79.680821] F2FS-fs (mmcblk2p2): Mounted with checkpoint version = 5439e953


This time, simply mounting / unmounting from Mobian on sdcard fixed the boot of Mobian on the eMMC.