After copying .img and windows.* to a new location, the container fails to start
Operating system
ubuntu 22.04
Description
Whenever I copy the data.img/qcow2 and windows.* files to another location and then run a new container, I always get the following error: "ERROR: Failed to start TPM emulator". I am not sure what might be causing this issue. Could you please provide some guidance on how to resolve this problem? Thank you!
Docker compose
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: win
spec:
template:
metadata:
labels:
app: win
spec:
containers:
- name: windows
image: dockurr/windows:latest
imagePullPolicy: IfNotPresent
env:
- name: VERSION
value: "win10x64"
- name: DISK_FMT
value: "qcow2"
- name: MANUAL
value: "N"
- name: TPM
value: "N"
- name: DEBUG
value: "Y"
- name: ARGUMENTS
value: "-device vfio-pci,host=01:00.0,multifunction=on -device vfio-pci,host=01:00.1,multifunction=on -device usb-host,vendorid=0x1a2c,productid=0x6004 -device usb-host,vendorid=0x1c4f,productid=0x0034 -device virtio-mouse-pci"
- name: RAM_SIZE
value: "8G"
- name: CPU_CORES
value: "8"
- name: DISK_SIZE
value: "32G"
ports:
containerPort: 8006
hostPort: 8006
- protocol: UDP
containerPort: 8006
hostPort: 8006
volumeMounts:
- name: base-qcow
mountPath: /storage
- mountPath: /dev/kvm
name: dev-kvm
securityContext:
privileged: true
volumes:
- name: base-qcow
nfs:
server: 192.168.5.71
path: /data/disk2/base_qcow2
readOnly: true
- name: dev-kvm
hostPath:
path: /dev/kvm
Docker log
Most of the time prompts:
root@user-MS-7E44:/home/user/script/k8s# kubectl logs win-1-xshjp -c windows ❯ Starting Windows for Docker v0.0... ❯ For support visit https://github.com/dockur/windows ❯ CPU: 12th Gen Intel Core TM i5 12400 | RAM: 11/16 GB | DISK: 195 GB (ext4) | HOST: 6.8.0-47...
❯ Detected that the version was changed, but ignoring this because Windows is already installed. ❯ Please start with an empty /storage folder, if you want to install a different version of Windows. ❯ Host: win-1-xshjp IP: 10.42.0.119 Gateway: 10.42.0.1 Interface: eth0 MAC: 02:1D:D6:15:DB:8E nameserver 10.43.0.10
swtpm: Could not open UnixIO socket: Permission denied ❯ ERROR: Failed to start TPM emulator, reason: 0
Occasionally prompt: kubectl logs win-1-ks8lg -c windows ❯ Starting Windows for Docker v0.0... ❯ For support visit https://github.com/dockur/windows ❯ CPU: 12th Gen Intel Core TM i5 12400 | RAM: 11/16 GB | DISK: 195 GB (ext4) | HOST: 6.8.0-47...
❯ Detected that the version was changed, but ignoring this because Windows is already installed. ❯ Please start with an empty /storage folder, if you want to install a different version of Windows. ❯ Host: win-1-ks8lg IP: 10.42.0.123 Gateway: 10.42.0.1 Interface: eth0 MAC: 02:1D:D6:15:DB:8E nameserver 10.43.0.10
RTNETLINK answers: File exists ❯ ERROR: Failed to create bridge. Please add the following setting to your container: --cap-add NET_ADMIN ❯ Warning: falling back to usermode networking! Performance will be bad and port forwarding will not work. swtpm: Could not open UnixIO socket: Permission denied ❯ ERROR: Failed to start TPM emulator, reason: 0
Screenshots (optional)
No response
I am not sure why the TPM emulator cannot start, but that is not important because it is not required (especially not for Win10 which you seem to be running).
Also it says Windows for Docker v0.0 instead of the version number. So I have no idea which version your are running?
So I have no clue whats happening. Are you sure you copy the full folder (and not half of the files)?
I am not sure why the TPM emulator cannot start, but that is not important because it is not required (especially not for Win10 which you seem to be running).
Also it says
Windows for Docker v0.0instead of the version number. So I have no idea which version your are running?So I have no clue whats happening. Are you sure you copy the full folder (and not half of the files)?
If I remember correctly, the directory should contain a data.img and several windows.* files. However, data.qcow2 and windows.* may not match. Here I used qemu's "backing file" feature, and redirected several sub-data.qcow2 (only a few hundred k) from the same main data.qcow2, and then copied the windows.* of the main data.qcow2 to the sub-data.qcow2 location. Will this have any impact? I once encountered the same problem when verifying on docker compose. Later, I circumvented the problem by deleting windows.* and regenerating data.qcow2. Then I used "qemu-img create" to redirect the sub-data.qcow2 back to the mother disk of the system, so that multiple VMs could be started on the sub-disks. However, I am still not sure about the source and cause of the problem.
@lcax200000 Solved? And how?
@lcax200000 Solved? And how?
yes, I reinstalled the Windows system based on the qcow2 format and it started successfully. Multiple VMs used qcow2 files from the same backing-file, which can achieve copy-on-write of system disk files.