dockur / windows

Windows inside a Docker container.
MIT License
18.07k stars 1.58k forks source link

ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311) #303

Closed Dialgatrainer02 closed 6 months ago

Dialgatrainer02 commented 7 months ago

docker logs output

Extracting Windows 11 bootdisk...
❯ Extracting Windows 11 environment...
❯ Extracting Windows 11 setup...
❯ Extracting Windows 11 image...
❯ Adding XML file for automatic installation...
❯ Building Windows 11 image...
❯ Creating a 64G growable disk image in raw format...
open: No such device
❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
❯ Starting Windows for Docker v2.07...
❯ For support visit https://github.com/dockur/windows

docker info

Client:
 Version:    25.0.4
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  2.24.7
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 9
  Running: 0
  Paused: 0
  Stopped: 9
 Images: 8
 Server Version: 25.0.2
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7c3aca7a610df76212171d200ca3811ff6096eb8.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.7.4-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 11.35GiB
 Name: vanir
 ID: ee123b64-85b9-4cf2-86a3-a05b25277372
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

docker version

Client:
 Version:           25.0.4
 API version:       1.44
 Go version:        go1.22.1
 Git commit:        1a576c50a9
 Built:             Wed Mar 13 15:44:41 2024
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          25.0.2
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       fce6e0ca9b
  Built:            Thu Feb  1 10:50:44 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.13
  GitCommit:        7c3aca7a610df76212171d200ca3811ff6096eb8.m
 runc:
  Version:          1.1.12
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

compose file

version: "3"
services:
  windows:
    image: dockurr/windows
    container_name: windows
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3389:3389/tcp
      - 3389:3389/udp
    volumes:
      - ./windows:/storage
    stop_grace_period: 2m
    environment:
      VERSION: "win11"
    restart: on-failure
kroese commented 7 months ago

Can you try adding this to the compose file:

    devices:
      - /dev/net/tun
rflrkn commented 7 months ago

I've got the same setup and also the same issue. Adding /dev/net/tun to the devices section of docker-compose.yaml leads to the following output for me:

WARN[0000] /home/rflrkn/windows_docker/docker-compose.yaml: `version` is obsolete 
[+] Running 0/0
 ⠋ Container windows  Recreated                                                                                                                                                                                                        0.0s 
Attaching to windows
windows  | ❯ Starting Windows for Docker v2.08...
windows  | ❯ For support visit https://github.com/dockur/windows
windows  | 
windows  | open: No such device
windows  | ❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
windows exited with code 0
SunnyPai0413 commented 7 months ago

I have the same problem when deploying windows 10 ltsc through docker portainer.

Docker error output:

[+] Successfully downloaded Windows image!
❯ Extracting Windows 10 image...
❯ Adding XML file for automatic installation...
❯ Building Windows 10 LTSC image...
❯ Creating a 64G growable disk image in raw format...
open: No such device
❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
❯ Starting Windows for Docker v2.08...
❯ For support visit https://github.com/dockur/windows
open: No such device
❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
❯ Starting Windows for Docker v2.08...
❯ For support visit https://github.com/dockur/windows
open: No such device
❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
❯ Starting Windows for Docker v2.08...
❯ For support visit https://github.com/dockur/windows
open: No such device

hostos version:

[sunnypai@storage ~]$ neofetch
sunnypai@storage
----------------
OS: Arch Linux x86_64
Host: Super Server 0123456789
Kernel: 6.7.9-arch1-1
Uptime: 18 days, 21 hours, 36 mins
Packages: 1036 (pacman)
Shell: bash 5.2.26
Resolution: 1600x900
Terminal: /dev/pts/5
CPU: AMD EPYC 7282 (32) @ 2.800GHz
GPU: NVIDIA Tesla P100 PCIe 16GB
Memory: 5891MiB / 96417MiB

compose file:

version: "3"
services:
  windows:
    image: dockurr/windows
    container_name: windows
    environment:
      VERSION: "ltsc10"
    devices:
      - /dev/kvm
      - /dev/net/tun
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3389:3389/tcp
      - 3389:3389/udp
    stop_grace_period: 2m
    restart: on-failure

docker info

 [sunnypai@storage ~]$ sudo docker info
Client:
 Version:    26.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  2.26.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 14
  Running: 12
  Paused: 0
  Stopped: 2
 Images: 14
 Server Version: 26.0.0
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7c3aca7a610df76212171d200ca3811ff6096eb8.m
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.7.9-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 32
 Total Memory: 94.16GiB
 Name: storage
 ID: b0b2ea14-1f33-4fe1-b7bf-fd87d685e07f
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

I also tried to use macvlan to config the network, but unfortunately my NIC seems not supporting this function: e3ab94771e0c9b97d90d8458bdf58811

Can you give me further advise? Thank you for your assistant, and wish you a pleasant day!

Dialgatrainer02 commented 7 months ago

I literally just fixed by rebooting although you might not be so lucky

kroese commented 7 months ago

@SunnyPai0413 Try adding privileged: true to your compose file.

SunnyPai0413 commented 7 months ago

@kroese It still appears as this:

❯ Starting Windows for Docker v2.08...
❯ For support visit https://github.com/dockur/windows
open: No such device
❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
❯ Starting Windows for Docker v2.08...
❯ For support visit https://github.com/dockur/windows
open: No such device
❯ ERROR: Status 1 while: ip tuntap add dev "$VM_NET_TAP" mode tap (line 170/311)
❯ Starting Windows for Docker v2.08...
❯ For support visit https://github.com/dockur/windows

And here's the docker compose file:

version: "3"
services:
  windows:
    image: dockurr/windows
    container_name: windows
    environment:
      VERSION: "ltsc10"
    devices:
      - /dev/kvm
      - /dev/net/tun
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3389:3389/tcp
      - 3389:3389/udp
    privileged: true
    stop_grace_period: 2m
    restart: on-failure
rflrkn commented 6 months ago

Any updates on this?

Dialgatrainer02 commented 6 months ago

Reboot fixed it

kroese commented 6 months ago

@rflrkn This error sounds like the TUN kernel module is not loaded (on most Linux distros it is loaded by default). So can you paste the output of these commands:

lsmod | grep tun
modprobe tun

to see if your system has the TUN module and can load it?

rflrkn commented 6 months ago

Oh my god, yes, of course. TUN module just wasn't loaded properly. That was the issue. Thanks! :)