QEMU AND KVM PROBLEMS - linux

I tried to install qemu, but I should install the kvm first, and I have checked that my cpu supports virtualization, so I don't know why. Here is the error, when I input kvm.
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
And a new window for qemu comes out, but the boot failed....could not read the boot disk, could not read from CDROM(code 0003)
What can I do?

First, check if your CPU support VMX or SVM having a look at /proc/cpuinfo. If yes, you have to load the KVM kernel modules:
modprobe kvm-amd #if you have AMD
modprobe kvm-intel #if you have Intel
Then Qemu/Kvm command should start without complaining about /dev/kvm. If you still have problems, may be virtualization is disabled in the BIOS. I had some machines that reportes virtualization support in the /proc/cpuinfo but it was disabled in the BIOS.
Then to boot KVM from a ISO image:
kvm -cdrom img.iso -hda disk.img -boot d

Please try "dmesg|grep kvm" to find the reason

Try to use this command sudo modprobe kvm-intel. You lacked privilege to insert KVM modules.

The first things to check is that your CPU has virtualization extensions and that the extensions are enabled in the BIOS/EUFI menus. These extensions are required in order to run KVM. Pretty much all modern AMD 64bit cpus will have it. Some older/lower-end Intel processes do not have it, but most will.
egrep -o 'vmx|svm' /proc/cpuinfo
'vmx' will show up for Intel. 'svm' for AMD.
If your cpu supports the extensions the next thing to check is your BIOS/EUFI settings. Many times these extensions are disabled by default. You will want to look for the 'chipset' or 'cpu' settings and it should mention something about 'virtualization'. Make sure that those settings are enabled.
After that is done then you should have KVM modules inserted automatically after a reboot. If they don't then try the 'modprobe kvm-amd' or 'modprobe kvm-intel' as suggested by Diego Woitasen. Check the 'dmesg |grep kvm' output as well.

Related

Why mdev or udev does not create disk nodes when used kernel is from any distribution

I created a minimal linux init with just busybox to do experiments or use it to recover my work linux. But i got stuck and was fustruted alot that i could not find any disks in /dev. I tried both mounting udev as devtmpfs and tmpfs with mdev -s. Both none seemed to work. Lickily i tried compiling a kernel and booting it i realised kernel was the issue. I also noticed my pluged mouse light was off as if the pc was turned off
I tried kernel from both debian and ubuntu. But same result.
Now im happy with what i got. But using custom kernel means i cant make use of the already existing drivers on a target linux when i do chroot.
So i wanna know why the kernels that come with distros does not generate disk blocks
Edit 1:
My question is,why i cant find ant /dev/sdX or my external keyboard does not work when i boot with kernel from distro isos

Booting a Graphical MIPS QEMU Machine

I would like to boot a QEMU MIPS architecture machine running some distribution of Linux. I have been looking through this documentation (https://www.linux-mips.org/wiki/QEMU), but I am getting stuck at this part
[ralf#box qemu]$ qemu-system-mips -kernel /tftboot/192.168.0.1/vmlinux.bin -m 16 -nographic
(qemu) mips_r4k_init: start
mips_r4k_init: load BIOS '/usr/local/share/qemu/mips_bios.bin' size 131072
qemu: could not load MIPS bios '/usr/local/share/qemu/mips_bios.bin'
[ralf#box qemu]$
There currently is no MIPS BIOS file for QEMU (see firmware). However if passed a
-kernel argument qemu will not call the firmware at all, so this does no harm at all. Therefore, a command such as
dd if=/dev/zero of=/usr/local/share/qemu/mips_bios.bin bs=1024 count=128
will generate a firmware file that will do the job for now.
I am confused what arguement I am supposed to pass for kernel? Is that /usr/local/share/qemu/mips_bios.bin argument a compiled Linux image?
If possible, I would like the emulator to have a GUI. I am not sure how this is accomplished either.
Thanks.
You no longer need to create a mips_bios.bin file. If you have a file by that name in the same folder when you run qemu-system-mips it will pick it up. I'd remove it if you do. Here's the wiki link for a little history about it:
https://www.linux-mips.org/wiki/QEMU
For a nice example of a mips specific kernel working with graphics and qemu please check this link out:
http://shadow-file.blogspot.com/2013/05/running-debian-mips-linux-in-qemu.html

How can I write a driver for an asus trackpad on linux?

I bought a laptop and installed Linux on it and the trackpad is now not working but it was on Windows. There is no linux driver for it and I thought this could be a good project to write one.
I have read and implemented tutorials on device drivers for simple things (turning on an led on a pandaboard) but I have no idea where to start here. Related questions pointed to commands like modprobe -r psmouse and it seems the trackpad is not seen at all.
Any idea ? the laptop is : Asus R409C.
A temporary fix is to boot with "psmouse.proto=bare" on the kernel cmdline.
$ sudoedit /etc/default/grub
Change GRUB_CMDLINE_LINUX_DEFAULT to add psmouse.proto=bare at the end, and save your modifications.
Then:
$ sudo update-grub
And finally reboot.
i think linux input subsystem can be used to write driver for touchpad. Exact details need to be considered. But most of the input devices can be integrated using input subsystem.

Build a minimum system with Qt embedded and run on Qemu for x86

My aim: Trying to
Build a minimal Qt based GUI system with a single window and sensor connected on USB
demonstrate this using Qemu and later on embedded board with atom
to build it from scratch
Use buildroot to build the rootfilesystem
My experience Have experience in Linux kernel development for device drivers, qemu, Buildroot, USB but has no experience on GUI and framebuffers.
My attempts:Build kernel and rootfile system
with buildroot using the command make qemu_x86_defconfig
Framebuffer support on Linux kernel is enabled along with the following CONFIG_FB, CONFIG_FRAMEBUFFER_CONSOLE, and CONFIG_LOGO (all the options below this are also enabled)
As the first milestone I expected to see the TUX logo when I run the image with the command
qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2 -append root=/dev/sda -vga std but i donot.
Am I making a mistake at the Qemu command or the framebuffer is not enabled?
P.S. A similar question Qt application GUI -- automatic start -- linux. But i am not planning to use the X window as suggested by most users.
I missed the cirrus graphics board driver. Qemu emulates Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions (hardware level, including all non standard modes for i386.
So the steps are:
Download buildroot
make clean
make qemu_x86_defconfig
make linux-menuconfig to configure kernel and in Device drivers->Graphics support->Support for frame buffer devices enable Cirrus Logic support
Save the configuration and run make
Once make is complete run the command in board/qemu/x86/readme.txt
Where did you see that Buildroot has a i386_defconfig? You seem to be confusing kernel defconfigs and Buildroot defconfigs. I would recommend you to start with:
make clean
make qemu_x86_defconfig
make
and then read board/qemu/x86/readme.txt to see how to run the generated system.

Mini2440 Emulation Procedure : please, how to?

I want to emulate the friendlyARM board, the Mini2440 or the mini6410, so I can get to practice the embedded programming, the QT programming and this due to some financial difficulties and strange import policy in my country.
Anyway, the problem is that I can't seem to understand what's the first step to proceed the emulation: Am running ubuntu 12.04 on VirtualBox then, I installed the qemu-kvn-extras then what ?
Do I need a new kernel for qemu and the emulation process ? What's its specifications ?
In the other hand, when I read all of the tutorials in the net, I can't see the hardware specification part : I mean where is the part in the "qemu-i386 command" that refers to the fact that I'm using Mini2440 ?
After a long period of research, I don't know whether I can emulate the board so I can get used to the u-boot and cross compiling, etc.. or it's just a dream I can't reach ..
(Sorry for reviving an old thread but I had similar issues, so this might be useful for some other people, too)
To run my tests I used (see also man qemu-system-arm):
$ qemu-system-arm -machine versatilepb -cpu arm1176 -m 128M -nographic -kernel kernel.img
You might not want the -nographic here when you are testing Qt and need to replace kernel.img with the image you want to run. However, note that you need the ARM version of qemu qemu-system-arm. It will not work with the Intel version qemu-i386 as the mini6410 runs an ARM processor (the ARM1176JZF-S).
For me, connecting with gdb was also useful (-S halts the CPU at start, -s starts a gdbserver on port 1234):
$ qemu-system-arm -machine versatilepb -cpu arm1176 -S -s -m 128M -nographic -kernel kernel.img
And then:
$ arm-none-eabi-gdb
(gdb) target remote localhost:1234
By the way, host system can be any Linux distribution, so you do not need VirtualBox if your host is already Linux.
Another remark: I am currently struggling to get the interrupts to run on qemu (see also ARM Interrupt Handling in QEMU), so not sure if everything will work for you though.
Good luck! ;)
The closest thing I know about emulating the Mini2440 is that it's emulated on MAME.
The only problem is that you're not only stuck with the 3 pre installed OSes (Windows Mobile, old version Android and a Linux distro) but it's also slow and you can't connect to anything outside of the device itself.
You'll probably need a beefy computer if you want to run this, the beefier the PC is, the faster you can run it.
Plus, you can't use your mouse as a touch screen. You'll need to map out the touch screen controls that are already present in MAME if you want something like that.

Resources