How to call a script inside a qube from dom0?

I have a script running in dom0 that calls scripts inside qubes.

I’m using qvm-run qube_name script_path.

I get the error:
command failed with code 127

Manually trying to call a script thru terminal gives the same error. Surrounding the script path with quotes doesn’t change anything.

The script permissions are set to execute. The path is correct.

What am I doing wrong?

Terminal outputs:

Running command: qvm-run dev /home/emily/Documents/hotstring_runner/ testing
[emily@dom0 ~]$ Running '/home/emily/Documents/hotstring_runner/' on dev
dev: command failed with code: 127
[emily@dom0 ~]$ qvm-run dev /home/emily/Documents/hotstring_runner/ testing
Running '/home/emily/Documents/hotstring_runner/' on dev
dev: command failed with code: 127
[emily@dom0 ~]$ qvm-run dev /home/emily/Documents/hotstring_runner/
Running '/home/emily/Documents/hotstring_runner/' on dev
dev: command failed with code: 127
[emily@dom0 ~]$ qvm-run dev '/home/emily/Documents/hotstring_runner/'
Running '/home/emily/Documents/hotstring_runner/' on dev
dev: command failed with code: 127
[emily@dom0 ~]$ qvm-run dev /home/emily/Documents/hotstring_runner/
Running '/home/emily/Documents/hotstring_runner/' on dev
dev: command failed with code: 127

you are trying to execute command, not execute script, try this :
qvm-run dev “/home/emily/Documents/hotstring_runner/”

I wasn’t able to get it to work with that double quotes either.

Running the script with --pass-io would give you any error messages to go along with the error code, which could help debug this:

$ qvm-run --pass-io dev /home/emily/Documents/hotstring_runner/

In the meanwhile a couple of observations: 127 is usually ‘command not found’ and /home/emily looks more like a dom0 path than a domU path. Have you double checked, that the script is at /home/emily/Documents/hotstring_runner/ in your dev VM?


I have triple checked the path. Unless it needs a ~ or something in front of it. The script folder is in the documents folder. I’ve triple checked everything.
(You can give it a try yourself if you want by downloading the runner here:
Fast web, file, bookmarks, crypto searches from dom0)

The call for the bookmarks and files runner is under /data/ Everything else works… aside from calling the bookmarks and file runner inside the qube.

I tried the --pass-io tag. Still the same error “no such file or directory”. I’ve tried calling with Bash and manually entering the command. Unless there is something wrong with the path, I can’t see why it’s throwing this error.

When running the path inside the qube, it launches just fine. I’m just unable to call it from dom0.

(Unfortunate, as that was the design of the whole script… dom0 hostring runner calls the file runner and bookmarks runner inside the qube.)

FWIW, that runs just fine for me:

$ qvm-run --pass-io disp7184 /home/user/Documents/hotstring_runner/ testing ; echo $?
/home/user/Documents/hotstring_runner/ line 70: /home/user/.config/BraveSoftware/Brave-Browser-Nightly/Default/Bookmarks: No such file or directory
No bookmarks match found.

If you’re sure about the path, the next thing would probably be to check that qrexec works fine in that qube by running some trivial command like

$ qvm-run --pass-io dev ls /home

try this first then,
qvm-run -p -u root dev "find / -iname "**""
then use that $path to run
qvm-run dev "$path"

*nb: $path is actual path from the output in first command. so change it.

1 Like

Okay, I got this to work using your suggestion.
String: The path that works has /rw/home/user (NOT username)?

Now here is the problem:

I need a robust way to get the path that would work, regardless of where the script is placed.

I’m using this command to get the script dir:
SCRIPT_DIR=$(cd “$(dirname “${BASH_SOURCE[0]}”)” &> /dev/null && pwd)

That outputes: /home/[username)/

…and that works in all the calls inside the qube.

When calling from dom0, I need the format /rw/home/user/

I could hack a search/replace solution… but that’s going to break.

Is there a command that would give me the /rw/home/user/full script path here version, without hacking a solution?

In Qubes-provided template-based VMs, /home is always mounted at /rw/home. They also always user the username “user”. So, if /home/user doesn’t work (for some unknown reason), but /rw/home/user always does, it’s probably safe to keep using /rw/home/user assuming qubes-provided templates.

Also, assuming the script is marked as executable and starts with the appropriate header (e.g. #!/bin/bash … or whatever), I’m not sure why /home isn’t working for you, as it generally works for me.

what is the output of the following?

qvm-run --pass-io vmname “whoami”


1 Like