Hello, I am trying to automate some stuff from dom0. I wrote a script to create qubes based on some json files. I wrote it in python, but I am not a very good programmer (learning on my own).
So far I have been using this to send a bash script to a VM that configures some things for me:
subprocess.run(
['qvm-run', '-u', 'user', '--no-shell', '--pass-io', vmname, '--', 'bash', '-c', '--', script],
shell=False, check=False
)
The script is given as a string, and it worked, but if I give it too big of a script, then it failed with error 125:
2026-11-11 00:35:37.136 qrexec-client[605752]: vchan_timeout.c:46:qubes_wait_for_vchan_connection_with_timeout: vchan connection timeout
2026-11-11 00:35:37.136 qrexec-client[605752]: qrexec-client.c:408:main: qrexec connection timeout
The LLM suggested this:
result = subprocess.run(
['qvm-run', '-u', 'user', '--no-shell', '--pass-io', name, '--', 'bash', '-s'],
input=script,
text=True,
shell=False,
check=False,
)
Could someone more knowledgeable than me tell me if this is safe? Will it even work?