windows icon indicating copy to clipboard operation
windows copied to clipboard

no connection to the Internet

Open jack85811 opened this issue 1 year ago • 11 comments

Operating system

latest debian

Description

hi i run the setup in a kubernetes cluster and i experience a weird issue with the internet connection. I'm aware that what i'm about to say is not helpful for tracing but maybe you know/had the issue too i use win 11 and it runs perfectly at start. i opened a new port 5000 where i run a .net service for automation purposes. everything is reachable and runs smoothly, but the container looses the internet connection randomly. when the internet connection is lost i can't access the port 5000 from the outside anymore, but i can still connect to the machine via vnc(which is super strange). the connection loss also happens when i do not run the service, e.g. when browsing or when i opened up outlook(so not predictable).

i've also asked chatgpt since i have no experience with windows at all an i've attached screenshots that it asked me to do. it didn't fix it so might be a hallucination. if this doesn't make sense or if it hallucinated, then please just skip it but maybe it is helpful for you.:

🚨 Root Cause

This is the classic SLiRP (user-mode QEMU NAT) freeze inside long-running dockurr/windows containers.
It happens because:

SLiRP’s NAT process runs in userspace inside QEMU.

Under sustained connections (like your .NET service), it leaks or deadlocks network descriptors.

Eventually, the NAT thread stops forwarding — but the guest NIC still looks “up”.

That’s why:

You can RDP (because RDP may use a different channel or cached route).

ping and .NET server stop responding.

Reboot or network reset temporarily fixes it.

for now i just have a livenessprobe that will restart the container (then it s fine again until it breaks again).

if you need anything else please let me know! thanks in advance

Docker compose

apiVersion: apps/v1
kind: StatefulSet
metadata:
  annotations:
    meta.helm.sh/release-name: windows
    meta.helm.sh/release-namespace: default
  creationTimestamp: "2025-10-13T07:28:14Z"
  generation: 23
  labels:
    app.kubernetes.io/instance: windows
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: windows-vm
    helm.sh/chart: windows-vm-0.1.0
  name: windows-windows-vm
  namespace: default
  resourceVersion: "52426870264"
  uid: 619299ce-8434-4832-98e2-ce5557e7ef74
spec:
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Retain
    whenScaled: Retain
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: windows
      app.kubernetes.io/name: windows-vm
  serviceName: windows-windows-vm-headless
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: windows
        app.kubernetes.io/name: windows-vm
    spec:
      affinity: {}
      containers:
      - env:
        - name: VERSION
          value: "11"
        - name: DISK_SIZE
          value: 64G
        - name: CPU_CORES
          value: "4"
        - name: RAM_SIZE
          value: 13G
        - name: USER_PORTS
          value: "5000"
        - name: PORTS
          value: 5000:5000
        - name: NETWORK
          value: user
        image: dockurr/windows:latest
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /health
            port: 5000
            scheme: HTTP
          initialDelaySeconds: 120
          periodSeconds: 20
          successThreshold: 1
          timeoutSeconds: 5
        name: windows
        ports:
        - containerPort: 8006
          name: web
          protocol: TCP
        - containerPort: 3389
          name: rdp
          protocol: TCP
        - containerPort: 3389
          name: udp
          protocol: UDP
        - containerPort: 5900
          name: vnc
          protocol: TCP
        - containerPort: 5000
          name: app5000
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /health
            port: 5000
            scheme: HTTP
          initialDelaySeconds: 120
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        resources:
          limits:
            cpu: "4"
            memory: 16G
          requests:
            cpu: "2"
            memory: 13G
        securityContext:
          capabilities:
            add:
            - NET_ADMIN
          privileged: true
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /storage
          name: storage
        - mountPath: /dev/kvm
          name: dev-kvm
        - mountPath: /dev/net/tun
          name: dev-tun
      dnsPolicy: ClusterFirst
      nodeSelector:
        windows: "true"
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 120
      volumes:
      - hostPath:
          path: /dev/kvm
          type: CharDevice
        name: dev-kvm
      - hostPath:
          path: /dev/net/tun
          type: CharDevice
        name: dev-tun
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
  - apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      creationTimestamp: null
      name: storage
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 64Gi
      volumeMode: Filesystem
    status:
      phase: Pending

Docker log

❯ Starting Windows for Docker v5.08...
❯ For support visit https://github.com/dockur/windows
❯ CPU: AMD EPYC 7543 | RAM: 15/16 GB | DISK: 42 GB (ext4) | KERNEL: 6.8.0-85...

❯ Nested KVM virtualization detected..
❯ Warning: your configured RAM_SIZE of 13 GB is very close to the 15 GB of memory available, please consider a lower value.
❯ Booting Windows using QEMU v10.0.3...
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
BdsDxe: loading Boot0004 "Windows Boot Manager" from HD(1,GPT,5B21FEA4-CF90-4EEA-97AD-F6B58A77568C,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi
BdsDxe: starting Boot0004 "Windows Boot Manager" from HD(1,GPT,5B21FEA4-CF90-4EEA-97AD-F6B58A77568C,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi
❯ Windows started successfully, visit http://127.0.0.1:8006/ to view the screen...

Screenshots (optional)

Image Image Image Image

jack85811 avatar Oct 14 '25 10:10 jack85811

The ChatGPT answer is about Slirp, but the latest version of the container does not use Slirp anymore but Passt by default. So instead of

- name: NETWORK
          value: user

you could specifically pick Slirp:

- name: NETWORK
          value: slirp

and see if it makes a difference?

Also, I am not sure why you are using user-mode networking in the first place. What problem did you encounter that made you add this NETWORK=user flag? Because as far as I remember it should also work in Kubernetes with the normal networking.

kroese avatar Oct 14 '25 11:10 kroese

i've tried using slrip but then i get this issue: ❯ ERROR: qemu-system-x86_64: -netdev user,id=hostnet0,ipv4=on,host=100.64.45.1,net=100.64.45.0/24,dhcpstart=100.64.45.69,hostname=Windows,5000,3389: Invalid parameter '3389'

i'll try the default option with passt and see how if it comes up. i tried the user flag, becasue slrip didn't work and it looked like my only option.

i'll report and let you know if it happens again, i hope it solves it!

so far thanks for your insanely quick reply :)

jack85811 avatar Oct 14 '25 11:10 jack85811

okay that went quick. so the internet issue still persists and it even arises quicker in the passt mode then in the user mode:

Image

but at least the port 5000 is still available internally in my cluster which is my only use case so far.

still very weird :(

jack85811 avatar Oct 14 '25 12:10 jack85811

Oh, it seems I introduced a bug in the slirp code, I will fix it right away. But since Slirp is not used anymore (unless explicitly specified) it luckily does not affect many users.

Normally the container using tuntap networking with NAT tunneling. This uses kernel-mode networking and has pretty good performance (but not so good as macvtap networking which is used when you set DHCP=Y). Only if there is a problem (like in Podman containers who run in rootless mode), it switches to user-mode networking (lowest performance).

But your container has privileged: true so there should not be any reason to have user-mode networking. So what was your original problem that you encountered before you added the NETWORK=user flag? Because it seems to make more sense to tackle that instead.

kroese avatar Oct 14 '25 12:10 kroese

my use case is mostly to have my app internally availble. on port 5000. so that seems to fine now. but i'll let you know more as time passes

jack85811 avatar Oct 14 '25 12:10 jack85811

@kroese i can attest that it doesn't restart anymore which is awesome! the issue with the internet connection is still there. any idea what could cause it?

jack85811 avatar Oct 15 '25 12:10 jack85811

No, not really.. what do you get when you execute ping google.com? Because that message from Test-COnnection: Error due to lack of resources is not really helpful.

kroese avatar Oct 15 '25 12:10 kroese

Image

jack85811 avatar Oct 17 '25 07:10 jack85811

Using NETWORK: user provides full IPv6 access and UPnP support.

chunfengyao avatar Oct 30 '25 11:10 chunfengyao

hi guys, i forgot to update you but indeed the issue is gone! It works now and no issues appear!

jack85811 avatar Oct 30 '25 14:10 jack85811

@kroese After changing NET_OPTS in network.sh from

NET_OPTS="-netdev stream,id=hostnet0,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket"

to

NET_OPTS="-netdev user,id=hostnet0"

The Windows guest network works correctly. However the /shared/ directory can no longer be mounted into the Windows guest through passt.

Could this issue be caused by the stream-based communication provided by passt?

chunfengyao avatar Oct 31 '25 10:10 chunfengyao