TrungNguyen1909 / qemu-t8030

iPhone 11 emulated on QEMU
Other
2k stars 210 forks source link

Panic when restoring (Creating 7 namespaces on NAND) #63

Closed nick-botticelli closed 2 years ago

nick-botticelli commented 2 years ago

I was following the Wiki guide and was restoring the emulator, but shortly after starting the restore process, it hangs and then panics at Creating 7 namespaces on NAND.

Here is the full log from start to panic. File modification dates show that nvme.1 and nvram storage files were modified, but there still look zeroed out (except the header in nvram). My environment is macOS 12.4 on M1 MacBook Air, and I compiled the tools and code as of today. Below is my launch command.

qemu-t8030/build/qemu-system-aarch64 -s -M t8030,trustcache-filename=firmware/Firmware/038-44135-124.dmg.trustcache,ticket-filename=root_ticket.der \
-kernel firmware/kernelcache.research.iphone12b \
-dtb firmware/Firmware/all_flash/DeviceTree.n104ap.im4p \
-append "debug=0x14e kextlog=0xffff serial=3 -v -wdt=-1" \
-initrd firmware/038-44135-124.dmg \
-cpu max -smp 6 \
-m 4G -serial mon:stdio \
-drive file=nvme.1,format=raw,if=none,id=drive.1 \
-device nvme-ns,drive=drive.1,bus=nvme-bus.0,nsid=1,nstype=1,logical_block_size=4096,physical_block_size=4096 \
-drive file=nvme.2,format=raw,if=none,id=drive.2 \
-device nvme-ns,drive=drive.2,bus=nvme-bus.0,nsid=2,nstype=2,logical_block_size=4096,physical_block_size=4096 \
-drive file=nvme.3,format=raw,if=none,id=drive.3 \
-device nvme-ns,drive=drive.3,bus=nvme-bus.0,nsid=3,nstype=3,logical_block_size=4096,physical_block_size=4096 \
-drive file=nvme.4,format=raw,if=none,id=drive.4 \
-device nvme-ns,drive=drive.4,bus=nvme-bus.0,nsid=4,nstype=4,logical_block_size=4096,physical_block_size=4096 \
-drive file=nvram,if=none,format=raw,id=nvram \
-device apple-nvram,drive=nvram,bus=nvme-bus.0,nsid=5,nstype=5,id=nvram,logical_block_size=4096,physical_block_size=4096 \
-drive file=nvme.6,format=raw,if=none,id=drive.6 \
-device nvme-ns,drive=drive.6,bus=nvme-bus.0,nsid=6,nstype=6,logical_block_size=4096,physical_block_size=4096 \
-drive file=nvme.7,format=raw,if=none,id=drive.7 \
-device nvme-ns,drive=drive.7,bus=nvme-bus.0,nsid=7,nstype=8,logical_block_size=4096,physical_block_size=4096 \
-monitor telnet:127.0.0.1:1235,server,nowait
TrungNguyen1909 commented 2 years ago

Hello, this looks like a very rare issue to my experience.

Does that issue persist when you try to do it again?

nick-botticelli commented 2 years ago

Yes, it happens every time. I tried varying the ram, cpu cores, and adding bootargs but to no avail.

TrungNguyen1909 commented 2 years ago

Try running ./qemu-t8030/build/qemu-img create -f qcow2 nvme.1.qcow2 32G Then replace -drive file=nvme.1,format=raw,if=none,id=drive.1 with -drive file=nvme.1.qcow2,format=qcow2,if=none,id=drive.1

The backtrace shows that some request timed out so.

btw, switch to the qemu window occasionally so that macOS does not throttle it down.

raspiduino commented 2 years ago

How can you boot with the qcow2 format? I tried qcow2 but it always complains about out of space.

iarchiveml commented 2 years ago

You need to free up some space

nick-botticelli commented 2 years ago

Try running ./qemu-t8030/build/qemu-img create -f qcow2 nvme.1.qcow2 32G Then replace -drive file=nvme.1,format=raw,if=none,id=drive.1 with -drive file=nvme.1.qcow2,format=qcow2,if=none,id=drive.1

The backtrace shows that some request timed out so.

btw, switch to the qemu window occasionally so that macOS does not throttle it down.

This worked! At least for restoring—it eventually crashes on the next reboot (from watchdog timeout?). I might try using qcow2 for the other images when I have time tomorrow. Thank you for the help thus far. Here is a (very long) panic log if anyone is interested.

raspiduino commented 2 years ago

You need to free up some space

Really? But raw images (the things that do not have any compression) worked without any problems

nick-botticelli commented 2 years ago

You need to free up some space

Really? But raw images (the things that do not have any compression) worked without any problems

I think it's because the qcow2 images do not expand to their full size on creation.

nick-botticelli commented 2 years ago

Looks like finally adding wdt=-1 to boot-args resolved the issue, and 14.0 boots and doesn't panic. Not sure if all images needed to be qcow2 format but it seems to work regardless. Marking this issue as resolved, will open another one if necessary (e.g. on newer iOS versions). Thanks again.