kamilion / customizer

Ubuntu Live CD remastering tool
GNU General Public License v2.0
306 stars 94 forks source link

QEMU never run and returned non-zero exit #78

Closed ghost closed 9 years ago

ghost commented 10 years ago

This is probably different from issue #59 that has been reported and known since Lucid release testing. Below is the screenshot of error dialog prompted upon clicking "QEMU" button.

screenshot - 10112014 - 100602 pm

The Terminal output (as seen in screenshot):

$ sudo customizer-gui
[sudo] password for [...]: 
* Running QEMU...
  => Checking
  => Gathering information
  => Architecture: i386
  => Distribution (DISTRIB_ID): Ubuntu
  => Release (DISTRIB_RELEASE): 12.04
  => Running QEMU with ISO image: /home/Ubuntu-i386-12.04.iso
  => Host architecture: i686
  => KVM: True
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
* SUBPROCESS: Command '['/usr/bin/qemu-system-i386', '-m', '256', '-cdrom',
 '/home/Ubuntu-i386-12.04.iso', '-enable-kvm']' returned non-zero exit status 1

The built-in checking shows KVM is available or present (regardless of qemu-kvm package is installed or not) however, QEMU never run from Customizer devel branch GUI or CLI.

More testing reports will be included in comments later.

UPDATED The original built-in check is intended for setting the command option -enable-kvm and not for checking the KVM support on host system and machine.

ghost commented 10 years ago

I had checked my hardware, whether the processor has VT support or not. We can check this by running the following command in Terminal.

cat /proc/cpuinfo | grep flags

The VT support indicated by certain flag: vmx for intel; svm for amd processors.

The processor on my machine didn't have this flag.

Despite lack of support, I have done initial testing on same test machine (on 12.04 host system) using Customizer gambas3 branch and QEMU works despite similar errors were seen inside Terminal. See screenshot below.

screenshot - 10082014 - 033436 am

I have repeated this test on same test machine, but this time on 14.04 host system (apparently gambas3 and devel branches can co-exist with same work directory). QEMU works and able to run similarly, this time without showing any error as seen in screenshot earlier.

screenshot - 10122014 - 125319 am

What does these mean actually? Was QEMU able to run in gambas3 branch because some sort of fallback acceleration (which may explain the screen glitches)? But why is it not working for devel branch?

UPDATED By default, gambas3 branch runs QEMU via software emulation instead of hardware acceleration. In contrast, the original default for devel branch tries to run with hardware accelerartion by passing the command option -enable-kvm. These explainations make sense of why I had experienced above situation earlier.

ghost commented 10 years ago

By the way, these tests were done after checking that latest qemu-kvm package has been installed. Command line output as below.

$ apt-cache policy qemu-kvm
qemu-kvm:
  Installed: 2.0.0+dfsg-2ubuntu1.5
  Candidate: 2.0.0+dfsg-2ubuntu1.5
  Version table:
 *** 2.0.0+dfsg-2ubuntu1.5 0
        500 http://mirror.netspace.net.au/pub/ubuntu/ trusty-updates/main i386 Packages
        100 /var/lib/dpkg/status
     2.0.0+dfsg-2ubuntu1.3 0
        500 http://mirror.netspace.net.au/pub/ubuntu/ trusty-security/main i386 Packages
     2.0.0~rc1+dfsg-0ubuntu3 0
        500 http://mirror.netspace.net.au/pub/ubuntu/ trusty/main i386 Packages

That's all information I have for now.

fluxer commented 10 years ago

Thanks for the detailed info, can you test the latest checkout of the devel branch? My kernel does not support KVM altought my hardware does support virtualization so I can not test this right now.

ghost commented 10 years ago

@fluxer Installed latest devel branch as suggested. Nope, it is still not working. Terminal output below:

* Running QEMU...
  => Checking
  => Gathering information
  => Architecture: i386
  => Distribution (DISTRIB_ID): Ubuntu
  => Release (DISTRIB_RELEASE): 12.04
  => Running QEMU with ISO image: /home/Ubuntu-i386-12.04.iso
  => Host architecture: i686
  => QEMU KVM: True
  => Host KVM: True
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
* SUBPROCESS: Command '['/usr/bin/qemu-system-i386', '-m', '256', '-cdrom',
 '/home/Ubuntu-i386-12.04.iso', '-enable-kvm']' returned non-zero exit status 1

By the way, I found somewhere on the Web few days ago: suggesting to run sudo /usr/sbin/kvm-ok command in Terminal to check whether KVM is supported or not.

$ sudo /usr/sbin/kvm-ok
[sudo] password for [...]: 
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

But similar to processor flags checking, mine is negative (not supported). Really, huh?

fluxer commented 10 years ago

Dang it. Does /dev/kvm exists on your host? I read http://manpages.ubuntu.com/manpages/lucid/man1/kvm-ok.1.html which has some usefull information about the topic. kvm-ok could be very helpfull I do not want to bind another external dependency so I would rather implement the check myself.

ghost commented 10 years ago

@fluxer No, it doesn't. The /dev/kvm directory doesn't exist on my host system. Do I need to create this empty directory manually?

fluxer commented 10 years ago

No, that would be (one of many) sign that your system does not support KVM thus I can use it in the check.

ghost commented 10 years ago

@fluxer I looked up on the official KVM site's processor support page which suggests to look up on Wikipedia and eventually I found this Intel product page cited as source. Quoted some text from Wikipedia as below:

As of 2009 not all Intel processors supported VT-x, which Intel uses to segment its market.[20] Support for VT-x may even vary between different versions (as identified by Intel's sSpec Number) of the same model number

In short, my budget line Intel processors doesn't support VT-x. For many end users, need at least any of Intel Core series' processors to use KVM.

fluxer commented 10 years ago

@clearkimura Indeed, that's why I'm trying to optionally make use of KVM and the virtualization features of the CPU of the host.

ghost commented 10 years ago

@fluxer VT-x is more complicated than we thought.. found another supporting source which explains the whole story in short.

Just remember, it's not only the processor but the motherboard also has to support this. In some cases, vendors such as HP will ship a CPU and Motherboard that supports these features but they are not exposed in the BIOS and have it disabled.

So it says. I can never do testing for QEMU with existing machine.

fluxer commented 10 years ago

@clearkimura Well, should I made it possible to enable/disable KVM as a settings option for cases like you mention above? That would be the last resort, yet I would like to keep the autmatic check and just let the users know that even tought they have KVM feature enabled it is not supported on their system, something like a one time warning or everytime the settings (checkbox, for the GUI) changes. Does that sound ok to you?

ghost commented 10 years ago

@fluxer

yet I would like to keep the autmatic check and just let the users know that even tought they have KVM feature enabled it is not supported on their system,

Automated checking is good. Sure, why not?

Well, should I made it possible to enable/disable KVM as a settings option [...]

Consider below cases.

Case 1: User machine supports VT-x feature. In this case, what does "Disable KVM" option in Settings will do? As a result, what will happen to QEMU button (disabled/enabled)?

Case 2: User machine doesn't support VT-x feature. In this case, what does "Disable KVM" option in Settings will do? As a result, what will happen to QEMU button (disabled/enabled)?

fluxer commented 10 years ago

@clearkimura

Case 1: Force-disable the KVM support in via the configuration file for both backend and frontend, KVM will simply not be enabled for the emulation of the ISO.

Case 2: When Customizer GUI is run for the first time it will inform the user that his/her system does not support KVM and will force-disable it in both the configuration file and visibly in the settings tab of the GUI.

The second case will apply only for the GUI, users who use the CLI will see the output anyway and are able to turn off KVM manually via the config file.

ghost commented 10 years ago

@fluxer Sounds okay to me and as end user.

fluxer commented 10 years ago

@clearkimura Oki doki, I will look into it soon. I'm working on something else right now.

ghost commented 10 years ago

@fluxer Thank you for your support as always. No rush, take your time.

I probably can't do anything for the next few weeks, due to my working condition. There will be consecutive overhaul weeks planned by workplace.. So, kindly excuse me.

fluxer commented 10 years ago

@clearkimura Thank you. Stay healthy!

fluxer commented 9 years ago

I'm sorry but I may not be able to work on this. I mean, the basic checks are implemented but the option to manually enable/disable the use of KVM is not. It would be useful to have it in cases where the autmatic check fails, either that or the check should be improved.

@clearkimura The initial issue should be solved thus I would like to mark this as feature request, the tittled of the issue changed too. Is that fine with you?

ghost commented 9 years ago

@fluxer

I'm sorry but I may not be able to work on this. I mean, the basic checks are implemented but the option to manually enable/disable the use of KVM is not.

No worries. At least the basic checking has been implemented. After all, this issue won't break Customizer core functions to rebuild ISO.

End users just cannot run QEMU for testing their remix. As alternative, they can opt for VirtualBox or such emulator, which doesn't rely on VT-x. Nothing major here.

The initial issue should be solved thus I would like to mark this as feature request, the tittled of the issue changed too. Is that fine with you?

Well, I rather close this issue since you already suggested that "initial issue should be solved". For option to manually enable/disable KVM, I will create new issue after this.

ghost commented 9 years ago

@fluxer On second thought, I will confirm again how the "automated checking" works on my side. I had forgotten to test this issue since I was thinking something else.

I should be able to confirm by this weekend. Until then, please leave this issue open.

fluxer commented 9 years ago

@clearkimura Oki doki.

ghost commented 9 years ago

@fluxer I am testing using latest commit 028edf2 from devel branch. Below is the screenshot after rebuild ISO using minimal Ubuntu 14.04 ISO image file, then click on QEMU button.

screenshot-11292014-105002 pm

The error dialog in the screenshot:

Critical; 'bool' object doesn't end with 'endswith'

Um, actually I don't know what to expect after clicking QEMU button on non-supported machine. So, is this the expected output?

fluxer commented 9 years ago

Should be fine now (at least the latest report).

ghost commented 9 years ago

@fluxer Splendid, it works now! This automatic checking is good enough for end users (to add option -enable-kvm or not, based on the hints we discussed earlier comments). Therefore, I don't see the need for the manually disable KVM or QEMU itself--indeed very optional.

Below is the screenshot when running QEMU on non-supported hardware machine.

screenshot-11302014-011251pm

Now all make sense to me, why I had been experiencing this issue using devel branch. I have updated in issue post and first comment with UPDATED subheading appended to last paragraphs, for general reading and understanding.

It is all good, hence I am closing this issue.

fluxer commented 9 years ago

I'm glad this finally got sorted. :)

kamilion commented 7 years ago

My explanation will be a little late, but better than never:

qemu is fairly old, and has been around since before CPU virtualization became standard. KVM is a kernel module that came much later, and added hardware virtualization support to qemu.

These days, parts of qemu are also used elsewhere, like Xen, which uses only the emulated device models. So it's not really a magical fallback, rather, KVM support is 'just' an additional acceleration feature for qemu which can emulate a large amount of non-intel processors completely in software. Accelerating the amd64 instruction set with hardware is only a tiny feature of the vast qemu empire. :smiley: