qemu: installating ubuntu through ISO gets stuck, shows "SVM" CPU bit warning - linux

I am trying to install ubuntu in one of the qcow2 images I have created, using the below command
sudo qemu-system-x86_64 -enable-kvm -nographic -smp 8 -m 8G -cpu qemu64 -cdrom ubuntu-19.10-live-server-amd64.iso -boot d ubuntu-19.10-live-server-amd64.qcow2
First it spits out a warning, and then just hangs
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
SeaBIOS (version 1.13.0-1ubuntu1)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+BFF8C9F0+BFECC9F0 CA00
Booting from DVD/CD...
ISOLINUX 6.04 20190226 ETCD Copyright (C) 1994-2015 H. Peter Anvin et al
Loading bootlogo...
Initializing gfx code...
I have searched a lot and got a number of solutions and possible problems but none worked.
1) Have tried with Ubuntu 20 also, but same error.
2) VT-x not enabled.
It is enabled, lscpu shows
Virtualization: VT-x
Hypervisor vendor: KVM
Flags: .. vmx ..
3) Try with -cpu qemu64. Did not work
4) use qemu-system-i386 instead of qemu-system-x86_64. But that fails with a different error
This kernel requires an x86-64 CPU, but only detected an i686 CPU.
Unable to boot - please use a kernel appropriate for your CPU.
5) I did find out that the "SVM" CPU bit corresponds to "AMD Secure Virtual Machine", which confused me since my CPU is Haswell.
Help!

I found what the issue was.
While using nested virtualization, the option -cpu host works. This advises qemu to use the same cpu format as the host, which in our case is also a VM, and which mostly will be using the host CPU format too..
The above setting works,
unless; you are using nested virtualization over a virtualbox, and trying to run qemu on the VM. Then, to make this work, we have to skip enable-kvm and the -cpu option altogether. It does make the qemu VM run slow, but it works.

Related

DPDK Running As Non Privileged User

I have an issue running DPDK helloworld application as non privileged user.
[#dredd examples]$ ./dpdk-helloworld
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /run/user/1000/dpdk/rte/mp_socket
EAL: rte_mem_virt2phy(): cannot open /proc/self/pagemap: Permission denied
EAL: FATAL: Cannot use IOVA as 'PA' since physical addresses are not available
EAL: Cannot use IOVA as 'PA' since physical addresses are not available
PANIC in main():
Cannot init EAL
5: [./dpdk-helloworld(_start+0x2e) [0x58ce4e]]
4: [/lib64/libc.so.6(__libc_start_main+0xf3) [0x7f93977edcf3]]
3: [./dpdk-helloworld(main+0x42) [0x58cf87]]
2: [./dpdk-helloworld(__rte_panic+0xdb) [0xa01c59]]
1: [./dpdk-helloworld(rte_dump_stack+0x27) [0xa2fcac]]
Clearly this issue is described in DPDK guide and it advises adding the capability to the executable which I did but it didn't work.
[XXX#dredd examples]$ sudo setcap cap_ipc_lock,cap_sys_admin+ep ./dpdk-helloworld
[sudo] password for XXX:
[XXX#dredd examples]$ getcap ./dpdk-helloworld
./dpdk-helloworld = cap_ipc_lock,cap_sys_admin+ep
[XXX#dredd examples]$
On other hand I have seen some pages that claim that running user itself must have the SYS_ADMIN capability. So does it mean that DPDK guide is not updated, and what why file permission may not be sufficient???
Any advises on how to overcome the permission issue for the DPDK application will be highly appreciated.
Running with sudo it seams to be working:-
[#dredd examples]$ sudo ./dpdk-helloworld
[sudo] password for XXX:
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: VFIO support initialized
EAL: Using IOMMU type 8 (No-IOMMU)
EAL: Ignore mapping IO port bar(2)
EAL: Probe PCI driver: net_e1000_em (8086:100e) device: 0000:00:08.0 (socket 0)
The environment is VirtualBox AlmaLinux
[XXX#dredd examples]$ uname -a
Linux dredd 4.18.0-348.el8.x86_64 #1 SMP Tue Nov 9 06:28:28 EST 2021 x86_64 x86_64 x86_64 GNU/Linux
I have bound two pci devices to vfio-pci driver with disabled iommu support
sudo setcap all+ep ./dpdk-helloworld
But it is far from intended granularity of the solution

DPDK Error: "Cause: No Ethernet ports - bye"

The title is the last line of an error while trying to run a sample application of dpdk, named l2fwd. When I run the app by ./build/l2fwd -l 0-3 -n 4 -- -q 8 -p ffff but at last lines this error occurs:
EAL: Error - exiting with code: 1
Cause: No Ethernet ports - bye
According to dpdk documentation before running app I must execute a command: modprobe ixgbe max_vfs=2,2
I also have a problem with this command, but I'm not sure this is the main reason of failing app execution.
Error of modprobe command relates to ixgbe driver which I can't install it. The error after make of ixgbe is
cc1: error: code model kernel does not support PIC mode
Makefile:197: * * Aborting the build. *** This driver is not supported on kernel versions older than 2.4.0. Stop.
To you a NIC with DPDK we need to bind it to UIO or VFIO driver.
Please have a look at Binding and Unbinding Network Ports to/from the Kernel Modules in DPDK's getting started guide.

Android Studio 2.3 using emulator from console, "/dev/kvm device: permission denied" for root user

I'm trying to start a virtual android device which I created with the avdmanager of Android Studio 2.3 (via command line)
all commands are performed as root user
when i try to start the emulator via $ ~/Android/Sdk/tools/./emulator #Nexus_5X_Api_23_x86 the output is:
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
I'm using an Ubuntu 16.04 server with 64-Bit, Android Studio is started via x11 forwarding so my desktop environment is used (which is an ubuntu 16.04, 64-Bit too!)
when i'm typing $ kvm-ok it gives me:
INFO: /dev/kvm exists
KVM acceleration can be used
To proof that the .avd I'm trying to access exists:
$ ~/Android/Sdk/tools/bin/./avdmanager list avd
gives the output:
März 15, 2017 4:30:53 NACHM. sun.util.PropertyResourceBundleCharset$PropertiesFileDecoder decodeLoop
INFO: Invalid or unmappable UTF-8 sequence detected. Switching encoding from UTF-8 to ISO-8859-1
Available Android Virtual Devices:
Name: Nexus_5X_Api_23_x86
Device: Nexus 5X (Google)
Path: /root/.android/avd/Nexus_5X_Api_23_x86.avd
Target: Google APIs (Google Inc.)
Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64
Sdcard: 800M
further the permissions for /dev/kvm are:
root#h2627852:~# ls -l /dev/kvm
crwxrwxrwx 1 root kvm 10, 232 Mär 15 10:48 /dev/kvm
root#h2627852:~# groups root
root : root kvm libvirtd libvirt
performing emulator-check gives me:
root#h2627852:~# ~/Android/Sdk/tools/./emulator-check accel hyper-v cpu-info window-mgr desktop-env
accel:
11
This user doesn't have permissions to use KVM (/dev/kvm)
accel
hyper-v:
0
Hyper-V runs only on Windows
hyper-v
cpu-info:
146
Intel CPU|Virtualization is supported|64-bit CPU|
cpu-info
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 36346
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
window-mgr:
0
GNOME Shell
window-mgr
desktop-env:
0
mate
desktop-env
I really don't know what to do anymore, searched all over the forum but didn't found a replicate of this problem for my system, the fixes for the same problem on other systems doesn't worked for me, already tried to completely purge and reinstall all qemu, libvirt, libvirtd and kvm packages without success.
Any help is appreciated!!
edit:
~/Android/Sdk/tools/./emulator #Nexus_5X_Api_23_x86 -verbose givese me,
following output:
emulator:Android emulator version 25.3.0.0 (build_id 3394391)
emulator:Found AVD name 'Nexus_5X_Api_23_x86'
emulator:Found AVD target architecture: x86_64
emulator:argv[0]: '/root/Android/Sdk/tools/./emulator'; program directory: '/root/Android/Sdk/tools'
emulator: Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/
emulator:Probing for /root/Android/Sdk/system-images/android-23/google_apis/x86_64//kernel-ranchu: file exists
emulator:Auto-config: -engine qemu2 (based on configuration)
emulator: Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/
emulator:try dir /root/Android/Sdk/tools
emulator:try dir /root/Android/Sdk/tools/./
emulator:try dir /root/Android/Sdk/emulator
emulator:Found target-specific 64-bit emulator binary: /root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator:Adding library search path: '/root/Android/Sdk/emulator/lib64'
emulator:Adding library search path: '/root/Android/Sdk/emulator/lib64/libstdc++'
emulator: Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/
emulator: Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/
emulator:GPU emulation is disabled
emulator: Adding library search path for Qt: '/root/Android/Sdk/emulator/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/root/Android/Sdk/emulator/lib64/qt/plugins
emulator: Running :/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator: qemu backend: argv[00] = "/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64"
emulator: qemu backend: argv[01] = "#Nexus_5X_Api_23_x86"
emulator: qemu backend: argv[02] = "-verbose"
emulator: Concatenated backend parameters:
/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64 #Nexus_5X_Api_23_x86 -verbose
emulator: Android virtual device file at: /root/.android/avd/Nexus_5X_Api_23_x86.ini
emulator: virtual device content at /root/.android/avd/Nexus_5X_Api_23_x86.avd
emulator: virtual device config file: /root/.android/avd/Nexus_5X_Api_23_x86.avd/config.ini
emulator: using core hw config path: /root/.android/avd/Nexus_5X_Api_23_x86.avd/hardware-qemu.ini
emulator: Found AVD target API level: 23
emulator: Read property file at /root/Android/Sdk/system-images/android-23/google_apis/x86_64//build.prop
emulator: No boot.prop property file found.
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: autoconfig: -skin HVGA
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel /root/Android/Sdk/system-images/android-23/google_apis/x86_64//kernel-ranchu
emulator: Target arch = 'x86_64'
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /root/Android/Sdk/system-images/android-23/google_apis/x86_64//ramdisk.img
emulator: Using initial system image: /root/Android/Sdk/system-images/android-23/google_apis/x86_64//system.img
emulator: autoconfig: -data /root/.android/avd/Nexus_5X_Api_23_x86.avd/userdata-qemu.img
emulator: autoconfig: -initdata /root/.android/avd/Nexus_5X_Api_23_x86.avd/userdata.img
emulator: autoconfig: -cache /root/.android/avd/Nexus_5X_Api_23_x86.avd/cache.img
emulator: autoconfig: -sdcard /root/.android/avd/Nexus_5X_Api_23_x86.avd/sdcard.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 0MB is below hardware specified minimum of 256MB,setting it to that value
emulator: System image is read only
emulator: GPU emulation is disabled
emulator: Found 2 DNS servers: 85.214.7.22 81.169.163.106
emulator: skin name 'HVGA' aliased to '320x480'
emulator: found magic skin width=320 height=480 bpp=16
emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
Simply try this.
this was work for me
$ sudo chown username -R /dev/kvm
sometimes you need to run this code also
$ cd Android/Sdk/emulator/lib64/libstdc++
$ mv libstdc++.so.6 libstdc++.so.6.bak
$ ln -s /usr/lib64/libstdc++.so.6
Try these steps:
Install qemu-kvm like following
sudo apt install qemu-kvm
Add user to kvm group using the following command:
sudo adduser <username> kvm
If you are getting permission denied, try following command
sudo chown <username> /dev/kvm
It worked for me in Ubuntu 18.04
Assuming that you want to apply this change of ownership using the current OS user, use the following:
sudo chown $(whoami) -R /dev/kvm
I solved the problem running
sudo apt install qemu-kvm
sudo chown username -R /dev/kvm
Check nano /etc/group contains a line begins with kvm and ends with your user name. If not then run:
sudo gpasswd -a $USER kvm

Error running qemu-system-riscv using root.bin and vmlinux

I am following riscv.org guides for toolchain building. When emulate using qemu running local built rootfilesystem (with busybox) and Linux Kernel, encounter the error below:
Running Qemu using local-built root.bin and kernel image
danny#danny:~/test/riscv/work$ qemu-system-riscv -hda root-local.bin -kernel vmlinux-local -nographic
unassigned address was called?
with addr: 102000735F80006E
not implemented for riscv
Running Qemu using riscv.org stocked root.bin and kernel image
danny#danny:~/test/riscv/work$ qemu-system-riscv -hda root.bin -kernel vmlinux -nographic
[ 0.150000] io scheduler cfq registered (default)
[ 0.160000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.160000] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 0.160000] TCP: cubic registered
[ 0.160000] htifbd: detected disk with ID 1
[ 0.160000] htifbd: adding htifbd0
[ 0.160000] VFS: Mounted root (ext2 filesystem) readonly on device 254:0.
[ 0.160000] devtmpfs: mounted
[ 0.160000] Freeing unused kernel memory: 64K (ffffffff80002000 - ffffffff80012000)
[ 0.200000] EXT2-fs (htifbd0): warning: mounting unchecked fs, running e2fsck is recommended
#uname -a
Linux ucbvax 3.14.15-g4073e84-dirty #4 Sun Jan 11 07:17:06 PST 2015 riscv GNU/Linux
If qemu testing using the downloaded root.bin and vmlinux from riscv.org, seem ok but cant see the busybox starting message and the terminal cant Halt :
Have tested qemu using various combination and result as below:
**root.bin vmlinux RESULT**
local-built local-built Unassigned address was called ....
Downloaded Downloaded Seem OK but without busybox starting bar
local-built Downloaded Kernelpanic-not syncing:No working init found
Downloaded local-built Unassigned address was called ....
We are starting a project to build and fabricate a RISCV silicon chip for Makers around the world and testing the toolchain now in order to port Ubuntu Core & Android to RISCV. Any idea what might probably went wrong ?
Thanks.
QEMU hasn't been fully updated to support the new RISC-V privileged spec (github issue). The update is currently underway.
For an ISA simulator, spike is a good alternative. It may not have all of the platform features of QEMU, but it could serve as a starting point while the QEMU update completes.

linux: running self compiled kernel in qemu: VFS: Unable to mount root fs on unknown wn-block(0,0)

I try to get this running and don't know what I'm doing wrong. I have created an Debian.img (disk in raw format with virtual device manager - gui to libvirt I guess) and installed debian with no troubles. Now I want to get this running with a self compiled kernel. I copied the .config-file from my working (virtual) debian and made no more changes at all. This is what I do:
qemu-system-x86_64 -m 1024M -kernel /path/to/bzImage -hda /var/lib/libvirt/images/Debian.img -append "root=/dev/sda1 console=ttyS0" -enable-kvm -nographic
But during boot I always get this error message.
[ 0.195285] Initializing network drop monitor service
[ 0.196177] List of all partitions:
[ 0.196641] No filesystem could mount root, tried:
[ 0.197292] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 0.198355] Pid: 1, comm: swapper/0 Not tainted 3.2.46 #7
[ 0.199055] Call Trace:
[ 0.199386] [<ffffffff81318c30>] ? panic+0x95/0x19e
[ 0.200049] [<ffffffff81680f7d>] ? mount_block_root+0x245/0x271
[ 0.200834] [<ffffffff8168112f>] ? prepare_namespace+0x133/0x169
[ 0.201590] [<ffffffff81680c94>] ? kernel_init+0x14c/0x151
[ 0.202273] [<ffffffff81325a34>] ? kernel_thread_helper+0x4/0x10
[ 0.203022] [<ffffffff81680b48>] ? start_kernel+0x3c1/0x3c1
[ 0.203716] [<ffffffff81325a30>] ? gs_change+0x13/0x13
What I'm doing wrong? Please someone help. Do I need to pass the -initrd option? I tried this already but had no luck yet.
I figured it out by myself. Some time has passed, but as I recall the solution was to provide an initial ramdisk. This is how I got it working with hardware acceleration.
Compiling
make defconfig
CONFIG_EXT4_FS=y
CONFIG_IA32_EMULATION=y
CONFIG_VIRTIO_PCI=y (Virtualization -> PCI driver for virtio devices)
CONFIG_VIRTIO_BALLOON=y (Virtualization -> Virtio balloon driver)
CONFIG_VIRTIO_BLK=y (Device Drivers -> Block -> Virtio block driver)
CONFIG_VIRTIO_NET=y (Device Drivers -> Network device support -> Virtio network driver)
CONFIG_VIRTIO=y (automatically selected)
CONFIG_VIRTIO_RING=y (automatically selected)
---> see http://www.linux-kvm.org/page/Virtio
Enable paravirt in config
Disable NMI watchdog on HOST for using performance counters on GUEST. You may ignore this.
cat /proc/sys/kernel/nmi_watchdog
---> see http://kvm.et.redhat.com/page/Guest_PMU
Start in Qemu
sudo qemu-system-x86_64 -m 1024M -hda /var/lib/libvirt/images/DEbian.img -enable-kvm -initrd /home/username/compiled_kernel/initrd.img-3.2.46 -kernel /home/username/compiled_kernel/bzImage -append "root=/dev/sda1 console=ttyS0" -nographic -redir tcp:2222::22 -cpu host -smp cores=2
Start in KVM
Kernal path: /home/username/compiled_kernel/bzImage
Initrd path: /home/username/compiled_kernel/initrd.img-3.2.46
Kernel arguments: root=/dev/sda1
Hope this helps if someone has the same issues.
This is for AArch64 (arm64) on QEMU case.
I was following this good tutorial: https://ibug.io/blog/2019/04/os-lab-1/
In my case I was met with this error message:
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) ]---
I did mknod dev/ram b 1 0 in the initrd.
Later I noticed there was an error message above that line implying the kernel didn't support the ram disk. So I edited .config and set these items:
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=131072 (= 128MB, the number is in unit of 1014B)
And then the problem was gone! The initrd was mounted on /dev/ram and the first init process ran well.
It turns out running make defconfig didn't set thses values by default for me.
maybe your system image file is bad and can not be mounted.
You may try these command to mount the image file and check if it is a valid root file system for linux.
losetup /dev/loop0 /var/lib/libvirt/images/Debian.img
kpartx -av /dev/loop0
mount /dev/mapper/loop0p1 /mnt/tmp
The most likely thing is that the kernel doesn't know the correct device to boot from.
You can supply this explicitly from the qemu command line. So if the root is on partition 2, you can say:
qemu -kernel /path/to/bzImage \
-append root=/dev/sda2 \
-hda /path/to/hda.img \
.
.
.
Notice I use /dev/sda2 even though the disk is IDE. Even virtual machines seem to use SATA nowadays.
The other possibilities are that as #Houcheng says, your root FS is corrupted, or else that the kernel does not have that particular FS type built in. But I think you would get a different error if that were the case.
QEMU version
QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.11), Copyright (c) 2003-2008 Fabrice Bellard
running build-root 4.9.6 with the following arguments to be passed
qemu-system-x86_64 -kernel output/images/bzImage -hda output/images/rootfs.qcow2 -boot c -m 128 -append root=/dev/sda -localtime -no-reboot -name rtlinux -net nic -net user -redir tcp:2222::22 -redir tcp:3333::3333
was accepting only /dev/sda as an option for the root fs to mount (it will show you a little hint for the root fs option once it will boot and hang with the following error):
VFS: Cannot open root device "hda" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
0800 61440 sda driver: sd

Resources