Qemu Mips Malta Pantacor Test Docker Container Fix

I am using instructions from Image Setup - Docs. The docker container to test mips via qemu-system-mips command:
docker run --privileged --net host -v </your/host/path/to/pflash.img>:/tmp/pflash.img -it --rm pantacor/qemu-malta-16m

was modified as:

docker run --net host --privileged -it --rm --mount type=bind,src=“</your/host/path/to/pflash.img>”,target=“/tmp/pflash.img” pantacor/qemu-malta-16m

Now the issue being that docker container for qemu-malta-16m is using this shell script named qemu.sh which reads $0 as the path given for /tmp/pflash.img. The provided (mount bound) image is RAW format such that qemu disables the write function.
Advising the following for the docker registry “pantacor/qemu-malta-16m”

In qemu.sh please modify qemu-system-mips to read /tmp/pflash.img as follows:

-drive if=pflash,format=raw,file=“/tmp/pflash.img”

The qemu container is still failing with “Error reading superblock on volume ‘ubi0:data’ errno=-12!” while the container is booting up.

I am not 100% sure if my qemu-malta.img is bad or perhaps this is a legitimate issue with the way qemu-system-mips.
I am attaching my docker run output here for team to inspect:

docker run --net host --privileged -it --rm --mount type=bind,src=“/home/saad/Desktop/SAPENG/COTX_Partnership/PARALLEL_ASSET_MINING/X1/qemu_mips/malta_initial_stable.img”,target=“/tmp/pflash.img” pantacor/qemu-malta-16m
++ realpath /usr/local/bin/qemu.sh

  • path=/usr/local/bin/qemu.sh
    ++ dirname /usr/local/bin/qemu.sh
  • dir=/usr/local/bin
  • file=/tmp/pflash.img
  • mac=
  • pid=
  • idx=
  • demorc=
    ++ echo /tmp/pflash.img
    ++ sed -e ‘s/.*flash-malta-//’
    ++ sed -e ‘s/.img$//’
  • deviceid=/tmp/pflash
  • logfile=
  • mac=
  • ‘[’ 0 -ne 0 ‘]’
  • ‘[’ -z /tmp/pflash.img ‘]’
  • random=30847
    ++ echo 30847
    ++ md5sum
    ++ sed ‘s/^(…)(…)(…)(…)(…).*$/02:\1:\2:\3:\4:\5/’
  • mac=02:c7:71:ad:2e:41
    ++ echo /tmp/pflash.img
    ++ sed -e ‘s/.*flash-malta-//’
    ++ sed -e ‘s/.img$//’
  • id=/tmp/pflash
  • logfile=/tmp/qemu-/tmp/pflash-log
  • trap kill_qemu SIGTERM
  • runpath=/bin
  • forwardrules=‘-redir :22::22 -redir :80::80’
    ++ basename /
  • ‘[’ ‘!’ / = demo ‘]’
  • forwardrules=
  • runpath=./out/malta/staging-host/usr/bin
  • ‘[’ -n ./out/malta/staging-host/usr/bin ‘]’
  • PATH=./out/malta/staging-host/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • export PATH
  • ‘[’ ‘’ == background ‘]’
  • echo ‘Starting QEMU Malta instance with device-id /tmp/pflash’
    Starting QEMU Malta instance with device-id /tmp/pflash
  • qemu-system-mips -M malta -m 128 -pflash /tmp/pflash.img -nographic -net tap,vlan=0,script=/usr/local/bin/qemu-ifup0 -net tap,vlan=1,script=/usr/local/bin/qemu-ifup -net nic,vlan=0,macaddr=02:c7:71:ad:2e:41 -net nic,vlan=1,macaddr=b0:AA:00:CC:DD:00
  • BRIDGE=qemu-br1
  • BOOTP=
  • setup_bridge_nat qemu-br1
  • check_bridge qemu-br1
  • do_brctl show
  • brctl show
  • grep ^qemu-br1
  • return 1
  • start_dnsmasq qemu-br1
  • do_dnsmasq --strict-order --except-interface=lo --interface=qemu-br1 --listen-address= --bind-interfaces --dhcp-range=, --conf-file= --pid-file=/var/run/qemu-dnsmasq-qemu-br1.pid --dhcp-leasefile=/var/run/qemu-dnsmasq-qemu-br1.leases --dhcp-no-override
  • dnsmasq --strict-order --except-interface=lo --interface=qemu-br1 --listen-address= --bind-interfaces --dhcp-range=, --conf-file= --pid-file=/var/run/qemu-dnsmasq-qemu-br1.pid --dhcp-leasefile=/var/run/qemu-dnsmasq-qemu-br1.leases --dhcp-no-override
  • test tap0
  • do_ifconfig tap0 up
  • ifconfig tap0 up
  • do_brctl addif qemu-br1 tap0
  • brctl addif qemu-br1 tap0
  • BRIDGE=qemu-br0
  • BOOTP=
  • setup_bridge_nat qemu-br0
  • check_bridge qemu-br0
  • do_brctl show
  • brctl show
  • grep ^qemu-br0
  • return 1
  • test tap1
  • do_ifconfig tap1 up
  • ifconfig tap1 up
  • do_brctl addif qemu-br0 tap1
  • brctl addif qemu-br0 tap1
    WARNING: Image format was not specified for ‘/tmp/pflash.img’ and probing guessed raw.
    Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
    Specify the ‘raw’ format explicitly to remove the restrictions.

U-Boot 2016.09-g15600e28f5 (Aug 05 2021 - 22:39:54 +0000)

Board: MIPS Malta CoreLV
DRAM: 128 MiB
Flash: 16 MiB
In: serial@3f8
Out: serial@3f8
Err: serial@3f8
Net: pcnet#0
Warning: pcnet#0 MAC addresses don’t match:
Address in SROM is 02:c7:71:ad:2e:41
Address in environment is 52:54:00:12:34:56
, pcnet#1
Hit any key to stop autoboot: 0
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name “mtd=2”, size 15 MiB)
ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
ubi0: min./max. I/O unit sizes: 1/4, sub-page size 4
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 247, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 793842850
ubi0: available PEBs: 0, total reserved PEBs: 247, PEBs reserved for bad PEB handling: 0
Error reading superblock on volume ‘ubi0:data’ errno=-12!
ubifsmount - mount UBIFS volume

- mount ‘volume-name’ volume
UBIFS not mounted, use ubifs mount to mount volume first!
ubifsload - load file from an UBIFS filesystem

ubifsload [bytes]
- load file ‘filename’ to address ‘addr’

Warning: defaulting to text format

Warning: defaulting to text format

UBIFS not mounted, use ubifs mount to mount volume first!
ubifsload - load file from an UBIFS filesystem


I followed the following instructions and got to a running OpenWRT:

  1. download stable malta image and unxz it to /tmp/

  2. run docker like: docker run --privileged --net host -v /tmp/malta_initial_stable.img:/tmp/pflash.img -it --rm pantacor/qemu-malta-16

Let it run…

I pasted the console log I get here: docker run --privileged --net host -v $PWD/malta_initial_stable.img:/tmp/pflash. - Pastebin.com

Note I am running on Ubuntu Focal 20.04


I just tested in the same way as @asac, downloaded the stable malta image and i did run it with.

Here is my log

Running on:

qemu-system-mips --version
QEMU emulator version 7.0.0
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
EndeavourOS; Build ID: 2022.04.08
Linux sergio-zephyrus-s 5.18.16-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 03 Aug 2022 11:25:04 +0000 x86_64 GNU/Linux
1 Like

I must have over complicated an already solved and working command. My initial attempt to run failed with above errors that i attempted to address with mount bind etc commands added to docker run. I am now certain that as i complicated this test, it added even more complicated issues that cascaded. However as you guys suggested in responses and i have verified that it runs as expected.

Thank you so much for the help. I am now evaluating the mips image and will post further questions in a new thread.

1 Like