Error when importing image
Closed this issue · 17 comments
New nemu user.
Impoting an image crashes nemu, after finished with the image size progress, scanning or whatever it is, with error: "nm_db_edit: database error: 7 values for 6 columns".
Using nemu 3.3.1 from AUR.
With nemu-git, I get "nm_db_edit: database error: 8 values for 7 columns"
The entry is kept in the list though, and attempting to edit it with 'e' gives "nm_vect_at: invalid index", so it's a broken entry.
Tried several qcow2 images, all the same.
There doesn't appear to be a way to add an existing image to a VM, 'a' makes a new one. So no way to use my existing vm disks
It looks like the migrations script was not applied. Show the output of the commands:
$ grep '^db\s' ~/.config/nemu/nemu.cfg
db = /home/oi/.nemu.db
$ sqlite3 /home/oi/.nemu.db -line 'PRAGMA user_version;'
user_version = 21
I get user_version = 21 as well for -git. and 20 for the stable.
I made sure to remove .nemu_db, ~/.config/nemu and ~/nemu_vm between each nemu reinstall.
Can you reproduce this behaviour ?
show the output of nemu --version
from -git and stable versions.
I'll try to reproduce from both.
Cannot reproduce from nEMU v3.3.1-2-g48610a1
.
I checked some more qcow2 images and it seems to work for those, so there must be something about the working images I initially tried tha trips nemu. Although I checked them with qemu-img check and they seem fine, working fine in qemu. They were created with qemu-img create -f qcow2 file.img 4000M
The ones that are working I got from archive.org, windows95
nEMU v3.3.1-2-g48610a1
- OVF import
- SVG map
- Link alt names
- D-Bus support
- Remote control
- USB Support
nEMU v3.3.1
- OVF import
- SVG map
- Link alt names
- D-Bus support
- Remote control
- USB Support
Seems that the AUR packages don't have some optional support compiled in ?
Also, running nemu stable on top of nemu-git created db gives:
Database version is not up do date. I will try to update it.
Cannot update database
But I am sure this worked without a problem on previous attempts, so there must be something spefic about the db contents that causes this.
Here is an image I found on the internet that can't be imported in nemu:
https://mega.nz/file/S8gVlT4S#-9Ildxs4OIG_wOVKPASV8KZoTZk9kj1V0QCgQSXFaN4 from https://virtualdiskimages.weebly.com/qemu-manager.html
$ nemu --version
nEMU v3.3.1-2-g48610a1
☑ OVF import
☑ SVG map
☑ Link alt names
☑ D-Bus support
☑ Remote control
☑ USB Support
$ nemu --info win2000
name: win2000
status: stopped
arch: x86_64
cores: 1
memory: 1024 Mb
kvm: enabled [+hostcpu]
usb: enabled [XHCI]
vnc port: 1 [5901]
eth0: win2000_eth0 [de:ad:be:ef:00:01 virtio-net-pci+vhost]
disk0: win2000_a.img [0.86Gb/1.95312Gb real/virt, ide, qcow2] *
machine: pc-i440fx-8.2
Okay, I tried an alpine docker image, which has nemu 3.3.1, with that qcow and it does indeed work.
nEMU v3.3.1
- OVF import
- SVG map
- Link alt names
- D-Bus support
- Remote control
- USB Support
It has SVG map, D-Bus support and Remote control extra featurs vs the arch package.
So the problem is most likely related to how the arch package is built ? What happens in the nemu code on image import, after the image scan or whtever progress reaches 100%, that might trigger the database column number mismatch erorr ?
AUR pkg build commands: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=nemu#n16
edit: Just realised that the + - chars from nemu --version output are not displayed as is here.
I have also built nemu from instructions with all features enabled, 1 by 1, and it still does not work. So I am thinking maybe it's qemu 9.1.1 that's in arch vs 9.0* in alpine that might have introduced a bug here ? Actually it stops at 98% progress when scanning the image, not 100%, if that helps.
Update: updated qemu in alpine to 9.1 and nemu still works there.
I put a printf in the vm_add c code (last stable) before inserting into the drives table, and it's Executing query: INSERT INTO drives(vm_id, drive_name, drive_drv, capacity, boot, discard) VALUES((SELECT id FROM vms WHERE name='2'), '2_a.img', 'virtio', 1,95312, 1, 0)
Looks like size is inserted as a fractional GB number, but using comma instead of decimal point, which makes sqlite interpret it as a distinct value to insert. It worked on some images because they had whole number size in GB.
I'd look to see how it is generated, but C code makes me dizzy.
Interesting. I'll try to figure out why this SQL query runs without problems for me. Thanks for the additional information.
nEMU v3.3.1-2-g48610a1:
nm_db_edit: "INSERT INTO drives(vm_id, drive_name, drive_drv, capacity, boot, discard, format) VALUES((SELECT id FROM vms WHERE name='win'), 'win_a.img', 'virtio', 1.95312
, 1, 0, 'qcow2')"
nEMU v3.3.1
nm_db_edit: "INSERT INTO drives(vm_id, drive_name, drive_drv, capacity, boot, discard) VALUES((SELECT id FROM vms WHERE name='win'), 'win_a.img', 'virtio', 1.95312
, 1, 0)"
Please, show locale
output
Yeah I was suspecting it's related to the numbers locale myself, although I found it odd it would make its way into the program, it's an obvious bug. My numeric locale has ',' as decimal separator.
Can you show your locale output?
e.g:
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=C
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=ro_RO.UTF-8 LC_TIME=ro_RO.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=ro_RO.UTF-8 LC_MESSAGES="en_US.UTF-8" LC_PAPER=ro_RO.UTF-8 LC_NAME=ro_RO.UTF-8 LC_ADDRESS=ro_RO.UTF-8 LC_TELEPHONE=ro_RO.UTF-8 LC_MEASUREMENT=ro_RO.UTF-8 LC_IDENTIFICATION=ro_RO.UTF-8 LC_ALL=
Bug confirmed:
nm_db_edit: database error: 8 values for 7 columns
$ locale
LANG=ro_RO.UTF-8
LC_CTYPE="ro_RO.UTF-8"
LC_NUMERIC="ro_RO.UTF-8"
LC_TIME="ro_RO.UTF-8"
LC_COLLATE="ro_RO.UTF-8"
LC_MONETARY="ro_RO.UTF-8"
LC_MESSAGES="ro_RO.UTF-8"
LC_PAPER="ro_RO.UTF-8"
LC_NAME="ro_RO.UTF-8"
LC_ADDRESS="ro_RO.UTF-8"
LC_TELEPHONE="ro_RO.UTF-8"
LC_MEASUREMENT="ro_RO.UTF-8"
LC_IDENTIFICATION="ro_RO.UTF-8"
LC_ALL=ro_RO.UTF-8
nm_db_edit: "INSERT INTO drives(vm_id, drive_name, drive_drv, capacity, boot, discard, format) VALUES((SELECT id FROM vms WHERE name='win'), 'win_a.img', 'virtio', 1,95312
, 1, 0, 'qcow2')"