ubuntu启动emulator : /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded

微星B450M主板的BIOS默认居然未开启虚拟化技术,导致AOSP的emulator无法启动,本文记录错误的出现及解决办法。

一、emulator 错误提示

^
[ 99% 154456/154478] //frameworks/base/packages/SystemUI:SystemUI r8 [common]
Warning: Missing class android.compat.annotation.UnsupportedAppUsage (referenced from: void com.android.systemui.people.widget.PeopleBackupHelper.writeNewStateDescription(android.os.ParcelFileDescriptor))
[ 99% 154474/154478] Target super fs image for debug: out/target/product/emulator_x86_64/super.img
2023-12-24 05:08:00 - build_super_image.py - INFO    : Building super image from info dict...
2023-12-24 05:08:00 - common.py - INFO    :   Running: "/home/szhou/works/aosp/aosp/out/host/linux-x86/bin/lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:8598323200 --group emulator_dynamic_partitions:8589934592 --partition system:readonly:1038884864:emulator_dynamic_partitions --image system=out/target/product/emulator_x86_64/system.img --partition system_dlkm:readonly:348160:emulator_dynamic_partitions --image system_dlkm=out/target/product/emulator_x86_64/system_dlkm.img --partition system_ext:readonly:154165248:emulator_dynamic_partitions --image system_ext=out/target/product/emulator_x86_64/system_ext.img --partition product:readonly:330076160:emulator_dynamic_partitions --image product=out/target/product/emulator_x86_64/product.img --partition vendor:readonly:167936000:emulator_dynamic_partitions --image vendor=out/target/product/emulator_x86_64/vendor.img --output out/target/product/emulator_x86_64/super.img"
2023-12-24 05:08:01 - build_super_image.py - INFO    : Done writing image out/target/product/emulator_x86_64/super.img
[100% 154478/154478] Create system-qemu.img now
removing out/target/product/emulator_x86_64/system-qemu.img.qcow2
out/host/linux-x86/bin/sgdisk --clear out/target/product/emulator_x86_64/system-qemu.img

#### build completed successfully (03:13:06 (hh:mm:ss)) ####

szhou@bc-R01:~/works/aosp/aosp$ emulator
INFO    | Android emulator version 31.3.9.0 (build_id 8748233) (CL:N/A)
INFO    | Storing crashdata in: /tmp/android-szhou/emu-crash.db, detection is enabled
INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
WARNING | Failed to open /home/szhou/.android/adbkey
WARNING | adbkey generation failed
ERROR   | x86_64 emulation currently requires hardware acceleration!
CPU acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded
More info on configuring VM acceleration on Linux:
https://developer.android.com/studio/run/emulator-acceleration#vm-linux
General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration.
szhou@bc-R01:~/works/aosp/aosp$ 

二、解决办法

2.1 安装KVM

sudo apt-get install qemu-kvm
sudo kvm-ok

2.2 修改BIOS设置

  • 此处因平台有差异,可百度查询下如何开启BIOS 虚拟化,一般此选择都在CPU相关特征配置里面
  • 以本人微星B450M AMD主板为例子:

1.系统重启,待开机LOGO显示时,按DEL按键进入BIOS设置界面
2.以次序进入:OC => CPU Feature => SVM Mode , 按ENTER按键配置此选项为 Enable

三、启动画面

ubuntu启动emulator : /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded_第1张图片

你可能感兴趣的:(程序员日记,ubuntu,linux,运维)