按照脚本,create-windows-11.sh
是为了
創造
win11.vdi
出Win11_23H2_English_x64v2.iso
创建 Windows 11 虚拟机。
将 Win11_23H2_English_x64v2.iso 挂载到
win11.vdi
。启动此 VM,以便我可以继续启动 Windows 11。
#!/bin/bash
nm=w11
img_dr="/home/joan/VirtualBox VMs/Win11_23H2_English_x64v2.iso"
of=win11.vdi
VBoxManage convertfromraw "$img_dr" "$of" --format=VDI && echo -e "Proceeding with createvm"
VBoxManage createvm -n "$nm" -d --ostype=Windows11_64 -r
echo "Let's start $nm."
VBoxManage startvm "$nm"
VBoxManage showvminfo "$nm"
运行create-windows-11.sh
后输出如下:
Converting from raw image file="/home/joan/VirtualBox VMs/Win11_23H2_English_x64v2.iso" to file="win11.vdi"...
Creating dynamic image with size 6812706816 bytes (6498MB)...
Proceeding with createvm
Virtual machine 'w11' is created and registered.
UUID: 77ef158d-0d48-4561-bbdd-c7a0f4e2d6fb
Settings file: '/home/joan/VirtualBox VMs/w11/w11.vbox'
Let's start w11.
Waiting for VM "w11" to power on...
VM "w11" has been successfully started.
Name: w11
Encryption: disabled
Groups: /
Guest OS: Windows 11 (64-bit)
UUID: 77ef158d-0d48-4561-bbdd-c7a0f4e2d6fb
Config file: /home/joan/VirtualBox VMs/w11/w11.vbox
Snapshot folder: /home/joan/VirtualBox VMs/w11/Snapshots
Log folder: /home/joan/VirtualBox VMs/w11/Logs
Hardware UUID: 77ef158d-0d48-4561-bbdd-c7a0f4e2d6fb
Memory size: 4096MB
Page Fusion: disabled
VRAM size: 128MB
CPU exec cap: 100%
HPET: disabled
CPUProfile: host
Chipset: piix3
Firmware: EFI
Number of CPUs: 2
PAE: disabled
Long Mode: enabled
Triple Fault Reset: disabled
APIC: enabled
X2APIC: disabled
Nested VT-x/AMD-V: disabled
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode: message and menu
Boot Device 1: Floppy
Boot Device 2: DVD
Boot Device 3: HardDisk
Boot Device 4: Not Assigned
ACPI: enabled
IOAPIC: enabled
BIOS APIC mode: APIC
Time offset: 0ms
BIOS NVRAM File: /home/joan/VirtualBox VMs/w11/w11.nvram
RTC: local time
Hardware Virtualization: enabled
Nested Paging: enabled
Large Pages: enabled
VT-x VPID: enabled
VT-x Unrestricted Exec.: enabled
AMD-V Virt. Vmsave/Vmload: enabled
IOMMU: None
Paravirt. Provider: Default
Effective Paravirt. Prov.: HyperV
State: running (since 2023-12-22T08:21:52.671000000)
Graphics Controller: VBoxSVGA
Monitor count: 1
3D Acceleration: disabled
2D Video Acceleration: disabled
Teleporter Enabled: disabled
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: disabled
Allow Tracing to Access VM: disabled
Tracing Configuration:
Autostart Enabled: disabled
Autostart Delay: 0
Default Frontend:
VM process priority: default
Storage Controllers:
#0: 'SATA', Type: IntelAhci, Instance: 0, Ports: 2 (max 30), Bootable
NIC 1: MAC: 08002791CD25, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
UART 3: disabled
UART 4: disabled
LPT 1: disabled
LPT 2: disabled
Audio: enabled (Driver: Default, Controller: HDA, Codec: STAC9221)
Audio playback: enabled
Audio capture: disabled
Clipboard Mode: disabled
Drag and drop Mode: disabled
Session name: GUI/Qt
Video mode: 0x0x0 at 0,0 enabled
VRDE: disabled
OHCI USB: disabled
EHCI USB: disabled
xHCI USB: enabled
USB Device Filters: <none>
Available remote USB devices: <none>
Currently attached USB devices: <none>
Bandwidth groups: <none>
Shared folders: <none>
VRDE Connection: not active
Clients so far: 0
Recording enabled: no
Recording screens: 1
Screen 0:
Enabled: yes
ID: 0
Record video: yes
Destination: File
File: /home/joan/VirtualBox VMs/w11/w11-screen0.webm
Options: vc_enabled=true,ac_enabled=false,ac_profile=med
Video dimensions: 1024x768
Video rate: 512kbps
Video FPS: 25fps
* Guest:
Configured memory balloon: 0MB
OS type: Windows11_64
Additions run level: 0
Guest Facilities: <none>
在 VirtualBox 的 GUI 中我得到:
BdsDxe: No bootable option or device was found.
BdsDxe: Press any key to enter the Boot Manager Menu
我收到此消息是因为我没有让 VBoxManage 知道选择哪个win11.vdi
作为此虚拟机的虚拟硬盘吗?我该如何配置?我该如何使用 VBoxManage 将 iso 安装到虚拟 CD 驱动器中?
PS 为了实现自动化,我想将这个问题的范围限制在VBoxManage
。 如果可能的话,我希望尽可能少地在 GUI 中执行操作,并使用 解决所有问题VBoxManage
。 我的操作系统是 Ubuntu Desktop 22.04 LTS。