Exception during QNX6 mount of images with different block size or sector size
I experience exceptions during mounting of QNX6 images that presumably use a different block size or sector size than defined in the qnx6 kaitaistruct parser definition.
Reproduce
To reproduce, I've created a minimal image on a live QNX as follows:
# uname -a
QNX localhost 7.1.0S 2024/11/01-14:27:36EDT aarch64le
# touch /tmp/image.qnx6
# mkqnx6fs -b 4096 -n 1024 /tmp/image.qnx6
The generated image is attached.
To mount this image, I've simply installed the project as described in the README.md and mounted it as follows:
$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install .
$ python3 -m qnxmount qnx6 /tmp/image.qnx6 /tmp/mountpoint/
2026-02-05 13:21:46,947 — qnxmount — INFO — Logging started
2026-02-05 13:21:46,947 — qnxmount — INFO — Python version: 3.13.11 (main, Dec 8 2025, 11:43:54) [GCC 15.2.0]
2026-02-05 13:21:46,947 — qnxmount — INFO — Script started by me on ac10
2026-02-05 13:21:46,947 — qnxmount — INFO — Called with sys.argv:
/home/me/qnxmount/qnxmount/__main__.py qnx6 /tmp/image.qnx6 /tmp/mountpoint/
2026-02-05 13:21:46,961 — qnxmount — INFO — Current qnxmount version: 0.1.9
2026-02-05 13:21:46,961 — qnxmount — INFO — Selected mounter type: qnx6
2026-02-05 13:21:46,961 — qnxmount — INFO — Mounting image /tmp/image.qnx6 on mount point /tmp/mountpoint
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/me/qnxmount/qnxmount/__main__.py", line 58, in <module>
sys.exit(mount(args))
~~~~~^^^^^^
File "/home/me/qnxmount/qnxmount/__main__.py", line 18, in mount
qnx6.mount(args.image, args.mount_point, args.offset)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/qnxmount/qnxmount/qnx6/mount.py", line 132, in mount
qnx6 = FuseQNX6(stream)
File "/home/me/qnxmount/qnxmount/qnx6/mount.py", line 23, in __init__
self.qnx6fs = QNX6FS(stream)
~~~~~~^^^^^^^^
File "/home/me/qnxmount/qnxmount/qnx6/interface.py", line 29, in __init__
self.check_superblock_crc()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/me/qnxmount/qnxmount/qnx6/interface.py", line 209, in check_superblock_crc
"object": self.parser.qnx6_bootblock.superblock0,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/qnxmount/qnxmount/qnx6/parser.py", line 218, in superblock0
self._m_superblock0 = Parser.Superblock(io, self, self._root)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/qnxmount/qnxmount/qnx6/parser.py", line 79, in __init__
self._read()
~~~~~~~~~~^^
File "/home/me/qnxmount/qnxmount/qnx6/parser.py", line 84, in _read
raise kaitaistruct.ValidationNotEqualError(b"\x22\x11\x19\x68", self.magic, self._io, u"/types/superblock/seq/0")
kaitaistruct.ValidationNotEqualError: /types/superblock/seq/0: at pos 1028: validation failed: not equal, expected b'"\x11\x19h', but got b'\x00f\xd3\xe0'
Hot Fix
When I change the constant 512 in the instances part of the qnx6/parser.ksy with 4096 as follows:
(venv) me@workspace:~/qnxmount/qnxmount/qnx6$ git diff
diff --git a/qnxmount/qnx6/parser.ksy b/qnxmount/qnx6/parser.ksy
index f54cd5d..04ec090 100644
--- a/qnxmount/qnx6/parser.ksy
+++ b/qnxmount/qnx6/parser.ksy
@@ -23,19 +23,19 @@ types:
instances:
superblock0:
io: _root._io
- pos: sblk0*512
+ pos: sblk0*4096
type: superblock
superblock1:
io: _root._io
- pos: sblk1*512
+ pos: sblk1*4096
type: superblock
superblock0_raw:
io: _root._io
- pos: sblk0*512
+ pos: sblk0*4096
size: 512
superblock1_raw:
io: _root._io
- pos: sblk1*512
+ pos: sblk1*4096
size: 512
superblock:
and regenerate the parser.py code, this image can be mounted successfully.
However, I currently don't understand the QNX6 FS and kaitaistruct well enough to come up with a fix that works for all images, and I also currently don't understand what the constant 512 actually refers to.
Attachments
A minimal reproducer Image that triggers the exception is attached.
image.zip
Exception during QNX6 mount of images with different block size or sector size
I experience exceptions during mounting of QNX6 images that presumably use a different block size or sector size than defined in the qnx6 kaitaistruct parser definition.
Reproduce
To reproduce, I've created a minimal image on a live QNX as follows:
The generated image is attached.
To mount this image, I've simply installed the project as described in the README.md and mounted it as follows:
Hot Fix
When I change the constant
512in theinstancespart of theqnx6/parser.ksywith4096as follows:and regenerate the parser.py code, this image can be mounted successfully.
However, I currently don't understand the QNX6 FS and kaitaistruct well enough to come up with a fix that works for all images, and I also currently don't understand what the constant
512actually refers to.Attachments
A minimal reproducer Image that triggers the exception is attached.
image.zip