Проверка виртуализации процессора linux
We already knew how to check if a Linux OS is 32 bit or 64 bit and how to find if a Linux system is physical or virtual machine. Today, we are going to learn yet another useful topic i.e. how to find if a CPU supports virtualization technology (VT) or not. This should be the first thing you might want to verify before installing virtualization applications such as KVM or VirtualBox or VMWare workstation to run virtual machines on your Linux system. Now let us go and find out if our computer supports VT or not.
Проверка поддержки процессором аппаратной виртуализации
6 июля 2010, 13:01
Если необходимо проверить поддерживает ли процессор аппаратную виртуализацию, то можно поступить следующим образом. Если вы точно знаете модель своего процессора, то лучше всего зайти на сайт производителя и в соответствующем разделе посмотреть интересующую вас информацию. Для процессоров Intel такая информация о процессорах находится - здесь, а для процессоров AMD - здесь. Но если вы не уверены какая у вас модель процессора, то есть и более простой способ определить наличие аппаратной поддержки виртуализации.
Если у вас операционная система Linux, то для того чтобы узнать, есть ли аппаратная поддержка виртуализации в вашем процессоре, достаточно просто ввести команду:
$ egrep '(vmx|svm)' /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr
pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow extd_apicid
pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr
pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow extd_apicid
pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
Если в выводе присутствует флаг svm (Secure Virtual Machines) - значит у вас процессор с поддержкой аппаратной виртуализации от AMD, если vmx (Virtual Machine eXtension) - значит процессор Intel.
Для того, чтобы определить наличие виртуализации из операционной системы Windows, идем на сайт Microsoft и скачиваем утилиту Hardware-Assisted Virtualization Detection Tool. Утилита маленькая (меньше мегабайта), проверка на лицензионность ОС перед загрузкой - отсутствует. Запускаем, соглашаемся с лицензионным соглашением и смотрим на результат. Если аппаратная виртуализация поддерживается, получим, окно с надписью “This computer is configured with hardware-assisted virtualization“, если поддержка отсутствует значит получим “This computer does not have hardware-assisted virtualization“.
I have a laptop with Intel Core i5 M 450 @ 2.40GHz which apparently has VT-x but not VT-d. I have Ubuntu 12.04 32bit but would like to have a virtual 64bit terminal-based Linux running on it. How do I know if the BIOS has this VT-x feature activated without having to reboot?
About This Site
Ты просто не можешь с настройками виртуалки разобраться
там настройки то процессора 2-3 , количество ядер и загрузка
Долго смотрел на кофейную гущу на дне чашки, но ответа так и не нашёл. Про host-систему ты тоже ни чего дельного не сказал.
mandala ★★★★ ( 13.03.17 16:31:14 )
Последнее исправление: mandala 13.03.17 16:31:26 (всего исправлений: 1)
intel P6200 2.13, 1 ядро, 3 гб память. Какие еще нужны? Насколько я понял это 32 битный процессор с поддержкой pae, но тогда почему не работает ни x86, ни x64.
mandala просит инфу о ос (хост), на которую ты хочешь поставить kali. Напиши ос и её разрядность.
Процессор 64-х разрядный, но там нет аппаратной виртуализации, а значит 64-х разрядный гость не получится в виртуалке. Ставь 32-х разрядную гостевую систему.
В настройках присутствуют только 32 разрядные системы. И когда я ставил тоже была 32, и опция PAE включена (без нее результат одинаков)
дай угадаю, на хосте 32-разрядная винда?
Как сказал уважаемый mandala - процессор 64-х разрядный, но там нет аппаратной виртуализации, а значит 64-х разрядный гость не получится в виртуалке. ось - семерка домашняя, 64 разрядная
Для полной картины не хватает только информации по гипервизору, может в нем проблема.
Не совсем понял - кроме ВБ ничего не ставил, в настройках про гипервизор ничего нет. Никак не допилю в чем проблема. Поставил extended pack, ситуация не изменилась
Гипервизор (англ. Hypervisor) или Монитор виртуальных машин (в компьютерах) — программа или аппаратная схема, обеспечивающая или позволяющая одновременное, параллельное выполнение нескольких операционных систем на одном и том же хост-компьютере
VB и есть гипервизор.
Поставил extended pack, ситуация не изменилась
Его сразу надо было ставить. Так как хостовая система Windows, посоветовать ни чего не могу — в простом случае всё должно работать.
mandala ★★★★ ( 14.03.17 13:52:26 )
Последнее исправление: mandala 14.03.17 13:53:13 (всего исправлений: 1)
Method 2 - Using "lscpu" command
The "lscpu" command is used to display the information about your CPU architecture. It gathers information from sysfs, /proc/cpuinfo file and displays the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes of your host system.
To find out if the VT support is enabled or not, simply run:
Find if a CPU supports virtualization using lscpu command in Linux
Method 4 - Using "virt-host-validate " tool
This tool is specifically for RHEL based distros like CentOS and Scientific Linux. The libvirt-client package provides virt-host-validate binary. So you need to install "libvert-client" package to use this tool.
Now, run "virt-host-validate" command to find if VT is enabled or not in your RHEL-based systems.
If you get pass for all results, your system supports VT.
If your system doesn't support VT, you will see an output like below.
And, that's all for now. In this guide, we have discussed various methods to find if a CPU supports VT or not. As you can see, it was very easy. Hope this was useful.
Немного обо всем и все о немногом, или практический опыт системного администратора.
Пн | Вт | Ср | Чт | Пт | Сб | Вс |
---|---|---|---|---|---|---|
« Июнь | Авг » | |||||
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Find If A CPU Supports Virtualization Technology (VT) In Linux
We can check if our CPU supports VT in various methods. Here I've listed four methods.
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 3 - Using "Cpu-checker" utility
Cpu-checker is yet another useful utility to test your CPU for virtualization support. As far as I searched on the web, this utility is available only for Ubuntu-based systems. To install it, run:
Once cpu-checker package is installed, run the following command to check whether VT support is enable or not:
If your CPU supports VT, you will get the following output:
Find if a CPU supports virtualization using cpu-checker
If your CPU doesn't support VT, you will see an output something like below.
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
Verifying VT on your processor
Method 1: Using "egrep" command
Egrep is one of the variant of Grep command line utility which is used to search text files with regular expressions.
To find out if your CPU supports VT using egrep command, run:
This command will grep /cpu/procinfo/ file and display if the CPU supports VT or not.
Sample output:
You will get either "vmx" (Intel-VT technology) or "svm" (AMD-V support) in the output.
Since the output is very long, it might be bit hard to find the words "vmx" or "svm". No worries! You can distinguish those terms with colors like below.
Sample output:
Find if a CPU supports virtualization using egrep command in Linux
If you don't get any output, it means that your system doesn't support virtualization.
Please note that these CPU flags (vmx or svm) in the /proc/cpuinfo file indicates that your system will support VT. In some CPU models, the VT support might be disabled in the BIOS, by default. In such cases, you should check your BIOS settings to enable VT support.
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
7 Answers 7
You can use rdmsr from msr-tools to read register IA32_FEATURE_CONTROL (address 0x3a). The kernel module msr has to be loaded for this.
On most Linux systems:
Values 3 and 5 mean it's activated.
Installing msr-tools package on Ubuntu 16.04 (Xenial Xerus) is as easy as running the following command on terminal: sudo apt-get update sudo apt-get install msr-tools
from cpu-checker. On Intel, which has the most complicated logic, kvm-ok checks that if bit 0 of rdmsr 0x3a (the lock bit) is set, bit 2 (which allows virt use outside of SMX mode, something to do with trusted boot) must also be set. If the output of rdmsr 0x3a is anything but 1 or 3, you will be able to use kvm. kvm will set bit 2 of the msr if necessary, I expect virtualbox and the rest have the same logic.
Install cpu-checker and run "kvm-ok"
If the CPU is enabled, you should see something like:
In linux you can check cpuinfo:
Are you sure? When I'm inside my vm it give me an empty line but my cpu supports amd-v? In cpu-z I can see amd-v even when I disabled secure virtual machine in the bios?
@Betterdev I'm not sure the virtual CPU is relevant. Anyway, by saying a CPU info tool reports the presence of AMD-V, despite it being unusable because you disabled SVM in the firmware, you're proving scai's point.
This only shows if the CPU has one of those particular extensions; it won't show anything relevant to the BIOS configuration. Check out the full output without grep to see what it's about.
I found that scai's answer doesn't work on my AMD Ryzen systems.
( systool is found in the sysfsutils package on most distros.)
For Intel's VT-D / AMD's IOMMU, I came up with this solution:
(It even worked for me if the iommu kernel parameters are not set.)
Note: This requires the sysfsutils package, but does not return an error if you don't have it (it just returns "you don't have virt stuff").
A simple approach to confirm that Vt-D is enabled in the BIOS is through the Linux system. If the VT-D is enable in the BIOS and Iommu=on in the grub.cfg then the below folder structure is created automatically to hold the Virtual devices.
Whereas if either one of the options VT-D or Iommu is not configured/enabled then the above mentioned folder structure is not created. This behavior is confirmed in CentOS 7.4 and Ubuntu. Hopefully this behavior is similar for other operating systems as well but this would need to be confirmed.
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.
- 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.
Search
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.
Читайте также: