qemus / qemu-docker

QEMU in a Docker container.
MIT License
318 stars 35 forks source link

Windows VM: New Network Profiles Generated on Reboot #532

Open apostrophize opened 1 month ago

apostrophize commented 1 month ago

Operating system

Debian 12

Description

I've set up a QEMU virtual machine running Windows. The virtual machine has been successfully installed, and I've manually installed Virtio drivers for networking. However, whenever I initiate a reboot or restart of the virtual machine / Docker container, a new network profile is created (e.g., "Network 2", "Network 3", etc.).

Attempts: I've tried setting the environment variable "MAC=[generic MAC address]" to ensure consistent network interface identification across reboots, but this hasn't resolved the issue.

Expected Behavior: Ideally, the network profile should remain consistent across reboots.

Docker compose

  qemu:
    image: qemux/qemu-docker
    container_name: qemu
    cap_add:
      - NET_ADMIN
    environment:
      - BOOT_MODE=windows
      - DISK_SIZE=256G
      - CPU_CORES=4
      - RAM_SIZE=8G
      - ARGUMENTS=-rtc base=localtime
    volumes:
      - ./QEMU:/storage
    ports:
      - 8006:8006
      - 3389:3389
    devices:
      - /dev/kvm
    stop_grace_period: 2m
    restart: on-failure

Docker log

BdsDxe: loading Boot0004 "Windows Boot Manager" from HD(1,GPT,7A2A63BB-FF5D-4F22-9A44-F6722016A7EA,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi
BdsDxe: starting Boot0004 "Windows Boot Manager" from HD(1,GPT,7A2A63BB-FF5D-4F22-9A44-F6722016A7EA,0x800,0x32000)/\EFI\Microsoft\Boot\bootmgfw.efi

Screenshots (optional)

image

kroese commented 3 weeks ago

@apostrophize Sorry, somehow I did not see your message until now? Is there any reason why you are using this container, and not my other container: dockur/windows because that one is completely designed to run Windows and this one for Linux.

Im curious if you have the same issue with dockur/windows too.

apostrophize commented 3 weeks ago

My bad @kroese, GitHub doesn't like email aliases so my account was restricted for a while there.

I did try dockur/windows, and while it works well, the same issue with network profiles being created upon a restart of the container persists. I prefer this container for its flexibility and simplicity, which better suits my use case, and besides this minor inconvenience of manually having to remove the excess network profiles with regedit on Windows, it works wonderfully.

Here’s a screenshot showing the Windows 10 desktop after the container has just restarted; as far as I know, Windows 11 does not show this type of notification panel.

image

Is there a specific configuration or setting within this container that could help maintain a consistent network profile across reboots? Any suggestions or guidance would be greatly appreciated.

Thank you!

kroese commented 2 weeks ago

I never noticed this issue myself, and I also didnt see anyone ever report it before. So it looks like it is specific to your system, but I have no clues as what might be causing it.

I would expect this behaviour for example when the MAC address of the network adaptor changes. But I generate this address a single time, then store it in /storage/qemu.mac and every reboot it re-uses that MAC address that it used previously. So it should not change after a reboot, but maybe you can verify from within Windows if it has the correct MAC.

Besides the MAC address, I do not know what other factors can cause Windows to see the network adaptor as a new device. You can set NETWORK: "user" to enable usermode networking, and see if it changes anything.

Or maybe its related to some Docker settings, that assigns a different subnet/gateway ip for the container each time, causing it to think the network has changed. Its difficult to pinpoint whats going on without knowing exactly what are the conditions that Windows uses to mark a network as new.

duckIing commented 2 weeks ago

same problem in win2k22 vm