Closed wb0716 closed 6 months ago
@wb0716 maybe something like this would work:
sudo qemu-system-x86_64 \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-enable-kvm \
-nographic \
-smp 4 \
-m 2048 \
-serial mon:stdio \
-name test-image \
-drive file=packerubuntu-20.04.6,if=virtio,cache=writeback,discard=ignore \
-net nic \
-net user,hostfwd=tcp::2222-:22
This should be able to bring the image up and the SSH Port will be available at localhost@2222
@shantanoo-desai Thanks. Now it can boot the image up. But there is another issue: once using the above command, the terminal will hang. Then have to use another terminal. So If is it possible that after input the above command, after the image is booted, then can input user/passwd directly in the same terminal?
@wb0716 Good point. I am not sure but something like this might help maybe?
sudo qemu-system-x86_64 -m 4096 -smp 4 -drive file=packerubuntu,index=0,media=disk,format=raw
let me know if it works
@shantanoo-desai , Don't work.
@wb0716 maybe use this:
sudo qemu-system-x86_64 \
-bios /usr/share/OVMF/OVMF_CODE.fd \
-enable-kvm \
-smp 4 \
-m 2048 \
-name test-image \
-drive file=packerubuntu-20.04.6,if=virtio,cache=writeback,discard=ignore \
-net nic
without -nographic
QEMU will load the image in a graphic mode
@shantanoo-desai , OK, thanks. it work.
@wb0716 reopen this issue if you have other queries. for the time being I will close it
@shantanoo-desai ,
Hello Can you share a command line to boot up the ubuntu 20.04 qemu VM? My command is like this: sudo qemu-system-x86_64 -machine accel=kvm:xen:tcg -name ubuntu2004 -M pc -m 4096
-device virtio-net,netdev=user.0 -drive file=packerubuntu-20.04.6,snapshot=on -nographic -vnc 127.0.0.1:91 -netdev user,id=user.0,hostfwd=tcp::3892-:22 -bios /usr/share/ovmf/OVMF.fd
But it hang and show the below log: BdsDxe: failed to load Boot0001 "UEFI QEMU DVD-ROM QM00003 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Secondary,Master,0x0): Not Found BdsDxe: loading Boot0002 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0) BdsDxe: starting Boot0002 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)