The goal is to be able to modify the KVM environment variable "ARGUMENTS" based on the external environment variable "GPU_INDEX" passed in when the Docker container starts, in order to externally control which GPU is used during startup.
I have successfully implemented the code to change the "ARGUMENTS" environment variable according to the "GPU_INDEX". However, it seems that the KVM does not reflect the changes and does not behave as expected.
The genARGS.py script will replace the values of pci_id1 and pci_id2 in ARGUMENTS with the PCI ID of the specified GPU
I can observe that the content of ARGUMENTS.txt is the correct value in the /run directory of the container, and confirm the addition of the line ARGUMENTS=“-device-vfio-pci,host=01:00.0,multifunctionality=on-device-vfido-pci,host=01:00.1,multifunctionarity=on” in the file /etc/profile
But the Windows screen remains black after startup, it seems that this change did not take effect. May I ask if KVM did not correctly read ARGUMENTS and why
Operating system
ubuntu 24.04
Description
The goal is to be able to modify the KVM environment variable "ARGUMENTS" based on the external environment variable "GPU_INDEX" passed in when the Docker container starts, in order to externally control which GPU is used during startup. I have successfully implemented the code to change the "ARGUMENTS" environment variable according to the "GPU_INDEX". However, it seems that the KVM does not reflect the changes and does not behave as expected.
entry.sh: `#!/usr/bin/env bash set -Eeuo pipefail
: "${BOOT_MODE:="windows"}"
APP="Windows" SUPPORT="https://github.com/dockur/windows"
cd /run
python3 genArgs.py > out.txt source /etc/profile echo $ARGUMENTS > ARGUMENTS.txt
. reset.sh # Initialize system . define.sh # Define versions . mido.sh # Download code . install.sh # Run installation . disk.sh # Initialize disks . display.sh # Initialize graphics . network.sh # Initialize network . samba.sh # Configure samba . boot.sh # Configure boot . proc.sh # Initialize processor . power.sh # Configure shutdown . config.sh # Configure arguments
trap - ERR
echo "Before running qemu: ARGUMENTS is: $ARGUMENTS" > test.txt
version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }') info "Booting ${APP}${BOOT_DESC} using QEMU v$version..."
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || : (( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
terminal ( sleep 30; boot ) & tail -fn +0 "$QEMU_LOG" 2>/dev/null & cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" & wait $! || :
sleep 1 & wait $! [ ! -f "$QEMU_END" ] && finish 0`
Among them, I added three lines of code
The genARGS.py script will replace the values of pci_id1 and pci_id2 in ARGUMENTS with the PCI ID of the specified GPU
I can observe that the content of ARGUMENTS.txt is the correct value in the /run directory of the container, and confirm the addition of the line ARGUMENTS=“-device-vfio-pci,host=01:00.0,multifunctionality=on-device-vfido-pci,host=01:00.1,multifunctionarity=on” in the file /etc/profile
But the Windows screen remains black after startup, it seems that this change did not take effect. May I ask if KVM did not correctly read ARGUMENTS and why
Docker compose
version: "3" services: windows:
image: dockurr/windows
winiso: image: nginx:latest container_name: winiso restart: on-failure volumes:
Docker log
WARN[0000] /root/cl/docker-compose.yml: the attribute
version
is obsolete, it will be ignored, please remove it to avoid potential confusion [+] Running 2/0 ✔ Container winiso Created 0.0s ✔ Container windows Recreated 0.1s Attaching to windows, winiso winiso | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration winiso | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ winiso | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh winiso | 10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled winiso | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh winiso | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh winiso | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh winiso | /docker-entrypoint.sh: Configuration complete; ready for start up winiso | 2024/09/27 12:55:16 [notice] 1#1: using the "epoll" event method winiso | 2024/09/27 12:55:16 [notice] 1#1: nginx/1.27.1 winiso | 2024/09/27 12:55:16 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) winiso | 2024/09/27 12:55:16 [notice] 1#1: OS: Linux 6.8.0-45-generic winiso | 2024/09/27 12:55:16 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker processes winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 22 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 23 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 24 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 25 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 26 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 27 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 28 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 29 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 30 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 31 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 32 winiso | 2024/09/27 12:55:16 [notice] 1#1: start worker process 33 windows | ❯ Starting Windows for Docker v0.0... windows | ❯ For support visit https://github.com/dockur/windows windows | ❯ CPU: 12th Gen Intel Core TM i5 12400 | RAM: 13/16 GB | DISK: 333 GB (ext4) | HOST: 6.8.0-45... windows | windows | ❯ Booting Windows securely using QEMU v9.0.2... windows | BdsDxe: loading Boot0002 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0) windows | BdsDxe: starting Boot0002 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0) windows | ❯ Windows started succesfully, visit http://localhost:8006/ to view the screen...Screenshots (optional)
No response