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

VNC Connection not working in UNRAID #134

Closed
servebeer opened this issue Jan 29, 2024 · 28 comments
Closed

VNC Connection not working in UNRAID #134

servebeer opened this issue Jan 29, 2024 · 28 comments

Comments

@servebeer
Copy link

I just installed the WindowsinDocker application for UNRAID from Community Apps last week. It appeared to be running but I kept getting VNC errors (I could see Windows in the background, just no mouse or keyboard support). Over the weekend, several updates appear to have been pushed, and now when I start the container, I get "Failed to connect to the server" VNC errors. The docker logs don't really show any issues:

BdsDxe: loading Boot0004 "Windows Boot Manager" from HD(2,GPT,D8FCFBA8-615F-498C-AF32-8838F29C586C,0x96800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi
BdsDxe: starting Boot0004 "Windows Boot Manager" from HD(2,GPT,D8FCFBA8-615F-498C-AF32-8838F29C586C,0x96800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi

Any ideas why VNC appears to be broken on UNRAID systems?

@kroese
Copy link
Contributor

kroese commented Jan 29, 2024

Where exactly do you see that message "Failed to connect to the server"?

Can you connect via RDP (username: docker, empty password)?

@servebeer
Copy link
Author

So, it appears that the issue is with how UNRAID is doing networking. By default, it wants to use "Bridge" as the network type. If I try to use it them VNC doesn't work and it can't access the Internet as it is somehow getting a 20.20.20.x address. This range is not defined either on the local network or within UNRAID. If I edit the config and tell it to use the custom defined "br0" network (which maps to my physical, local network), then VNC and RDP do work, but the VM still can't get to the Internet as it is still trying to use a 20.20.20.x address, even though I specifically assigned it to 192.168.100.26. Even running a "ipconfig /renew" pulls that 20.20.20.x address. The br0 network should route the DHCP request to my local physical network and thus pull a 192.168.100.0/24 address, correct?

Screenshot 2024-01-29 090858
Screenshot 2024-01-29 091003

@servebeer
Copy link
Author

If it helps, here is a screen-shot of my container config:

Screenshot 2024-01-29 091822

@kroese
Copy link
Contributor

kroese commented Jan 29, 2024

If you want to use the br0 network in unRaid, you must set DHCP=Y container variable or it will not work. See here: https://github.com/qemus/qemu-docker#how-can-the-vm-acquire-an-ip-address-from-my-router how to do it.

That it gets the 20.20.20.x address when DHCP=N is completely normal and by design. It is because I have to tunnel the traffic via NAT from the container IP to the VM and I use this dummy IP address for that. It was not possible to keep the same IP as the container has, so I choose 20.20.20.21. Aside from Windows not knowing its Docker IP, it should give no problem at all. And because the container and the VM have a different IP it allows you to reach port 8006 on the container.

So I have no idea why you have problems with bridge networking, you are the first one. But in any case you can set unraid br0 to macvlan (NOT ipvlan mode) and enable DHCP=Y and there will be no more NAT, no more tunnel, and no more 20.20.20.21. So that should solve your issue.

@servebeer
Copy link
Author

Ah Ha! That makes sense now. Sorry about the confusion and I do appreciate the quick help! One more question, what is the best what to create multiple containers (i.e. several workstations, a couple of servers, etc.) for a lab environment?

@servebeer
Copy link
Author

@kroese "set unraid br0 to macvlan (NOT ipvlan mode)" brings up a whole other issue. I had been using macvlan ever since I first started using UNRAID until I started having random server crashes. The UNRAID people told me to us ipvlan, and since I changed, I have not had any issues. Do I have to use macvlan, or is there a way to make ipvlan work?

@kroese
Copy link
Contributor

kroese commented Jan 29, 2024

The DHCP=Y mode uses a macvtap interface and this doesnt work with ipvlan, because the traffic is delivered to a mac-address.

I never used unRaid, but if you say its unstable with macvlan, they should fix that issue instead of forcing all users to use ipvlan I would say.

@servebeer
Copy link
Author

Thanks for the follow-up. I am trying to revert back to macvlan. UNRAID is not happy with it as the docker service refuses to start now. I am going to reboot the UNRAID server and see if that helps.

@servebeer
Copy link
Author

I am thinking that UNRAID does not like WindowsinDocker. I have it reconfigured to use macvlan and I am using the bro network. Now I am getting a new error.

Screenshot 2024-01-29 111711

@servebeer
Copy link
Author

I tried adding --device-cgroup-rule='c : rwm' to "Post Agruments", but the image still will not start. I'll keep playing around with it to see if I can get it to work.

@servebeer
Copy link
Author

Well, I have made some progress. I needed to add "--device-cgroup-rule='c : rwm'" to the "Extra Parameters:" under the advanced settings. Now, I have a local IP and it can talk to the Internet. VNC is working fine, but RDP is not. I can live with this, but will try to figure out why RDP isn't working.

@servebeer
Copy link
Author

I think that I finally have this working!

@kroese
Copy link
Contributor

kroese commented Jan 29, 2024

I made a pullrequest to the WindowsinDocker template so that it automaticly includes this device-cgroup-rule from now on. That will make it easier for anyone else in the future.

Very strange that RDP is not working? Unless you enabled the firewall in Windows or something?

@servebeer
Copy link
Author

That's the first thing that I thought of. I am going to do a packet capture while trying to connect via RDP and see if that tells me anything.

@servebeer
Copy link
Author

So, yet another issue has arisen. I don't think this is going to play well with UNRAID. I have 1 instance running fine now, so I tried to create a 2nd instance (my goal was to try and build an AD Domain for testing. UNRAID currently supports running up to 2 instances of the same container. However, once I set it up with the exact same settings as the 1st container, it hangs at "Initializing Network" and when I look at the logs, it continuously displays:

RTNETLINK answers: Address already in use
❯ Waiting for address to become available...

I think I will just go back to building full Windows vm's for testing at this time.

I appreciate all of the help trying to get this to work!

@kroese
Copy link
Contributor

kroese commented Jan 29, 2024

I think it is because I set a fixed MAC address in the code (I never anticipated people running multiple instances). But you can easily workaround it by adding a container variable called MAC and set it to a random mac address. As long as it is not 82:cf:d0:5e:57:66 because that is the hardcoded value.

@servebeer
Copy link
Author

Cool, let me give that a shot!

@servebeer
Copy link
Author

Well, I think this might be more trouble than its worth. I am guessing that the storage might be hard-coded as well? I say that because I got the second instance to load, download Win 11, do the initial install, but when it reboots from that, it errors-out with:

BdsDxe: failed to load Boot0002 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0): Not Found
BdsDxe: loading Boot0001 "UEFI QEMU QEMU CD-ROM " from PciRoot(0x0)/Pci(0x5,0x0)/Scsi(0x0,0x0)
BdsDxe: starting Boot0001 "UEFI QEMU QEMU CD-ROM " from PciRoot(0x0)/Pci(0x5,0x0)/Scsi(0x0,0x0)

@kroese
Copy link
Contributor

kroese commented Jan 29, 2024

Are you sure you are pointing both containers to a different /storage folder?

@servebeer
Copy link
Author

servebeer commented Jan 29, 2024 via email

@kroese
Copy link
Contributor

kroese commented Feb 4, 2024

Any updates?

@HeresJonny
Copy link

I think that the issue title is misleading because several issues are mixed here. VNC connection is also problematic in MS Edge, regardless of network settings. However, for network issues:

After your network changes, did you try to uninstall the network device without deleting the driver and then let windows redetect hardware ?

@kroese
Copy link
Contributor

kroese commented Feb 6, 2024

@HeresJonny What problems did you experience with the VNC viewer in Edge?

@HeresJonny
Copy link

I don't really wish to hijack this thread, but noVNC will not work in a normal MS Edge (Version 121.0.2277.106) tab, showing error "Failed to connect to server". It works in a In-Private-Tab, however. Seems to be a websockify problem. There are several reports about this on the internet but short of "update the browser" I haven't found a solution. The console output is

rfb.js:101  noVNC requires a secure context (TLS). Expect crashes!
RFB @ rfb.js:101
connect @ ui.js:1044
start @ ui.js:126
(anonym) @ ui.js:48
Promise.then (asynchron)
prime @ ui.js:46
(anonym) @ ui.js:1768
websock.js:231  WebSocket connection to 'ws://192.168.1.185:8006/websockify' failed: 
open @ websock.js:231
_connect @ rfb.js:551
_updateConnectionState @ rfb.js:903
RFB @ rfb.js:279
connect @ ui.js:1044
start @ ui.js:126
(anonym) @ ui.js:48
rfb.js:686  WebSocket on-error event
_socketError @ rfb.js:686
_websocket.onerror @ websock.js:268
error (asynchron)
attach @ websock.js:266
open @ websock.js:231
_connect @ rfb.js:551
_updateConnectionState @ rfb.js:903
RFB @ rfb.js:279
connect @ ui.js:1044
start @ ui.js:126
(anonym) @ ui.js:48
Promise.then (asynchron)
prime @ ui.js:46
(anonym) @ ui.js:1768
rfb.js:941  Failed when connecting: Connection closed (code: 1006)
_fail @ rfb.js:941
_socketClose @ rfb.js:660
_websocket.onclose @ websock.js:262
192.168.1.185/:1  The resource http://192.168.1.185:8006/app/images/info.svg was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

@kroese
Copy link
Contributor

kroese commented Feb 7, 2024

@HeresJonny Are you sure it isnt caused by some extension/adblocker? Because for me it works on MS Edge on Win11 without a private tab?

@HeresJonny
Copy link

@kroese Definitely weird. I've tried disabling all extensions and settings that would block stuff, but no change. Win10 here.

@HeresJonny
Copy link

OK, I've tried on my wife's notebook with W11 and it works there. Will check all my settings again.

@kroese
Copy link
Contributor

kroese commented Feb 7, 2024

My version of Edge is 121.0.2277.98 so its even a bit older than yours. Maybe you can make it work by clearing the browser cache because I believe in 'Private' incognito mode it does not use the cache so it could explain why it works there.

@kroese kroese closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants