Sample Header Ad - 728x90

How to place a qemu vm in background (it means that it should run between the processes but nothing should be shown on the screen)

1 vote
1 answer
863 views
I would like to run the qemu vm that you see below runs between the processes,so I don't want to see any monitor,graphic,terminal window,nothing should be shown on the screen. /usr/local/bin/qemu-system-x86_64 -machine q35 \ -cpu kvm64,hv_relaxed,hv_time,hv_synic -m 1G -nographic \ -drive file=Debian-warp.img,format=raw -rtc base=localtime \ -device usb-ehci,id=usb,bus=pcie.0,addr=0x3 -device usb-tablet \ -device usb-kbd -smbios type=2 -nodefaults \ -netdev tap,id=mynet0,ifname=tap20,script=no,downscript=no \ -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01 \ -device ich9-ahci,id=sata \ -drive if=pflash,format=raw,readonly=on,file=/usr/local/share/edk2-qemu/QEMU_UEFI_CODE-x86_64.fd \ -drive if=pflash,format=raw,file=/usr/local/share/edk2-qemu/QEMU_UEFI_VARS-x86_64.fd I tried passing the parameter -nographic : it is able to put the vm in background,but I'm not able to ping the ip number assigned to Debian,so something does not work within the vm. Instead,below you see what happens if I use the parameter -daemonize : screenshot it presents two problems : 1) it does not ping and 2) I see that little window on the top left of the screen,that I don't want to see. That vm is based on Debian 12 and starts with the grub manager. It waits for 3 seconds and if no keys are pressed,it boots the os. I've configured the automatic login of the user,so when it is authenticated,the script below is ran automatically : function jumpto { label=$1 cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$') eval "$cmd" exit } start=${1:-"start"} jumpto $start start: warp-cli disconnect OLD_IP="$(curl -s api.ipify.org)" sudo iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE warp-cli connect NEW_IP="$(curl -s api.ipify.org)" echo Connected to Cloudflare Warp...echo OLD IP is $OLD_IP , NEW IP is $NEW_IP mid : if [ "$OLD_IP = $NEW_IP" ] then echo OLD IP is $OLD_IP , NEW IP is $NEW_IP : it does not work anymore,reconnecting... sleep 10 jump foo else echo OLD IP is $OLD_IP , NEW IP is $NEW_IP : it still works. sleep 10 fi jumpto mid foo: warp-cli disconnect OLD_IP="$(curl -s api.ipify.org)" warp-cli connect NEW_IP="$(curl -s api.ipify.org)"echo OLD IP is $OLD_IP , NEW IP is $NEW_IP : it works again. jumpto mid If,instead of -nographic, I use -vga std,the vm works as expected,but this is not what I want. I want that the vm runs hidden. 2
Asked by Marietto (579 rep)
May 14, 2024, 08:17 PM
Last activity: Dec 18, 2024, 05:40 PM