Turris OS in QEMU

As a toy project I followed https://wiki.turris.cz/doc/en/public/running_in_qemu to put my current system (TOS 3) into QEMU, then tried manual update from TOS 3 to 5. I know it was kind of a long shot but knowing that latest medkit (TOS 5) runs fine in QEMU I thought why not. Well… it did not work :slight_smile:

A few messages from log:

2020-06-07 15:06:01 warning updater[8259]: requests.lua:406 (Globals): Syntax
"Script('script-name', 'uri', { extra })" is deprecated and will be removed.
2020-06-07 15:06:12 err updater[8259]: src/pkgupdate/main.c:154 (main):
[string "postprocess"]:104: [string "postprocess"]:46: Unable to finish URI
(file:///usr/share/updater/localrepo/auto/Packages): Unable to open local file
for reading
2020-06-07 15:06:12 info updater[8259]: src/lib/logging.c:204
(log_subproc_open): Executing postupdate hook: 05_schnapps.sh
2020-06-07 15:06:13 info updater[8259]: src/lib/logging.c:204
(log_subproc_open): Executing postupdate hook: 99_approvals_cleanup
2020-06-07 15:06:13 info updater-supervisor[]: pkgupdate exited with: 1
2020-06-07 15:07:11 info updater-supervisor[]: Notifier failed
2020-06-07 15:10:38 notice netifd[]: wan6 (1700): Error relocating /bin/ubus:
uloop_run: symbol not found

Then after a “reboot” I received kernel panic:

[    0.729990] Run /sbin/init as init process
Error relocating /sbin/init: uloop_run: symbol not found
[    0.966183] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[    0.966849] CPU: 0 PID: 1 Comm: init Not tainted 5.4.43 #0
[    0.967173] Hardware name: Generic DT based system
[    0.968698] [<c020e164>] (unwind_backtrace) from [<c020ab0c>] (show_stack+0x10/0x14)
[    0.969733] [<c020ab0c>] (show_stack) from [<c06fec50>] (dump_stack+0x94/0xa8)
[    0.970190] [<c06fec50>] (dump_stack) from [<c021cb24>] (panic+0x10c/0x320)
[    0.970705] [<c021cb24>] (panic) from [<c0220ea0>] (complete_and_exit+0x0/0x1c)
[    0.971221] [<c0220ea0>] (complete_and_exit) from [<c030b058>] (sys_mprotect+0x1a0/0x1ec)
[    0.971707] [<c030b058>] (sys_mprotect) from [<c0201000>] (ret_fast_syscall+0x0/0x4c)
[    0.972191] Exception stack(0xdb441fa8 to 0xdb441ff0)
[    0.972620] 1fa0:                   bed34f14 b6f36560 0000007f 00001000 490c9a28 0000007f
[    0.973032] 1fc0: bed34f14 b6f36560 b6f36560 000000f8 00000001 00000000 00000020 00000000
[    0.973378] 1fe0: 00000fff bed34d48 b6f0f1dc b6ed912c
[    0.974333] Rebooting in 1 seconds..

Now I only hope the real hardware will be another story :slight_smile:

1 Like

FWIW after following the updated migration steps (specifically running this command rm -rf /usr/share/updater/localrepo) the migration of virtualized TOS3 went fine. For the record here’s the contents of the directory on my system:

1 Like

Thanks for this. Having the Turris-OS 5 running from Omnia image works for me, but I got blocked while trying to make this running also for the MOX image (https://repo.turris.cz/hbs/medkit/mox-medkit-latest.tar.gz) which seems to fail on running init even for basic simulation:

KERNEL=zImage; MEM=1024; qemu-system-arm \
   -nographic -M virt -kernel "${KERNEL}" -m "${MEM}" -no-reboot \
   -fsdev local,id=rootdev,path=/tmp/mymnt/,security_model=none \
   -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \
   -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p'
[    6.138085] Starting init: /sbin/init exists but couldn't execute it (error -8)
[   11.897295] Starting init: /bin/sh exists but couldn't execute it (error -8)
[   11.900002] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.

I believe this is due to the fact, that MOX uses a different architecture, so I Googled and estimated that qemu-system-aarch64 should be more convenient, but that leads me only to a black terminal with 100% CPU usage. I tried several -machine and -cpu variants, but without any success. Don’t you know, how to set qemu to be able to run this?