Package: hfsprogs Version: 332.25-11+b3 User: debian-powe...@lists.debian.org Usertags: ppc64
I experienced some major problems with hfsprogs (for ppc64) on G5 Power Macs. Once in a while (already seen multiple times on 11,2 and 7,3 type Power Macs) the OS refuses to mount the NewWorld bootstrap - or simply HFS - partition that hosts the GRUB installation at startup in read-write mode. Trying to check the HFS with `fsck.hfs` always leads to segmentation faults: ``` root@powermac-g5-2:~# dmesg | grep hfs [ 16.234586] hfs: filesystem was not cleanly unmounted, running fsck.hfs is recommended. mounting read-only. root@powermac-g5-2:~# fsck.hfs -d /dev/sda2 ** /dev/sda2 Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K. ** Checking HFS volume. Segmentation fault ``` The HFS could later be checked (and repaired) successfully from a Mac mini G4 with `fsck.hfs` from hfsprogs (for powerpc). For verification I first checked and repaired a HFS from a Mac mini G4 and then tried to check it with `fsck.hfs` from both powerpc and ppc64 versions of hfsprogs on a type 11,2 Power Mac G5: ``` ## On Mac mini G4 ################################################### root@mac-mini:~# fsck.hfs -d -f /dev/sdb2 ** /dev/sdb2 Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K. ** Checking HFS volume. ** Checking Extents Overflow file. ** Checking Catalog file. Reserved fields in the catalog record have incorrect data (4, 185) Reserved fields in the catalog record have incorrect data (4, 2) Reserved fields in the catalog record have incorrect data (4, 2) ** Checking Catalog hierarchy. ** Checking volume bitmap. ** Checking volume information. Verify Status: VIStat = 0x0000, ABTStat = 0x0000 EBTStat = 0x0000 CBTStat = 0x0200 CatStat = 0x0000 ** Repairing volume. ** Rechecking volume. ** Checking HFS volume. ** Checking Extents Overflow file. ** Checking Catalog file. ** Checking Catalog hierarchy. ** Checking volume bitmap. ** Checking volume information. ** The volume bootstrap was repaired successfully. root@mac-mini:~# echo $? 0 root@mac-mini:~# fsck.hfs -d -f /dev/sdb2 ** /dev/sdb2 Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K. ** Checking HFS volume. ** Checking Extents Overflow file. ** Checking Catalog file. ** Checking Catalog hierarchy. ** Checking volume bitmap. ** Checking volume information. ** The volume bootstrap appears to be OK. root@mac-mini:~# echo $? 0 ## On Power Mac G5 (11,2) ########################################### ## with ppc64 userland root@powermac-g5:~# dpkg -l hfsprogs Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-=========================================== ii hfsprogs 332.25-11+b3 ppc64 mkfs and fsck for HFS and HFS+ file systems root@powermac-g5:~# file /sbin/fsck.hfs /sbin/fsck.hfs: symbolic link to fsck.hfsplus root@powermac-g5:~# file /sbin/fsck.hfsplus /sbin/fsck.hfsplus: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=9e14a88ea04ea0fc8a89f3d79b039cf1daa6f3ed, stripped root@powermac-g5:~# fsck.hfs -d -f /dev/sda2 ** /dev/sda2 Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K. ** Checking HFS volume. Segmentation fault ## with powerpc userland root@powermac-g5:~# dpkg -l hfsprogs Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-=========================================== ii hfsprogs 332.25-11+b2 powerpc mkfs and fsck for HFS and HFS+ file systems root@powermac-g5:~# file /sbin/fsck.hfs /sbin/fsck.hfs: symbolic link to fsck.hfsplus root@powermac-g5:~# file /sbin/fsck.hfsplus /sbin/fsck.hfsplus: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=ce95122bcb0b56e4c1dc1b256cdf24135f6e4cad, stripped root@powermac-g5:~# fsck.hfs -d -f /dev/sda2 ** /dev/sda2 Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K. ** Checking HFS volume. ** Checking Extents Overflow file. ** Checking Catalog file. ** Checking Catalog hierarchy. ** Checking volume bitmap. ** Checking volume information. ** The volume bootstrap appears to be OK. root@powermac-g5:~# echo $? 0 ``` A run with gdb and ppc64 userland (with `fsck.hfs` with debug symbols included) yields the following information for a newly created HFS: ``` root@powermac-g5:~/hfsprogs/hfsprogs-332.25# gdb --args ./fsck_hfs.tproj/fsck_hfs -d /dev/sda2 GNU gdb (Debian 8.2-1) 8.2 [...] Reading symbols from ./fsck_hfs.tproj/fsck_hfs...done. (gdb) run Starting program: /root/hfsprogs/hfsprogs-332.25/fsck_hfs.tproj/fsck_hfs -d /dev/sda2 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1". ** /dev/sda2 Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K. ** Checking HFS volume. Program received signal SIGSEGV, Segmentation fault. 0x0000000100034be4 in hfs_swap_HFSBTInternalNode (src=0x7fffffffd2f8, fcb=0x100081898, direction=kSwapBTNodeBigToHost) at hfs_endian.c:883 883 nextRecord = (char *)src->buffer + srcOffs[i-1]; (gdb) bt #0 0x0000000100034be4 in hfs_swap_HFSBTInternalNode (src=0x7fffffffd2f8, fcb=0x100081898, direction=kSwapBTNodeBigToHost) at hfs_endian.c:883 #1 0x0000000100032f1c in hfs_swap_BTNode (src=0x7fffffffd2f8, fcb=0x100081898, direction=kSwapBTNodeBigToHost) at hfs_endian.c:307 #2 0x000000010003a478 in GetNode (btreePtr=0x100081bc8, nodeNum=1, nodePtr=0x7fffffffd2f8) at BTreeNodeOps.c:147 #3 0x000000010003beb8 in SearchTree (btreePtr=0x100081bc8, searchKey=0x7fffffffd5ac, treePathTable=0x7fffffffd428, nodeNum=0x7fffffffd3dc, nodePtr=0x7fffffffd408, returnIndex=0x7fffffffd3d8) at BTreeTreeOps.c:231 #4 0x0000000100036e20 in BTSearchRecord (filePtr=0x100081898, searchIterator=0x7fffffffd590, heuristicHint=4294967295, record=0x7fffffffd578, recordLen=0x7fffffffd866, resultIterator=0x100081c80) at BTree.c:761 #5 0x0000000100043214 in SearchBTreeRecord (fcb=0x100081898, key=0x7fffffffd880, hint=0, foundKey=0x7fffffffd88c, data=0x7fffffffd898, dataSize=0x7fffffffd866, newHint=0x7fffffffd86c) at SBTree.c:93 #6 0x0000000100013320 in CheckFileExtents (GPtr=0x7fffffffdfa0, fileNumber=4, forkType=0 '\000', attrname=0x0, extents=0x100081938, blocksUsed=0x7fffffffd980) at SVerify1.c:3103 #7 0x000000010000f07c in CreateCatalogBTreeControlBlock (GPtr=0x7fffffffdfa0) at SVerify1.c:1095 #8 0x000000010000b98c in ScavCtrl (GPtr=0x7fffffffdfa0, ScavOp=2, ScavRes=0x7fffffffdf8c) at SControl.c:395 #9 0x000000010000b228 in CheckHFS (fsReadRef=3, fsWriteRef=4, checkLevel=2, repairLevel=2, logLevel=3, guiControl=0, lostAndFoundMode=0, canWrite=1, modified=0x100072384 <fsmodified>) at SControl.c:145 #10 0x0000000100007b78 in checkfilesys (filesys=0x7ffffffffdcc "/dev/sda2") at fsck_hfs.c:323 #11 0x000000010000787c in main (argc=0, argv=0x7ffffffffa90) at fsck_hfs.c:217 (gdb) p src $1 = (BlockDescriptor *) 0x7fffffffd2f8 (gdb) p srcDesc $2 = (BTNodeDescriptor *) 0x7ffff5c91200 (gdb) p srcOffs $3 = (uint16_t *) 0x7ffff5c913fe (gdb) p sizeof(uint16_t) $4 = 2 (gdb) p sizeof(BlockDescriptor) $5 = 32 (gdb) p sizeof(BTNodeDescriptor) $6 = 14 ``` So one actually cannot repair any issue with a HFS from a G5 when using a ppc64 userland. The result is that an existing GRUB installation can no longer be upgraded on a G5 as soon as someone hits that problem. All details and examinations can be found in the threads starting with [1] and [2]. [1]: https://lists.debian.org/debian-powerpc/2018/12/msg00053.html [2]: https://lists.debian.org/debian-powerpc/2019/01/msg00006.html