Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Forwarding Not Working On v3 (x64 Architecture) #3541

Closed
Meligy opened this issue Jan 26, 2022 · 5 comments
Closed

Port Forwarding Not Working On v3 (x64 Architecture) #3541

Meligy opened this issue Jan 26, 2022 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@Meligy
Copy link

Meligy commented Jan 26, 2022

Describe the issue
I have an M1 (M1Max) Macbook, and I ran an x64 VM that I built to use as a host for docker engine for the x64-only docker images.

Multiple VMs actually as I was trying this. Some running debian, some running Ubuntu Server.

I had emulated network, with port forwarding as shown:

image

The same VM runs just fine on v2, and the port is reachable.

On v3 though, the port is not reachable.

I tried a few things, including:

  • Ensure I kill any process using the port 2200 before I run the VM
  • Creating the VM on v3 not use the one created in v2 (it's nice that v3 VMs seem backwards compatible with v2)

No luck.

I have both versions of UTM side by side now. The same VM runs with port forwarding when opened in v2, but no port forwarding when open in v3

Configuration

  • Architecture: x86_64
  • System: Standard
  • UEFI: On
  • CPU: Default
  • QEMU: Default
  • Display: Full Graphics (tried default virtio-vga and Spice GPU primary, on separate VMs)
  • OS: Debian and Ubuntu Server, latest for both

QEMU Command

qemu-system-x86_64 -L /Applications/UTM.app/Contents/Resources/qemu -S -qmp tcp:127.0.0.1:4444,server,nowait -nodefaults -vga none -spice "unix=on,addr=/Users/meligy/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/76B82A01-D732-4B58-B385-2A9294099495.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=off" -device virtio-vga -device virtio-rng-pci -smp cpus=4,sockets=1,cores=4,threads=1 -machine q35,vmport=off -accel tcg,thread=multi,tb-size=1536 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -drive if=pflash,format=raw,unit=0,file=/Applications/UTM.app/Contents/Resources/qemu/edk2-x86_64-code.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/efi_vars.fd -boot menu=on -m 6144 -device intel-hda -device hda-duplex -name Ubuntu -usb -device usb-tablet,bus=usb-bus.0 -device ich9-usb-ehci1,id=usb-controller-0 -device ich9-usb-uhci1,masterbus=usb-controller-0.0,firstport=0,multifunction=on -device ich9-usb-uhci2,masterbus=usb-controller-0.0,firstport=2,multifunction=on -device ich9-usb-uhci3,masterbus=usb-controller-0.0,firstport=4,multifunction=on -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device ide-hd,bus=ide.0,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/disk-0.qcow2,cache=writethrough -device ide-cd,bus=ide.1,drive=drive1,bootindex=1 -drive if=none,media=cdrom,id=drive1 -device e1000,mac=76:0D:A8:73:7B:35,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2200-0.0.0.0:22 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -uuid 76B82A01-D732-4B58-B385-2A9294099495 -rtc base=localtime
  • UTM Version: Broken v3.0.4, Working v2.4.1
  • OS Version: macOS Monterey 12.1 (21C52)
  • Intel or Apple Silicon? Apple Silicon (but x86_64 VM)

Crash log
N/A

Debug log

Running:  -L /Applications/UTM.app/Contents/Resources/qemu -S -qmp tcp:127.0.0.1:4000,server,nowait -nodefaults -vga none -spice "unix=on,addr=/Users/meligy/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/76B82A01-D732-4B58-B385-2A9294099495.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=off" -device virtio-vga -device virtio-rng-pci -smp cpus=4,sockets=1,cores=4,threads=1 -machine q35,vmport=off -accel tcg,thread=multi,tb-size=1536 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -drive if=pflash,format=raw,unit=0,file=/Applications/UTM.app/Contents/Resources/qemu/edk2-x86_64-code.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/efi_vars.fd -boot menu=on -m 6144 -device intel-hda -device hda-duplex -name Ubuntu -usb -device usb-tablet,bus=usb-bus.0 -device ich9-usb-ehci1,id=usb-controller-0 -device ich9-usb-uhci1,masterbus=usb-controller-0.0,firstport=0,multifunction=on -device ich9-usb-uhci2,masterbus=usb-controller-0.0,firstport=2,multifunction=on -device ich9-usb-uhci3,masterbus=usb-controller-0.0,firstport=4,multifunction=on -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device ide-hd,bus=ide.0,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/disk-0.qcow2,cache=writethrough -device ide-cd,bus=ide.1,drive=drive1,bootindex=1 -drive if=none,media=cdrom,id=drive1 -device e1000,mac=76:0D:A8:73:7B:35,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2200-0.0.0.0:22 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -uuid 76B82A01-D732-4B58-B385-2A9294099495 -rtc base=localtime
qemu-x86_64-softmmu: -accel tcg,thread=multi,tb-size=1536: warning: Guest expects a stronger memory ordering than the host provides
This may cause strange/hard to debug errors
qemu-x86_64-softmmu: warning: global PIIX4_PM.disable_s3=1 not used
qemu-x86_64-softmmu: warning: Spice: playback:0 (0x14f8a0950): setsockopt failed, Operation not supported on socket
qemu-x86_64-softmmu: warning: Spice: record:0 (0x14f8a0a00): setsockopt failed, Operation not supported on socket

Upload VM

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ConfigurationVersion</key>
	<integer>2</integer>
	<key>Debug</key>
	<dict>
		<key>DebugLog</key>
		<false/>
	</dict>
	<key>Display</key>
	<dict>
		<key>ConsoleFont</key>
		<string>Menlo</string>
		<key>ConsoleFontSize</key>
		<integer>12</integer>
		<key>ConsoleOnly</key>
		<false/>
		<key>ConsoleTheme</key>
		<string>Default</string>
		<key>DisplayCard</key>
		<string>virtio-vga</string>
		<key>DisplayDownscaler</key>
		<string>linear</string>
		<key>DisplayUpscaler</key>
		<string>nearest</string>
	</dict>
	<key>Drives</key>
	<array>
		<dict>
			<key>DriveName</key>
			<string>drive0</string>
			<key>ImagePath</key>
			<string>disk-0.qcow2</string>
			<key>ImageType</key>
			<string>disk</string>
			<key>InterfaceType</key>
			<string>ide</string>
		</dict>
		<dict>
			<key>DriveName</key>
			<string>drive1</string>
			<key>ImageType</key>
			<string>cd</string>
			<key>InterfaceType</key>
			<string>ide</string>
			<key>Removable</key>
			<true/>
		</dict>
		<dict>
			<key>DriveName</key>
			<string>1D8560D9-4406-4E65-B9F0-5FAECE9ECD74</string>
			<key>ImagePath</key>
			<string>efi_vars.fd</string>
			<key>ImageType</key>
			<string>none</string>
			<key>InterfaceType</key>
			<string></string>
		</dict>
	</array>
	<key>Info</key>
	<dict/>
	<key>Input</key>
	<dict>
		<key>InputLegacy</key>
		<false/>
	</dict>
	<key>Networking</key>
	<dict>
		<key>NetworkCard</key>
		<string>e1000</string>
		<key>NetworkCardMAC</key>
		<string>76:0D:A8:73:7B:35</string>
		<key>NetworkMode</key>
		<string>emulated</string>
		<key>PortForward</key>
		<array>
			<dict>
				<key>GuestAddress</key>
				<string>0.0.0.0</string>
				<key>GuestPort</key>
				<integer>22</integer>
				<key>HostAddress</key>
				<string>127.0.0.1</string>
				<key>HostPort</key>
				<integer>2200</integer>
				<key>Protocol</key>
				<string>tcp</string>
			</dict>
		</array>
	</dict>
	<key>Printing</key>
	<dict/>
	<key>Sharing</key>
	<dict>
		<key>ClipboardSharing</key>
		<true/>
		<key>UsbRedirectMax</key>
		<integer>3</integer>
	</dict>
	<key>Sound</key>
	<dict>
		<key>SoundCard</key>
		<string>intel-hda</string>
		<key>SoundEnabled</key>
		<true/>
	</dict>
	<key>System</key>
	<dict>
		<key>Architecture</key>
		<string>x86_64</string>
		<key>BootDevice</key>
		<string></string>
		<key>BootUefi</key>
		<true/>
		<key>CPU</key>
		<string>default</string>
		<key>CPUCount</key>
		<integer>4</integer>
		<key>ForceMulticore</key>
		<true/>
		<key>JITCacheSize</key>
		<integer>0</integer>
		<key>MachineProperties</key>
		<string>vmport=off</string>
		<key>Memory</key>
		<integer>6144</integer>
		<key>RngEnabled</key>
		<true/>
		<key>SystemUUID</key>
		<string>76B82A01-D732-4B58-B385-2A9294099495</string>
		<key>Target</key>
		<string>q35</string>
		<key>UseHypervisor</key>
		<false/>
	</dict>
</dict>
</plist>
@ktprograms
Copy link
Contributor

Can you share the debug log when running the VM in v2? I'm interested to see if the setsockopt failed errors show up there as well.

@Meligy
Copy link
Author

Meligy commented Jan 26, 2022

Unfortunately it's there!

That was a promising one :/

Running:  -L "/Applications/UTM 2.app/Contents/Resources/qemu" -S -qmp tcp:127.0.0.1:4000,server,nowait -nodefaults -vga none -spice "unix=on,addr=/Users/meligy/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/76B82A01-D732-4B58-B385-2A9294099495.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=off" -device virtio-vga -smp cpus=4,sockets=1,cores=4,threads=1 -machine q35,vmport=off -accel tcg,thread=multi,tb-size=1536 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -drive "if=pflash,format=raw,unit=0,file=/Applications/UTM 2.app/Contents/Resources/qemu/edk2-x86_64-code.fd,readonly=on" -drive if=pflash,format=raw,unit=1,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/efi_vars.fd -boot menu=on -m 6144 -device intel-hda -device hda-duplex -name Ubuntu -usb -device usb-tablet,bus=usb-bus.0 -device ich9-usb-ehci1,id=usb-controller-0 -device ich9-usb-uhci1,masterbus=usb-controller-0.0,firstport=0,multifunction=on -device ich9-usb-uhci2,masterbus=usb-controller-0.0,firstport=2,multifunction=on -device ich9-usb-uhci3,masterbus=usb-controller-0.0,firstport=4,multifunction=on -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device ide-hd,bus=ide.0,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/disk-0.qcow2,cache=writethrough -device ide-cd,bus=ide.1,drive=drive1,bootindex=1 -drive if=none,media=cdrom,id=drive1 -device e1000,mac=76:0D:A8:73:7B:35,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2200-0.0.0.0:22 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -uuid 76B82A01-D732-4B58-B385-2A9294099495 -rtc base=localtime
qemu-x86_64-softmmu: -accel tcg,thread=multi,tb-size=1536: warning: Guest expects a stronger memory ordering than the host provides
This may cause strange/hard to debug errors
qemu-x86_64-softmmu: warning: global PIIX4_PM.disable_s3=1 not used
qemu-x86_64-softmmu: warning: Spice: playback:0 (0x13b8a1150): setsockopt failed, Operation not supported on socket
qemu-x86_64-softmmu: warning: Spice: record:0 (0x13b8a1200): setsockopt failed, Operation not supported on socket

@conath conath added the bug Something isn't working label Jan 27, 2022
@Meligy
Copy link
Author

Meligy commented Feb 28, 2022

FYI this is still an issue on v3.1.2 (Beta).

@osy osy added this to the v3.1 milestone Feb 28, 2022
@osy
Copy link
Contributor

osy commented Feb 28, 2022

@Meligy is it possible to leave guest address blank? Or does it default to 0.0.0.0? 0.0.0.0 is incorrect and seems to show up due to apple changing SwiftUI to show it as a label...

@Meligy
Copy link
Author

Meligy commented Feb 28, 2022

OK. Good news. v3.1.2 (Beta) actually worked!

After more investigation I found that it seemed like it's not working because of #2353.

Following the gallery guide Networking is unavailable after switching between Console Only and Full Graphics modes worked around it, and it worked just fine afterwards.

To be honest, there might be a chance that this whole issue was #2353 and I didn't notice. But if it was #2353, it wouldn't work on v2 either. So, not sure.

Anyway, just for completeness sake, here's also some log from removing 0.0.0.0 :

Running:  -L /Applications/UTM.app/Contents/Resources/qemu -S -qmp tcp:127.0.0.1:4000,server,nowait -nodefaults -vga none -spice "unix=on,addr=/Users/meligy/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/76B82A01-D732-4B58-B385-2A9294099495.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=off" -device virtio-vga -device virtio-rng-pci -smp cpus=4,sockets=1,cores=4,threads=1 -machine q35,vmport=off -accel tcg,thread=multi,tb-size=1536 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -drive if=pflash,format=raw,unit=0,file=/Applications/UTM.app/Contents/Resources/qemu/edk2-x86_64-code.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/efi_vars.fd -boot menu=on -m 6144 -device intel-hda -device hda-duplex -name Ubuntu -usb -device usb-tablet,bus=usb-bus.0 -device nec-usb-xhci,id=usb-controller-0 -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device ide-hd,bus=ide.0,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/disk-0.qcow2,cache=writethrough -device ide-cd,bus=ide.1,drive=drive1,bootindex=1 -drive if=none,media=cdrom,id=drive1 -device e1000,mac=2E:CD:FD:B3:4C:6F,netdev=net0 -netdev user,id=net0,dns=1.1.1.1,hostfwd=tcp:127.0.0.1:2200-:22 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0 -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1 -uuid 76B82A01-D732-4B58-B385-2A9294099495 -rtc base=localtime
qemu-x86_64-softmmu: -accel tcg,thread=multi,tb-size=1536: warning: Guest expects a stronger memory ordering than the host provides
This may cause strange/hard to debug errors
qemu-x86_64-softmmu: warning: global PIIX4_PM.disable_s3=1 not used
qemu-x86_64-softmmu: warning: Spice: playback:0 (0x12208b150): setsockopt failed, Operation not supported on socket
qemu-x86_64-softmmu: warning: Spice: record:0 (0x12208b200): setsockopt failed, Operation not supported on socket

When I closed the VM though, I couldn't return 0.0.0.0 to compare the output, until I ran:

lsof -ti:2200 | xargs kill -9

And then I returned 0.0.0.0, and the log was:

Running:  -L /Applications/UTM.app/Contents/Resources/qemu -S -qmp tcp:127.0.0.1:4000,server,nowait -nodefaults -vga none -spice "unix=on,addr=/Users/meligy/Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/76B82A01-D732-4B58-B385-2A9294099495.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=off" -device virtio-vga -device virtio-rng-pci -smp cpus=4,sockets=1,cores=4,threads=1 -machine q35,vmport=off -accel tcg,thread=multi,tb-size=1536 -global PIIX4_PM.disable_s3=1 -global ICH9-LPC.disable_s3=1 -drive if=pflash,format=raw,unit=0,file=/Applications/UTM.app/Contents/Resources/qemu/edk2-x86_64-code.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/efi_vars.fd -boot menu=on -m 6144 -device intel-hda -device hda-duplex -name Ubuntu -usb -device usb-tablet,bus=usb-bus.0 -device nec-usb-xhci,id=usb-controller-0 -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device ide-hd,bus=ide.0,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=/Users/meligy/Library/Containers/com.utmapp.UTM/Data/Documents/Ubuntu.utm/Images/disk-0.qcow2,cache=writethrough -device ide-cd,bus=ide.1,drive=drive1,bootindex=1 -drive if=none,media=cdrom,id=drive1 -device e1000,mac=2E:CD:FD:B3:4C:6F,netdev=net0 -netdev user,id=net0,dns=1.1.1.1,hostfwd=tcp:127.0.0.1:2200-0.0.0.0:22 -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0 -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1 -uuid 76B82A01-D732-4B58-B385-2A9294099495 -rtc base=localtime
qemu-x86_64-softmmu: -accel tcg,thread=multi,tb-size=1536: warning: Guest expects a stronger memory ordering than the host provides
This may cause strange/hard to debug errors
qemu-x86_64-softmmu: warning: global PIIX4_PM.disable_s3=1 not used
qemu-x86_64-softmmu: warning: Spice: playback:0 (0x12e008950): setsockopt failed, Operation not supported on socket
qemu-x86_64-softmmu: warning: Spice: record:0 (0x12e008a00): setsockopt failed, Operation not supported on socket

At this stage, all I know is:

  • This issue was happening in v3.0.4 [bad]
  • This issue is not happening in v2.4.1 [good]
  • This issue is not happening in v3.1.2 (Beta) [good]
  • Another issue (Automatic DNS doesn't work in the guest #2353) is happening in v3.1.2 (Beta), but that's OK because there's a workaround

For all I care, this issue is closed since it's not happening in v3.1.2 (Beta).

I might reopen it if it happens again in future versions.

Thanks heaps for looking into it.

@Meligy Meligy closed this as completed Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants