Intel hardware virtualization linux

Linux Find Out If CPU Support Intel VT/AMD-V Virtualization For KVM

H ow do I find out if my system support Intel – VT / AMD -V hardware virtualization extensions for host CPU using the command line options? How do I check if my Linux hardware from HP/IBM/Dell supports virtualization?

Both Intel and AMD CPU support virtualization technology which allows multiple operating systems to run simultaneously on an x86 server or computer in a safe and efficient manner using hardware virtualization. XEN, KVM, Vmware and other virtualization software can use Intel and AMD hardware virtualization for full virtualization. In other words with Intel VT, or AMD-V you can run an unmodified guest OS, like MS-Windows without any problems. To run KVM, you need a CPU that supports hardware virtualization.[donotprint]

Tutorial details
Difficulty level Easy
Root privileges No
Requirements Intel/AMD x86 server
Est. reading time 2m

[/donotprint]

Say hello to /proc/cpuinfo file

The /proc/cpuinfo file has information about your CPU. The information includes, the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes. There is also formation about the CPU caches and cache sharing, family, model, bogoMIPS, byte order, and stepping. You need to note down the following vendor specific cpu flags:

Am I using 64 bit CPU/system [x86_64/AMD64/Intel64]?

  1. lm – If you see lm flag means you’ve 64 bit Intel or AMD cpu.

Do I have hardware virtualization support?

  1. vmx – Intel VT-x, virtualization support enabled in BIOS.
  2. svm – AMD SVM,virtualization enabled in BIOS.

Do I have hardware AES/AES-NI advanced encryption support?

  1. aes – Applications performing encryption and decryption using the Advanced Encryption Standard on Intel and AMD cpus.

Commands to check if your hardware supports virtualization

Use the following commands to verify if hardware virtualization extensions is enabled or not in your BIOS.

Verify Intel VT CPU virtualization extensions on a Linux

Type the following command as root to verify that host cpu has support for Intel VT technology, enter:
# grep —color vmx /proc/cpuinfo
Sample outputs:

Fig.01: Linux check Intel VT — if my server can run full virtualization or not

Verify AMD V CPU virtualization extensions on a Linux

Type the following command as root to verify that host cpu has support for AMD – V technology:
# grep —color svm /proc/cpuinfo

Linux lscpu command to find Virtualization AMD-V support

Verify Intel or AMD 64 bit CPU

Type the following grep command:
grep -w -o lm /proc/cpuinfo | uniq
See our tutorial “Find If Processor (CPU) is 64 bit / 32 bit on a Linux” for more info.

lscpu command

The lscpu command shows CPU architecture information on a Linux server:
lscpu
Sample outputs from Intel server:

Fig.02: lscpu command on a Linux server to find out Virtualization support

Putting it all together

Type the following egrep command:

Fig.03: Finding Intel virtualization, encryption and 64 bit cpu in a single command

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Additional Intel x86 CPU specific virtualization flags

  1. ept – Intel extended page table support enabled to make emulation of guest page tables faster.
  2. vpid – Intel virtual processor ID. Make expensive TLB flushes unnecessary when context switching between guests.
  3. tpr_shadow and flexpriority – Intel feature that reduces calls into the hypervisor when accessing the Task Priority Register, which helps when running certain types of SMP guests.
  4. vnmi – Intel Virtual NMI helps with selected interrupt events in guests.

Additional AMD x86 CPU specific virtualization flags

  1. npt – AMD Nested Page Tables, similar to Intel EPT.
  2. lbrv – AMD LBR Virtualization support.
  3. svm_lock – AMD SVM locking MSR.
  4. nrip_save – AMD SVM next_rip save.
  5. tsc_scale – AMD TSC scaling support.
  6. vmcb_clean – AMD VMCB clean bits support.
  7. flushbyasid – AMD flush-by-ASID support.
  8. decodeassists – AMD Decode Assists support.
  9. pausefilter – AMD filtered pause intercept.
  10. pfthreshold – AMD pause filter threshold.

Some tips to solve your problems.

Tip #1: See Linux kernel messages

Type the following command to see kvm support enabled or not in BIOS:
# dmesg | less
# dmesg | grep -i kvm

Tip # 2: Check your BIOS settings

By default, many system manufacturers disables an AMD or Intel hardware CPU virtualization technology in the BIOS. You need to reboot the system and turn it in the BIOS. Once turned on, run lscpu or grep command as discussed earlier to see if your virtualization support enabled:
$ lscpu
$ egrep -wo ‘vmx|ept|vpid|npt|tpr_shadow|flexpriority|vnmi|lm|aes’ /proc/cpuinfo | sort | uniq
$ egrep -o ‘(vmx|svm)’ /proc/cpuinfo | sort | uniq
Sampple outputs:

Tip # 3: XEN Kernel

By default, if you booted into XEN kernel it will not display svm or vmx flag using the grep command. To see if it is enabled or not from xen, enter:
cat /sys/hypervisor/properties/capabilities
You must see hvm flags in the output. If not reboot the box and set Virtualization in the BIOS.

References
  • The Linux kernel source/header file located at /usr/src/kernels/$(uname -r)/arch/x86/include/asm/cpufeature.h (or click here to see cpufeature.h online)
  • Man pages – proc(5)

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

How to Start Intel Hardware-assisted Virtualization (hypervisor) on Linux to Speed-up Intel Android x86 Emulator

Last Updated: 07/29/2015

The Intel Hardware Accelerated Execution Manager (Intel® HAXM) is a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (VT) to speed up Android app emulation on a host machine. In combination with Android x86 emulator images provided by Intel and the official Android SDK Manager, HAXM allows for faster Android emulation on Intel VT enabled systems. HAXM for both Windows and OS X are available now.

Since Google mainly supports Android build on Linux platform (with Ubuntu 64-bit OS as top Linux platform, and OS X as 2nd), and a lot of Android Developers are using AVD on Eclipse or Android Studio hosted by a Linux system, it is very critical that Android developers take advantage of Intel hardware-assisted KVM virtualization for Linux just like HAXM for Windows and OS X.

Below are the quick step-by-step’s on how to install, enable KVM on Ubuntu host platform and start Intel Android x86 emulator with Intel hardware-assisted virtualization (hypervisor). The result is very pleasing and AVD runs significantly faster and smoother than without hypervisor.

KVM Installation

I referred the instructions from Ubuntu community documentation page. to get KVM installed.To see if your processor supports hardware virtualization, you can review the output from this command:

$ egrep -c ‘(vmx|svm)’ /proc/cpuinfo

If the output is 0 it means that your CPU doesn’t support hardware virtualization.

Next is to install CPU checker:

$ sudo apt-get install cpu-checker

Now you can check if your cpu supports kvm:

and insert root password

If you see:
«INFO: Your CPU supports KVM extensions
KVM acceleration can be used»

It means you can run your virtual machine faster with the KVM extensions.

If you see:
«INFO: KVM is disabled by your BIOS
HINT: Enter your BIOS setup and enable Virtualization Technology (VT),
and then hard poweroff/poweron your system
KVM acceleration can NOT be used»

You need to go to BIOS setup and enable the VT.

Use a 64 bit kernel

Running a 64bit kernel on the host operating system is recommended since Google no longer offers support for 32bit kernel..
This allows the serving of more than 2GB of RAM for your VMs.
Also, a 64-bit system can host both 32-bit and 64-bit guests. A 32-bit system can only host 32-bit guests.
To see if your processor is 64-bit, you can run this command:

$ egrep -c ‘ lm ‘ /proc/cpuinfo

If 0 is printed, it means that your CPU is not 64-bit.
If 1 or higher, it is. Note: lm stands for Long Mode which equates to a 64-bit CPU.
Now see if your running kernel is 64-bit, just issue the following command:

x86_64 indicates a running 64-bit kernel. If you see i386, i486, i586 or i686, you’re running a 32-bit kernel.

Install KVM

For Ubuntu Lucid (12.04 LTS Precise) or later:

$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils ia32-libs-multiarch

If it is displayed, you may ignore the Postfix Configuration below by selecting «No Configuration»

Next is to add your account to the group kvm and libvirtd

$ sudo adduser your_user_name kvm
$ sudo adduser your_user_name libvirtd

After the installation, you need to relogin so that your user account becomes an effective member of kvm and libvirtd user groups. The members of this group can run virtual machines.

Verify Installation
You can test if your install has been successful with the following command:
$ sudo virsh -c qemu:///system list
Your screen will paint the following below if successful:
Id Name State
———————————-

Install Java

Please referred to the instructions from Ubuntu community documentation page to get Java installed. There are four implementations of Java. Oracle java 7 has to be installed in order to run Android emulator x86 system Images.

Start the AVD from Android SDK Directly from Terminal

Documented information on how to install Android sdk or Android Sudio can be found on android developers website.

After installing Android SDK a new virtual machine can be created using virtual device manager. Make sure that after installation OS system variable LD_LIBRARY_PATH point to /tools/lib64

Type in a terminal:

Android Virtual device manager is started. Click on the create button and fallow the wizard remembering the virtual machine name and selecting x86 system image in CPU/ABI section

Now start the Android for x86 Intel Emulator using the following command:

$ /tools/emulator64-x86 -avd Your_AVD_Name -qemu -m 2047 -enable-kvm

Only a 64-bits Ubuntu can allow you to run allocated Memory of 2G or more. My 64-bit Ubuntu has 6G of Memory, so I used 1/3 of it for Android AVD. My AVD name is Intel_Atom_x86_64. ‘-qemu’ provides the options to qemu, and ‘-m’ specifies the amount of memory for the emulated Android (i.e. guest). If you use too small value for that, it’s possible that performance is bad because of frequent swapping activities. Add ‘-show-kernel’ to see the message from the kernel.

Start the AVD by AVD Manager in Android Studio

Below is the recommended procedure. If you are running the emulator from Android Emulator, run your Android application with an x86-based AVD and include the KVM options:

  • In Android Studio, click your Android project folder and then select Run > Edit Configurations
  • Click the Emulator tab
  • Check Additional command line options and in the input field enter:

-qemu –m 2047 -enable-kvm

  • Run your Android project using this run configuration.

Источник

How to check if your processor supports Virtualization Technology on Ubuntu

What is VT and why is it required?

The Virtualization Technology enables your processor to act as a number of independent computer systems. This enables several operating systems to be running on the same machine at the same time. Whenever you want to install virtualization applications on your Ubuntu system such as VMware Workstation, VirtualBox etc., you should first verify if your system supports virtualization and if it is enabled. Only then you can run virtual machines using a single processor.

The article explains the following methods to check if Virtual Technology is supported by your processor on a Ubuntu system:

  • lscpu command
  • cpu-checker utility
  • /proc/cpuinfo file
  • Libvirt client utility

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system. We will be using the Ubuntu command line, the Terminal, in order to verify VT on our processor. You can open the Terminal application either through the system Dash or the Ctrl+Alt+T shortcut.

Verifying VT on your processor

Method 1: Through the lscpu command

The lscpu command is a popular method to extract information about your CPU’s architecture. This command extracts hardware information from the /pro/cpuinfo file of sysfs. This information includes the number of processors, CPU operation mode, sockets, cores, threads, model name, and virtualization information, among much more.

Simply run the following command in your Ubuntu Terminal:

Here is the output format you usually see:

Navigate to the Virtualization output; the result VT-x here ensures that virtualization is indeed enabled on your system.

Method 2: Through the cpu-checker utility

The cpu-checker utility is another way to check virtualization technology, among many other things. Since most Ubuntu systems do not have this facility by default, you can install is by running the following command as sudo:

Please note that only an authorized user can add/remove and configure software on Ubuntu.

After you have entered the password for sudo, the system might prompt you with a y/n option to verify if you want to continue installation. Please enter y and hit Enter after which cpu-checker will be installed on your system

The following command from this utility will help you in verifying if virtualization is supported by your processor or not: Advertisement

The above output indicates that VT is enabled on your system. However, if you get the following output, it means that you need to enable virtualization to use applications that work on this technology:

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

Method 3: From the /proc/cpuinfo file

We can also manually extract relevant information from the /proc/cpuinfo file by using the egrep command. For example, because we want to extract virtualization related information, we can use egrep command as follows to extract information related to either svm or vmx:

In the output you will see information about one of the following, that will verify that virtualization is enabled on your system:

Svm: AVM-V support information

Vmx: Intel-VT technology support information

This is the output of the above-mentioned command on my system:

The vmx indication and it’s information in the output indicates that the virtual technology, Intel-VT, is enabled and supported by my system. If you do not find any output for this command, this emans that the /proc/cpuinfo does not contain any information about VT and it is either unavailable or disabled from your BIOS settings.

Method 4: Through the Libvirt client utility

There is a virtual host validation tool called virt-host-validate. In order to use this, you need to have the libvert-clients package installed on your system. Since most Ubuntu systems do not have this facility by default, you can install is by running the following command as sudo:

Please note that only an authorized user can add/remove and configure software on Ubuntu.

After you have entered the password for sudo, the system might prompt you with a y/n option to verify if you want to continue installation. Please enter y and hit Enter after which cpu-checker will be installed on your system

The following virt-host-validate command from this utility will help you in verifying if virtualization is supported by your processor or not, among many other things:

You can see that the “QEMU: checking for hardware virtualization” shows the result status as PASS on my system. This indicates that VT is indeed enabled on my processor. If the result status is “FAIL” in anyone’s output, that indicates that virtualization is either not supported or else not enabled.

So now you have not one, but four very simple ways to verify if your hardware supports virtualization. This is the power of Linux, with just one command you can perform a seemingly complex task.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Источник

Читайте также:  Changing hostname mac os
Оцените статью